aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-30 12:23:30 -0400
committerJack Lloyd <[email protected]>2017-08-30 12:23:30 -0400
commit931fc0db4ae4a2b63c81bee65186bd181368a5cd (patch)
tree846c23990d3f79f8d32f81d6698ce6aa4d7cdad0 /src/tests
parent06eefb457eb8e4fadd46d8dbde026a9f163ff4f1 (diff)
Add support for LLVM bitcode target
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/main.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tests/main.cpp b/src/tests/main.cpp
index e30c268c0..ae1ad18a7 100644
--- a/src/tests/main.cpp
+++ b/src/tests/main.cpp
@@ -11,8 +11,6 @@
#include <string>
#include <set>
#include <deque>
-#include <thread>
-#include <future>
#include <cstdlib>
#include <botan/version.h>
@@ -35,6 +33,11 @@
#include <botan/internal/openssl.h>
#endif
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
+ #include <thread>
+ #include <future>
+#endif
+
namespace {
class Test_Runner : public Botan_CLI::Command
@@ -192,7 +195,12 @@ class Test_Runner : public Botan_CLI::Command
std::unique_ptr<Botan::HMAC_DRBG> drbg(new Botan::HMAC_DRBG("SHA-384"));
drbg->initialize_with(seed.data(), seed.size());
+
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
rng.reset(new Botan::Serialized_RNG(drbg.release()));
+#else
+ rng = std::move(drbg);
+#endif
#else
@@ -323,6 +331,7 @@ class Test_Runner : public Botan_CLI::Command
else
{
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
/*
We're not doing this in a particularly nice way, and variance in time is
high so commonly we'll 'run dry' by blocking on the first future. But
@@ -365,6 +374,10 @@ class Test_Runner : public Botan_CLI::Command
out << report_out(fut_results[0].get(), tests_failed, tests_ran) << std::flush;
fut_results.pop_front();
}
+#else
+ out << "Threading support disabled\n";
+ return 1;
+#endif
}
const uint64_t total_ns = Botan_Tests::Test::timestamp() - start_time;