From bd631649c17a651812112aeca4b0cb4eb8167932 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 21 Dec 2017 18:46:29 +0100 Subject: [PATCH] Emscripten: run the tests in benchmark mode --- dist-build/emscripten.sh | 1 + test/default/cmptest.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh index af6e7c8c..35028e45 100755 --- a/dist-build/emscripten.sh +++ b/dist-build/emscripten.sh @@ -42,6 +42,7 @@ elif [ "x$1" = "x--browser-tests" ]; then elif [ "x$1" = "x--tests" ]; then echo "Building for testing" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" + export CPPFLAGS="${CPPFLAGS} -DBENCHMARKS -DITERATIONS=10" export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_TESTS}" export PREFIX="$(pwd)/libsodium-js-tests" export DONE_FILE="$(pwd)/js-tests.done" diff --git a/test/default/cmptest.h b/test/default/cmptest.h index bcf1064b..1a46d41b 100644 --- a/test/default/cmptest.h +++ b/test/default/cmptest.h @@ -137,6 +137,10 @@ int main(void) if (sodium_init() != 0) { return 99; } +#ifdef __EMSCRIPTEN__ + (void) fopen("/dev/null", "r"); +#endif + #ifndef __EMSCRIPTEN__ randombytes_set_implementation(&randombytes_salsa20_implementation); #endif