From c77b1e7d9d59c7fdd84279217ddb593f353d9d0e Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Mon, 5 Jan 2015 14:45:12 -0800 Subject: [PATCH] fix bootstrap test on older kernels Summary: another unittest that doesn't work without reuseport support, add a check Test Plan: ran it on sandcastle187.prn2, works Reviewed By: njormrod@fb.com Subscribers: doug, fugalh, folly-diffs@ FB internal diff: D1764395 Tasks: 5931982 Signature: t1:1764395:1420490666:658aef148ebca9484534a0cebb228570e28f1002 --- folly/wangle/bootstrap/BootstrapTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/folly/wangle/bootstrap/BootstrapTest.cpp b/folly/wangle/bootstrap/BootstrapTest.cpp index 1efb4e08..1567978b 100644 --- a/folly/wangle/bootstrap/BootstrapTest.cpp +++ b/folly/wangle/bootstrap/BootstrapTest.cpp @@ -171,6 +171,20 @@ TEST(Bootstrap, ServerAcceptGroup2Test) { } TEST(Bootstrap, SharedThreadPool) { + // Check if reuse port is supported, if not, don't run this test + try { + EventBase base; + auto serverSocket = AsyncServerSocket::newSocket(&base); + serverSocket->bind(0); + serverSocket->listen(0); + serverSocket->startAccepting(); + serverSocket->setReusePortEnabled(true); + serverSocket->stopAccepting(); + } catch(...) { + LOG(INFO) << "Reuse port probably not supported"; + return; + } + auto pool = std::make_shared(2); TestServer server; -- 2.34.1