Protect lock tests under libcpp-no-exceptions

Skip tests that expect an exception to be thrown.

Differential Revision: https://reviews.llvm.org/D26184




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roger Ferrer Ibanez
2016-11-01 15:00:16 +00:00
parent 6168a5e55f
commit 8883740456
13 changed files with 86 additions and 18 deletions

View File

@@ -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 <mutex>
#include <cassert>
#include "test_macros.h"
class L0
{
bool locked_;
@@ -78,12 +79,12 @@ public:
void lock()
{
throw 1;
TEST_THROW(1);
}
bool try_lock()
{
throw 1;
TEST_THROW(1);
return locked_;
}
@@ -115,6 +116,7 @@ int main()
assert(l0.locked());
assert(l1.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L2 l1;
@@ -185,6 +187,7 @@ int main()
assert(!l1.locked());
}
}
#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
L0 l0;
@@ -195,6 +198,7 @@ int main()
assert(l1.locked());
assert(l2.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L2 l0;
L2 l1;
@@ -211,6 +215,7 @@ int main()
assert(!l2.locked());
}
}
#endif
{
L0 l0;
L0 l1;
@@ -238,6 +243,7 @@ int main()
assert(l1.locked());
assert(l2.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -382,6 +388,7 @@ int main()
assert(!l2.locked());
}
}
#endif // TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -437,6 +444,7 @@ int main()
assert(l2.locked());
assert(l3.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -509,5 +517,6 @@ int main()
assert(!l3.locked());
}
}
#endif // TEST_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_VARIADICS
}

View File

@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -18,6 +17,8 @@
#include <mutex>
#include <cassert>
#include "test_macros.h"
class L0
{
bool locked_;
@@ -63,7 +64,7 @@ public:
bool try_lock()
{
throw 1;
TEST_THROW(1);
return locked_;
}
@@ -95,6 +96,7 @@ int main()
assert(!l0.locked());
assert(!l1.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L2 l1;
@@ -123,6 +125,7 @@ int main()
assert(!l1.locked());
}
}
#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
L0 l0;
@@ -142,6 +145,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L2 l0;
L2 l1;
@@ -167,6 +171,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
#endif
{
L0 l0;
L0 l1;
@@ -194,6 +199,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -242,6 +248,7 @@ int main()
assert(!l2.locked());
}
}
#endif
{
L1 l0;
L1 l1;
@@ -269,6 +276,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
L1 l0;
L1 l1;
@@ -458,6 +466,7 @@ int main()
assert(!l2.locked());
}
}
#endif // TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;