diff options
author | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-11-01 15:00:16 +0000 |
---|---|---|
committer | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-11-01 15:00:16 +0000 |
commit | 60d6ef63a4e30bbba038d67849fa786314f670f6 (patch) | |
tree | 7a3fc11c8e3f9282fbf4a32283b12d81c222c0ac /libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared | |
parent | 05ce4ca0dd8c43d86f3c5f9b4f55c9ce95ee5a73 (diff) | |
download | bcm5719-llvm-60d6ef63a4e30bbba038d67849fa786314f670f6.tar.gz bcm5719-llvm-60d6ef63a4e30bbba038d67849fa786314f670f6.zip |
Protect lock tests under libcpp-no-exceptions
Skip tests that expect an exception to be thrown.
Differential Revision: https://reviews.llvm.org/D26184
llvm-svn: 285695
Diffstat (limited to 'libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared')
5 files changed, 28 insertions, 6 deletions
diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp index 5c3513c98e0..25d78ab1902 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03, c++11 @@ -54,6 +53,7 @@ void f() assert(lk.owns_lock() == true); ns d = t1 - t0 - WaitTime; assert(d < Tolerance); // within tolerance +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.lock(); @@ -63,8 +63,10 @@ void f() { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.lock(); @@ -74,6 +76,7 @@ void f() { assert(e.code().value() == EPERM); } +#endif } int main() diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp index 01693c77ea3..947b1ad012e 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03, c++11 @@ -20,6 +19,8 @@ #include <shared_mutex> #include <cassert> +#include "test_macros.h" + bool try_lock_called = false; struct mutex @@ -36,11 +37,11 @@ mutex m; int main() { - std::shared_lock<mutex> lk(m, std::defer_lock); assert(lk.try_lock() == true); assert(try_lock_called == true); assert(lk.owns_lock() == true); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock(); @@ -50,11 +51,13 @@ int main() { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); assert(lk.try_lock() == false); assert(try_lock_called == false); assert(lk.owns_lock() == false); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock(); @@ -64,4 +67,5 @@ int main() { assert(e.code().value() == EPERM); } +#endif } diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp index 852a94eb65e..5cb80541256 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03, c++11 @@ -21,6 +20,8 @@ #include <shared_mutex> #include <cassert> +#include "test_macros.h" + bool try_lock_for_called = false; typedef std::chrono::milliseconds ms; @@ -45,6 +46,7 @@ int main() assert(lk.try_lock_for(ms(5)) == true); assert(try_lock_for_called == true); assert(lk.owns_lock() == true); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock_for(ms(5)); @@ -54,11 +56,13 @@ int main() { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); assert(lk.try_lock_for(ms(5)) == false); assert(try_lock_for_called == false); assert(lk.owns_lock() == false); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock_for(ms(5)); @@ -68,4 +72,5 @@ int main() { assert(e.code().value() == EPERM); } +#endif } diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp index 31574afd7d8..3ba4128d719 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03, c++11 @@ -21,6 +20,8 @@ #include <shared_mutex> #include <cassert> +#include "test_macros.h" + bool try_lock_until_called = false; struct mutex @@ -45,6 +46,7 @@ int main() assert(lk.try_lock_until(Clock::now()) == true); assert(try_lock_until_called == true); assert(lk.owns_lock() == true); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock_until(Clock::now()); @@ -54,11 +56,13 @@ int main() { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); assert(lk.try_lock_until(Clock::now()) == false); assert(try_lock_until_called == false); assert(lk.owns_lock() == false); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock_until(Clock::now()); @@ -68,4 +72,5 @@ int main() { assert(e.code().value() == EPERM); } +#endif } diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp index 6a7385ed42a..903b53ace0f 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03, c++11 @@ -20,6 +19,8 @@ #include <shared_mutex> #include <cassert> +#include "test_macros.h" + bool unlock_called = false; struct mutex @@ -36,6 +37,7 @@ int main() lk.unlock(); assert(unlock_called == true); assert(lk.owns_lock() == false); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -45,7 +47,9 @@ int main() { assert(e.code().value() == EPERM); } +#endif lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -55,4 +59,5 @@ int main() { assert(e.code().value() == EPERM); } +#endif } |