diff options
author | Jack Lloyd <[email protected]> | 2018-10-12 16:07:23 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-10-12 17:02:17 -0400 |
commit | ea72317c66b3fe095a95854b6c2b8a48001721ef (patch) | |
tree | 118fbb2e19197a40c6157d18da7c16cd76651b52 /src/tests | |
parent | c8406165f8d38107a3d7dcfe3b7f0938a8a8faa2 (diff) |
Add an explicit OS target for Emscripten
This allows things to mostly work out of the box (#1702), and
allows us to write Emscripten specific code where required.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_os_utils.cpp | 10 | ||||
-rw-r--r-- | src/tests/test_rng.cpp | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/tests/test_os_utils.cpp b/src/tests/test_os_utils.cpp index b441b34ae..1cf1d4d65 100644 --- a/src/tests/test_os_utils.cpp +++ b/src/tests/test_os_utils.cpp @@ -92,15 +92,15 @@ class OS_Utils_Tests final : public Test Test::Result result("OS::get_high_resolution_clock"); - uint64_t hr_ts1 = Botan::OS::get_high_resolution_clock(); + const uint64_t hr_ts1 = Botan::OS::get_high_resolution_clock(); result.test_ne("high resolution timestamp value is never zero", hr_ts1, 0); - // do something that consumes a little time - Botan::OS::get_process_id(); + size_t counts = 0; + while(counts < 100 && (Botan::OS::get_high_resolution_clock() == hr_ts1)) + ++counts; - uint64_t hr_ts2 = Botan::OS::get_high_resolution_clock(); + result.test_lt("high resolution clock eventually changes value", counts, 128); - result.test_ne("high resolution timestamp does not duplicate", hr_ts1, hr_ts2); return result; } diff --git a/src/tests/test_rng.cpp b/src/tests/test_rng.cpp index a7a83134f..0b316335e 100644 --- a/src/tests/test_rng.cpp +++ b/src/tests/test_rng.cpp @@ -296,7 +296,11 @@ class Stateful_RNG_Tests : public Test pid_t pid = ::fork(); if(pid == -1) { +#if defined(BOTAN_TARGET_OS_IS_EMSCRIPTEN) + result.test_note("failed to fork process"); +#else result.test_failure("failed to fork process"); +#endif return result; } else if(pid != 0) |