[libcxx] r178029 - Fixed race conditions in thread tests; exposed by UBSan

Marshall Clow mclow at qualcomm.com
Tue Mar 26 08:28:33 PDT 2013


Author: marshall
Date: Tue Mar 26 10:28:33 2013
New Revision: 178029

URL: http://llvm.org/viewvc/llvm-project?rev=178029&view=rev
Log:
Fixed race conditions in thread tests; exposed by UBSan

Modified:
    libcxx/trunk/test/testit
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
    libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp

Modified: libcxx/trunk/test/testit
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/testit?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/testit (original)
+++ libcxx/trunk/test/testit Tue Mar 26 10:28:33 2013
@@ -88,6 +88,10 @@ function afunc
 	if (ls *.pass.cpp &> /dev/null)
 	then
 		for FILE in $(ls *.pass.cpp); do
+            if [ "$VERBOSE" ]
+            then
+             	echo "Running test: " $FILE
+            fi
 			if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE
 			then
 				if ./$TEST_EXE

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,14 +32,14 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 
     void operator()(int i, double j)
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         assert(i == 5);
         assert(j == 5.5);
         op_run = true;

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp Tue Mar 26 10:28:33 2013
@@ -32,14 +32,14 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 
     void operator()(int i, double j)
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         assert(i == 5);
         assert(j == 5.5);
         op_run = true;

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,14 +32,14 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 
     void operator()(int i, double j)
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         assert(i == 5);
         assert(j == 5.5);
         op_run = true;

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };

Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp?rev=178029&r1=178028&r2=178029&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp Tue Mar 26 10:28:33 2013
@@ -32,7 +32,7 @@ public:
     void operator()()
     {
         assert(alive_ == 1);
-        assert(n_alive == 1);
+        assert(n_alive >= 1);
         op_run = true;
     }
 };





More information about the cfe-commits mailing list