Skip to content

Commit 7214c29

Browse files
authored
tests: Honor test emcc_args in self.emcc helper functions (#16881)
These means that object files compiled with this helper will have the correct flags set by default.
1 parent a27364b commit 7214c29

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

tests/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def run_process(self, cmd, check=True, **args):
935935
self.fail(f'subprocess exited with non-zero return code({e.returncode}): `{shared.shlex_join(cmd)}`')
936936

937937
def emcc(self, filename, args=[], output_filename=None, **kwargs):
938-
cmd = [compiler_for(filename), filename] + args
938+
cmd = [compiler_for(filename), filename] + self.get_emcc_args(ldflags='-c' not in args) + args
939939
if output_filename:
940940
cmd += ['-o', output_filename]
941941
self.run_process(cmd, **kwargs)

tests/module/test_stdin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void main_loop() {
2828
if (ret != EOF) putc(ret, stdout);
2929
if (ret == '\n') line++;
3030
} else if (line > 0) {
31-
ret = scanf("%10s", str);
31+
ret = scanf("%9s", str);
3232
if (ret > 0) puts(str);
3333
}
3434

tests/test_core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ def test_multiply_defined_symbols(self):
868868

869869
building.link_to_object(['main.o', 'liba.a', 'libb.a'], 'all.o')
870870

871-
self.emcc('all.o', self.get_emcc_args(), 'all.js')
871+
self.emcc('all.o', output_filename='all.js')
872872
self.do_run('all.js', 'result: 1', no_build=True)
873873

874874
def test_if(self):
@@ -7485,7 +7485,7 @@ def test_source_map(self, args):
74857485
no_maps_filename = 'no-maps.out.js'
74867486

74877487
assert '-gsource-map' not in self.emcc_args
7488-
self.emcc('src.cpp', self.get_emcc_args(), out_filename)
7488+
self.emcc('src.cpp', output_filename=out_filename)
74897489
# the file name may find its way into the generated code, so make sure we
74907490
# can do an apples-to-apples comparison by compiling with the same file name
74917491
shutil.move(out_filename, no_maps_filename)
@@ -7538,7 +7538,7 @@ def test_dwarf(self):
75387538
wasm_filename = 'a.out.wasm'
75397539
shutil.copyfile(test_file('core/test_dwarf.c'), 'test_dwarf.c')
75407540

7541-
self.emcc('test_dwarf.c', self.get_emcc_args(), js_filename)
7541+
self.emcc('test_dwarf.c', output_filename=js_filename)
75427542

75437543
out = self.run_process([shared.LLVM_DWARFDUMP, wasm_filename, '-all'], stdout=PIPE).stdout
75447544

tests/test_other.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ def test_multiply_defined_libsymbols(self):
10111011
}
10121012
''')
10131013

1014+
self.emcc_args.remove('-Werror')
10141015
self.emcc('libA.c', ['-shared'], output_filename='libA.so')
10151016

10161017
self.emcc('a2.c', ['-r', '-L.', '-lA', '-o', 'a2.o'])
@@ -1158,6 +1159,8 @@ def test_redundant_link(self):
11581159
return 0;
11591160
}
11601161
''')
1162+
1163+
self.emcc_args.remove('-Werror')
11611164
self.emcc('libA.c', ['-shared'], output_filename='libA.so')
11621165
self.emcc('main.c', ['libA.so', 'libA.so'], output_filename='a.out.js')
11631166
self.assertContained('result: 1', self.run_js('a.out.js'))
@@ -1846,6 +1849,8 @@ def test_vorbis(self):
18461849
self.assertContained('ALL OK', self.run_process(config.JS_ENGINES[0] + ['a.out.js'], stdout=PIPE, stderr=PIPE).stdout)
18471850

18481851
def test_bzip2(self):
1852+
self.emcc_args.remove('-Werror')
1853+
self.emcc_args.append('-Wno-pointer-sign')
18491854
self.emcc(test_file('bzip2_test.c'), ['-sUSE_BZIP2=1'], output_filename='a.out.js')
18501855
self.assertContained("usage: unzcrash filename", self.run_process(config.JS_ENGINES[0] + ['a.out.js'], stdout=PIPE, stderr=PIPE).stdout)
18511856

0 commit comments

Comments
 (0)