From df1a75858cee3f03a40a47d458133b41f297e20b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 22 Nov 2014 13:46:09 -0800 Subject: [PATCH] Mount the current dir as /test-data (nodefs) for testing Javascript code --- test/default/cmptest.h | 4 ++++ test/default/pre.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/default/cmptest.h b/test/default/cmptest.h index 156640c2..f9f93d68 100644 --- a/test/default/cmptest.h +++ b/test/default/cmptest.h @@ -10,6 +10,10 @@ #include "sodium.h" +#ifdef __EMSCRIPTEN__ +# undef TEST_SRCDIR +# define TEST_SRCDIR "/test-data" +#endif #ifndef TEST_SRCDIR # define TEST_SRCDIR "." #endif diff --git a/test/default/pre.js b/test/default/pre.js index 1a713aee..51d94d44 100644 --- a/test/default/pre.js +++ b/test/default/pre.js @@ -28,10 +28,12 @@ Module['preRun'].push(function(){ } } FS.init(); + FS.mkdir('/test-data'); + FS.mount(NODEFS, { root: '.' }, '/test'); FS.analyzePath('/dev/random').exists && FS.unlink('/dev/random'); FS.analyzePath('/dev/urandom') && FS.unlink('/dev/urandom'); var devFolder = FS.findObject('/dev') || Module['FS_createFolder']('/', 'dev', true, true); Module['FS_createDevice'](devFolder, 'random', randombyte); - Module['FS_createDevice'](devFolder, 'urandom', randombyte); + Module['FS_createDevice'](devFolder, 'urandom', randombyte); });