1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 20:45:17 -07:00

Emscripten: run the tests in benchmark mode

This commit is contained in:
Frank Denis 2017-12-21 18:46:29 +01:00
parent d7f8f6bc80
commit bd631649c1
2 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,7 @@ elif [ "x$1" = "x--browser-tests" ]; then
elif [ "x$1" = "x--tests" ]; then elif [ "x$1" = "x--tests" ]; then
echo "Building for testing" echo "Building for testing"
export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO" export EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS_SUMO"
export CPPFLAGS="${CPPFLAGS} -DBENCHMARKS -DITERATIONS=10"
export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_TESTS}" export LDFLAGS="${LDFLAGS} -s TOTAL_MEMORY=${TOTAL_MEMORY_TESTS}"
export PREFIX="$(pwd)/libsodium-js-tests" export PREFIX="$(pwd)/libsodium-js-tests"
export DONE_FILE="$(pwd)/js-tests.done" export DONE_FILE="$(pwd)/js-tests.done"

View File

@ -137,6 +137,10 @@ int main(void)
if (sodium_init() != 0) { if (sodium_init() != 0) {
return 99; return 99;
} }
#ifdef __EMSCRIPTEN__
(void) fopen("/dev/null", "r");
#endif
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
randombytes_set_implementation(&randombytes_salsa20_implementation); randombytes_set_implementation(&randombytes_salsa20_implementation);
#endif #endif