Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // This test hangs forever when built against libstdc++. In order to allow @@ -23,6 +22,8 @@ #include #include +#include "test_macros.h" + class L0 { bool locked_; @@ -78,12 +79,12 @@ void lock() { - throw 1; + TEST_THROW(1); } bool try_lock() { - throw 1; + TEST_THROW(1); return locked_; } @@ -115,6 +116,7 @@ assert(l0.locked()); assert(l1.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L0 l0; L2 l1; @@ -185,6 +187,7 @@ assert(!l1.locked()); } } +#endif #ifndef _LIBCPP_HAS_NO_VARIADICS { L0 l0; @@ -195,6 +198,7 @@ assert(l1.locked()); assert(l2.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L2 l0; L2 l1; @@ -211,6 +215,7 @@ assert(!l2.locked()); } } +#endif { L0 l0; L0 l1; @@ -238,6 +243,7 @@ assert(l1.locked()); assert(l2.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L0 l0; L0 l1; @@ -382,6 +388,7 @@ assert(!l2.locked()); } } +#endif // TEST_HAS_NO_EXCEPTIONS { L0 l0; L0 l1; @@ -437,6 +444,7 @@ assert(l2.locked()); assert(l3.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L0 l0; L0 l1; @@ -509,5 +517,6 @@ assert(!l3.locked()); } } +#endif // TEST_HAS_NO_EXCEPTIONS #endif // _LIBCPP_HAS_NO_VARIADICS } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -18,6 +17,8 @@ #include #include +#include "test_macros.h" + class L0 { bool locked_; @@ -63,7 +64,7 @@ bool try_lock() { - throw 1; + TEST_THROW(1); return locked_; } @@ -95,6 +96,7 @@ assert(!l0.locked()); assert(!l1.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L0 l0; L2 l1; @@ -123,6 +125,7 @@ assert(!l1.locked()); } } +#endif #ifndef _LIBCPP_HAS_NO_VARIADICS { L0 l0; @@ -142,6 +145,7 @@ assert(!l1.locked()); assert(!l2.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L2 l0; L2 l1; @@ -167,6 +171,7 @@ assert(!l1.locked()); assert(!l2.locked()); } +#endif { L0 l0; L0 l1; @@ -194,6 +199,7 @@ assert(!l1.locked()); assert(!l2.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L0 l0; L0 l1; @@ -242,6 +248,7 @@ assert(!l2.locked()); } } +#endif { L1 l0; L1 l1; @@ -269,6 +276,7 @@ assert(!l1.locked()); assert(!l2.locked()); } +#ifndef TEST_HAS_NO_EXCEPTIONS { L1 l0; L1 l1; @@ -458,6 +466,7 @@ assert(!l2.locked()); } } +#endif // TEST_HAS_NO_EXCEPTIONS { L0 l0; L0 l1; Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp +++ libcxx/trunk/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 @@ 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 @@ { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.lock(); @@ -74,6 +76,7 @@ { assert(e.code().value() == EPERM); } +#endif } int main() Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp +++ libcxx/trunk/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 #include +#include "test_macros.h" + bool try_lock_called = false; struct mutex @@ -36,11 +37,11 @@ int main() { - std::shared_lock 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 @@ { 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 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp +++ libcxx/trunk/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 #include +#include "test_macros.h" + bool try_lock_for_called = false; typedef std::chrono::milliseconds ms; @@ -45,6 +46,7 @@ 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 @@ { 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 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp +++ libcxx/trunk/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 #include +#include "test_macros.h" + bool try_lock_until_called = false; struct mutex @@ -45,6 +46,7 @@ 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 @@ { 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 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp +++ libcxx/trunk/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 #include +#include "test_macros.h" + bool unlock_called = false; struct mutex @@ -36,6 +37,7 @@ lk.unlock(); assert(unlock_called == true); assert(lk.owns_lock() == false); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -45,7 +47,9 @@ { assert(e.code().value() == EPERM); } +#endif lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -55,4 +59,5 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -21,6 +20,8 @@ #include #include +#include "test_macros.h" + std::mutex m; typedef std::chrono::system_clock Clock; @@ -38,6 +39,7 @@ assert(lk.owns_lock() == true); ns d = t1 - t0 - ms(250); assert(d < ms(25)); // within 25ms +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.lock(); @@ -47,8 +49,10 @@ { assert(e.code().value() == EDEADLK); } +#endif lk.unlock(); lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.lock(); @@ -58,6 +62,7 @@ { assert(e.code().value() == EPERM); } +#endif } int main() Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -19,6 +18,8 @@ #include #include +#include "test_macros.h" + bool try_lock_called = false; struct mutex @@ -39,6 +40,7 @@ assert(lk.try_lock() == true); assert(try_lock_called == true); assert(lk.owns_lock() == true); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.try_lock(); @@ -48,11 +50,13 @@ { 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(); @@ -62,4 +66,5 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -20,6 +19,8 @@ #include #include +#include "test_macros.h" + bool try_lock_for_called = false; typedef std::chrono::milliseconds ms; @@ -44,6 +45,7 @@ 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)); @@ -53,11 +55,13 @@ { 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)); @@ -67,4 +71,5 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -20,6 +19,8 @@ #include #include +#include "test_macros.h" + bool try_lock_until_called = false; struct mutex @@ -44,6 +45,7 @@ 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()); @@ -53,11 +55,13 @@ { 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()); @@ -67,4 +71,5 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -19,6 +18,8 @@ #include #include +#include "test_macros.h" + bool unlock_called = false; struct mutex @@ -35,6 +36,7 @@ lk.unlock(); assert(unlock_called == true); assert(lk.owns_lock() == false); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -44,7 +46,9 @@ { assert(e.code().value() == EPERM); } +#endif lk.release(); +#ifndef TEST_HAS_NO_EXCEPTIONS try { lk.unlock(); @@ -54,4 +58,5 @@ { assert(e.code().value() == EPERM); } +#endif } Index: libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp =================================================================== --- libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp +++ libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // @@ -50,12 +49,13 @@ ++init3_called; std::this_thread::sleep_for(ms(250)); if (init3_called == 1) - throw 1; + TEST_THROW(1); ++init3_completed; } void f3() { +#ifndef TEST_HAS_NO_EXCEPTIONS try { std::call_once(flg3, init3); @@ -63,6 +63,7 @@ catch (...) { } +#endif } #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -197,6 +198,7 @@ t1.join(); assert(init0_called == 1); } +#ifndef TEST_HAS_NO_EXCEPTIONS // check basic exception safety { std::thread t0(f3); @@ -206,6 +208,7 @@ assert(init3_called == 2); assert(init3_completed == 1); } +#endif // check deadlock avoidance { std::thread t0(f41);