summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/test_guard.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-11-24 22:42:03 +0000
committerEric Fiselier <eric@efcs.ca>2014-11-24 22:42:03 +0000
commit559f867af23c4bf53df1fdd2294450b86fb88c8e (patch)
tree97fd1d2a1b32c0fbb1350d868f805b6e1731ca12 /libcxxabi/test/test_guard.cpp
parentc5de7b113b53a72ea02ea269d81151e8b3c3f9df (diff)
downloadbcm5719-llvm-559f867af23c4bf53df1fdd2294450b86fb88c8e.tar.gz
bcm5719-llvm-559f867af23c4bf53df1fdd2294450b86fb88c8e.zip
[libcxxabi] Refactor building and testing libc++abi without threads
Summary: This patch adds CMake support for building and testing libc++abi without threads. 1. Add `LIBCXXABI_ENABLE_THREADS` option to CMake. 2. Propagate `LIBCXXABI_ENABLE_THREADS` to lit via lit.site.cfg.in 3. Configure tests for `LIBCXXABI_ENABLE_THREADS=OFF Currently the test suite does not work when libc++abi is built without threads because that information does not propagate to the test suite. Reviewers: danalbert, mclow.lists, jroelofs Reviewed By: jroelofs Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6393 llvm-svn: 222702
Diffstat (limited to 'libcxxabi/test/test_guard.cpp')
-rw-r--r--libcxxabi/test/test_guard.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxxabi/test/test_guard.cpp b/libcxxabi/test/test_guard.cpp
index 96af56a7be1..41ff79432b5 100644
--- a/libcxxabi/test/test_guard.cpp
+++ b/libcxxabi/test/test_guard.cpp
@@ -7,10 +7,14 @@
//
//===----------------------------------------------------------------------===//
+#include "../src/config.h"
#include "cxxabi.h"
#include <cassert>
+
+#if !LIBCXXABI_HAS_NO_THREADS
#include <thread>
+#endif
// Ensure that we initialize each variable once and only once.
namespace test1 {
@@ -72,6 +76,7 @@ namespace test3 {
}
}
+#if !LIBCXXABI_HAS_NO_THREADS
// A simple thread test of two threads racing to initialize a variable. This
// isn't guaranteed to catch any particular threading problems.
namespace test4 {
@@ -123,12 +128,15 @@ namespace test5 {
assert(run_count == 1);
}
}
+#endif /* LIBCXXABI_HAS_NO_THREADS */
int main()
{
test1::test();
test2::test();
test3::test();
+#if !LIBCXXABI_HAS_NO_THREADS
test4::test();
test5::test();
+#endif
}
OpenPOWER on IntegriCloud