]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Disable MutexTest.destoryLocked on Solaris
authorMukund Sivaraman <muks@isc.org>
Fri, 26 Oct 2012 03:14:57 +0000 (08:44 +0530)
committerMukund Sivaraman <muks@isc.org>
Fri, 26 Oct 2012 03:51:19 +0000 (09:21 +0530)
configure.ac
src/lib/util/threads/tests/lock_unittest.cc

index 5bbba1602571fa03a62e8d4672c65fbcc9dcd738..a9d5a8186a10204d614dc2f2f1c3733fe3929683 100644 (file)
@@ -217,6 +217,10 @@ case "$host" in
        CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
        # "now" binding is necessary to prevent deadlocks in C++ static initialization code
        LDFLAGS="$LDFLAGS -z now"
+       # Destroying locked mutexes, condition variables being waited
+       # on, etc. are undefined behavior on Solaris, so we set it as
+       # such here.
+       AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
        ;;
 *-apple-darwin*)
        # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
index 498d01e00ad35ddfe5bbd72cb6b93d86c5591d11..1abc3fac99dd2bb5c0ba675ae50e11685536b125 100644 (file)
@@ -12,6 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
+#include <config.h>
+
 #include <gtest/gtest.h>
 
 #include <util/threads/sync.h>
@@ -46,11 +48,11 @@ TEST(MutexTest, lockMultiple) {
 
 #endif // ENABLE_DEBUG
 
+#ifndef HAS_UNDEFINED_PTHREAD_BEHAVIOR
 // Destroying a locked mutex is a bad idea as well
-#ifdef EXPECT_DEATH
 TEST(MutexTest, destroyLocked) {
     if (!isc::util::unittests::runningOnValgrind()) {
-        EXPECT_DEATH({
+        EXPECT_DEATH_IF_SUPPORTED({
             Mutex* mutex = new Mutex;
             new Mutex::Locker(*mutex);
             delete mutex;
@@ -59,7 +61,7 @@ TEST(MutexTest, destroyLocked) {
         }, "");
     }
 }
-#endif
+#endif // !HAS_UNDEFINED_PTHREAD_BEHAVIOR
 
 // In this test, we try to check if a mutex really locks. We could try that
 // with a deadlock, but that's not practical (the test would not end).