From: Peter van Dijk Date: Thu, 12 Apr 2018 13:34:36 +0000 (+0200) Subject: make lock test pass on macOS X-Git-Tag: dnsdist-1.3.1~157^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30f297241205023b5fbac27ab307989fe3938405;p=pdns make lock test pass on macOS --- diff --git a/pdns/test-lock_hh.cc b/pdns/test-lock_hh.cc index 707dcc183..7f73d5e45 100644 --- a/pdns/test-lock_hh.cc +++ b/pdns/test-lock_hh.cc @@ -41,8 +41,17 @@ BOOST_AUTO_TEST_CASE(test_pdns_lock) for(auto& pp : g_locks) wlocks.emplace_back(&*pp); - TryReadLock trl(&*g_locks[0]); - BOOST_CHECK(!trl.gotIt()); + // on macOS, this TryReadLock throws (EDEADLK) instead of simply failing + // so we catch the exception and consider that success for this test + bool gotit = false; + try { + TryReadLock trl(&*g_locks[0]); + gotit = trl.gotIt(); + } + catch(const PDNSException &e) { + gotit = false; + } + BOOST_CHECK(!gotit); wlocks.clear(); TryReadLock trl2(&*g_locks[0]);