diff --git a/.circleci/config.yml b/.circleci/config.yml index 98ea13c618157..d5e351c2033dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -814,7 +814,7 @@ jobs: # (This bot doesn't have node canary installed which is required to # run wasm64 output). test_targets: "browser64 - skip:browser64.test_worker + skip:browser64.test_hello_world_worker* skip:browser64.test_2gb_fail skip:browser64.test_4gb_fail skip:browser64.test_4gb" diff --git a/test/hello_world_worker.cpp b/test/hello_world_worker.c similarity index 78% rename from test/hello_world_worker.cpp rename to test/hello_world_worker.c index 165eb1ec87080..4ebda93010db0 100644 --- a/test/hello_world_worker.cpp +++ b/test/hello_world_worker.c @@ -8,10 +8,10 @@ #include int main() { - printf("you should not see this text when in a worker!\n"); // this should not crash, but also should not show up anywhere if you are in a worker + // this should not crash, but also should not show up anywhere if you are in a worker + printf("you should not see this text when in a worker!\n"); FILE *f = fopen("file.dat", "r"); char buffer[100]; - memset(buffer, 0, 100); buffer[0] = 0; if (f) fread(buffer, 10, 1, f); char buffer2[100]; diff --git a/test/test_browser.py b/test/test_browser.py index d6181189e92bc..f1f2abf32fda6 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -1584,7 +1584,11 @@ def test_egl_width_height(self, args): def test_egl_createcontext_error(self): self.btest_exit('test_egl_createcontext_error.c', args=['-lEGL', '-lGL']) - def test_worker(self): + @parameterized({ + '': ([False],), + 'preload': ([True],), + }) + def test_hello_world_worker(self, file_data): # Test running in a web worker create_file('file.dat', 'data for worker') create_file('main.html', ''' @@ -1602,13 +1606,12 @@ def test_worker(self): ''' % self.port) - for file_data in (1, 0): - cmd = [EMCC, test_file('hello_world_worker.cpp'), '-o', 'worker.js'] + self.get_emcc_args() - if file_data: - cmd += ['--preload-file', 'file.dat'] - self.run_process(cmd) - self.assertExists('worker.js') - self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':') + cmd = [EMCC, test_file('hello_world_worker.c'), '-o', 'worker.js'] + self.get_emcc_args() + if file_data: + cmd += ['--preload-file', 'file.dat'] + self.run_process(cmd) + self.assertExists('worker.js') + self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':') # code should run standalone too # To great memories >4gb we need the canary version of node