[cfe-commits] [libcxx] r154095 - in /libcxx/trunk/test/atomics: atomics.types.generic/ atomics.types.operations/atomics.types.operations.req/
David Chisnall
csdavec at swan.ac.uk
Thu Apr 5 06:48:16 PDT 2012
Author: theraven
Date: Thu Apr 5 08:48:16 2012
New Revision: 154095
URL: http://llvm.org/viewvc/llvm-project?rev=154095&view=rev
Log:
Fix the remaining atomic tests, all of which were wrong for the case where a
compare-and-exchange failed (it should update the expected value to the current
value, and the tests were checking that it didn't...).
Results of the atomics part of the test suite on FreeBSD with clang trunk and
the atomic.c from compiler-rt (currently kludged into the test, not installed
properly):
****************************************************
Results for /root/libc++/test/atomics:
using clang version 3.1 (trunk 153415)
Target: x86_64-unknown-freebsd10.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -pthread /tmp/atomic.o
----------------------------------------------------
sections without tests : 0
sections with failures : 0
sections without failures: 14
+ ----
total number of sections : 14
----------------------------------------------------
number of tests failed : 0
number of tests passed : 52
+ ----
total number of tests : 52
****************************************************
Yay!
Modified:
libcxx/trunk/test/atomics/atomics.types.generic/address.pass.cpp
libcxx/trunk/test/atomics/atomics.types.generic/bool.pass.cpp
libcxx/trunk/test/atomics/atomics.types.generic/integral.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
Modified: libcxx/trunk/test/atomics/atomics.types.generic/address.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.generic/address.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.generic/address.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.generic/address.pass.cpp Thu Apr 5 08:48:16 2012
@@ -96,14 +96,14 @@
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
- assert(x == T(1));
+ assert(x == T(2));
x = T(2);
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
- assert(x == T(0));
+ assert(x == T(1));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
obj = T(2*sizeof(X));
Modified: libcxx/trunk/test/atomics/atomics.types.generic/bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.generic/bool.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.generic/bool.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.generic/bool.pass.cpp Thu Apr 5 08:48:16 2012
@@ -78,8 +78,9 @@
assert(obj.compare_exchange_weak(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
- assert(x == true);
+ assert(x == false);
obj.store(true);
+ x = true;
assert(obj.compare_exchange_weak(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
@@ -93,7 +94,7 @@
assert(obj.compare_exchange_strong(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
- assert(x == true);
+ assert(x == false);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false,
@@ -132,8 +133,9 @@
assert(obj.compare_exchange_weak(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
- assert(x == true);
+ assert(x == false);
obj.store(true);
+ x = true;
assert(obj.compare_exchange_weak(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
@@ -147,7 +149,7 @@
assert(obj.compare_exchange_strong(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
- assert(x == true);
+ assert(x == false);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false,
Modified: libcxx/trunk/test/atomics/atomics.types.generic/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.generic/integral.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.generic/integral.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.generic/integral.pass.cpp Thu Apr 5 08:48:16 2012
@@ -114,14 +114,14 @@
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
- assert(x == T(1));
+ assert(x == T(2));
x = T(2);
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
- assert(x == T(0));
+ assert(x == T(1));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
assert(obj++ == T(0));
Modified: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp Thu Apr 5 08:48:16 2012
@@ -34,7 +34,7 @@
assert(t == T(1));
assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
{
typedef std::atomic<T> A;
@@ -46,7 +46,7 @@
assert(t == T(1));
assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
}
Modified: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp Thu Apr 5 08:48:16 2012
@@ -39,7 +39,7 @@
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
{
typedef std::atomic<T> A;
@@ -53,7 +53,7 @@
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
}
Modified: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp Thu Apr 5 08:48:16 2012
@@ -34,7 +34,7 @@
assert(t == T(1));
assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
{
typedef std::atomic<T> A;
@@ -46,7 +46,7 @@
assert(t == T(1));
assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
}
Modified: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp?rev=154095&r1=154094&r2=154095&view=diff
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp (original)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp Thu Apr 5 08:48:16 2012
@@ -39,7 +39,7 @@
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
{
typedef std::atomic<T> A;
@@ -53,7 +53,7 @@
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
- assert(t == T(3));
+ assert(t == T(2));
}
}
More information about the cfe-commits
mailing list