Skip to content

Commit ae558d9

Browse files
authored
Cleanup tests/test_system.c. NFC (#17494)
- Rename to `test_system.c` - Use `@requires_node` - Use do_runf to perform test in single call
1 parent c3fc357 commit ae558d9

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

tests/test_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5092,7 +5092,7 @@ def test_wasm2js_fallback_on_wasm_compilation_failure(self):
50925092
self.run_browser('test.html', 'hello!', '/report_result?exit:0')
50935093

50945094
def test_system(self):
5095-
self.btest_exit(test_file('system.c'))
5095+
self.btest_exit(test_file('test_system.c'))
50965096

50975097
# Tests the hello_wasm_worker.c documentation example code.
50985098
@also_with_minimal_runtime

tests/test_other.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8846,10 +8846,9 @@ def test_node_js_pthread_module(self):
88468846
self.assertContained('hello, world!', ret)
88478847

88488848
@no_windows('node system() does not seem to work, see https://github.com/emscripten-core/emscripten/pull/10547')
8849-
def test_node_js_system(self):
8850-
self.run_process([EMCC, '-DENV_NODE', test_file('system.c'), '-o', 'a.js', '-O3'])
8851-
ret = self.run_process(config.NODE_JS + ['a.js'], stdout=PIPE).stdout
8852-
self.assertContained('OK', ret)
8849+
@requires_node
8850+
def test_system_node_js(self):
8851+
self.do_runf(test_file('test_system.c'), 'Hello from echo', emcc_args=['-DENV_NODE'])
88538852

88548853
def test_node_eval(self):
88558854
self.run_process([EMCC, '-sENVIRONMENT=node', test_file('hello_world.c'), '-o', 'a.js', '-O3'])

tests/system.c renamed to tests/test_system.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main(void) {
2121
assert(system("false") == _W_EXITCODE(1, 0));
2222
assert(system("true") == _W_EXITCODE(0, 0));
2323
assert(system("kill $$") == _W_EXITCODE(0, 15));
24-
system("echo OK");
24+
system("echo Hello from echo");
2525
#else
2626
assert(system(NULL) == 0);
2727
assert(system("") == -1);

0 commit comments

Comments
 (0)