Skip to content

Commit e167c8d

Browse files
authored
Cleanup test_hello_world_worker. NFC (#22828)
1 parent f13b47d commit e167c8d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ jobs:
814814
# (This bot doesn't have node canary installed which is required to
815815
# run wasm64 output).
816816
test_targets: "browser64
817-
skip:browser64.test_worker
817+
skip:browser64.test_hello_world_worker*
818818
skip:browser64.test_2gb_fail
819819
skip:browser64.test_4gb_fail
820820
skip:browser64.test_4gb"

test/hello_world_worker.cpp renamed to test/hello_world_worker.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include <emscripten.h>
99

1010
int main() {
11-
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
11+
// this should not crash, but also should not show up anywhere if you are in a worker
12+
printf("you should not see this text when in a worker!\n");
1213
FILE *f = fopen("file.dat", "r");
1314
char buffer[100];
14-
memset(buffer, 0, 100);
1515
buffer[0] = 0;
1616
if (f) fread(buffer, 10, 1, f);
1717
char buffer2[100];

test/test_browser.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,11 @@ def test_egl_width_height(self, args):
15841584
def test_egl_createcontext_error(self):
15851585
self.btest_exit('test_egl_createcontext_error.c', args=['-lEGL', '-lGL'])
15861586

1587-
def test_worker(self):
1587+
@parameterized({
1588+
'': ([False],),
1589+
'preload': ([True],),
1590+
})
1591+
def test_hello_world_worker(self, file_data):
15881592
# Test running in a web worker
15891593
create_file('file.dat', 'data for worker')
15901594
create_file('main.html', '''
@@ -1602,13 +1606,12 @@ def test_worker(self):
16021606
</html>
16031607
''' % self.port)
16041608

1605-
for file_data in (1, 0):
1606-
cmd = [EMCC, test_file('hello_world_worker.cpp'), '-o', 'worker.js'] + self.get_emcc_args()
1607-
if file_data:
1608-
cmd += ['--preload-file', 'file.dat']
1609-
self.run_process(cmd)
1610-
self.assertExists('worker.js')
1611-
self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':')
1609+
cmd = [EMCC, test_file('hello_world_worker.c'), '-o', 'worker.js'] + self.get_emcc_args()
1610+
if file_data:
1611+
cmd += ['--preload-file', 'file.dat']
1612+
self.run_process(cmd)
1613+
self.assertExists('worker.js')
1614+
self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':')
16121615

16131616
# code should run standalone too
16141617
# To great memories >4gb we need the canary version of node

0 commit comments

Comments
 (0)