@@ -2160,8 +2160,8 @@ def test_undefined_symbols(self, action):
2160
2160
print (proc .stderr )
2161
2161
if value or action is None :
2162
2162
# The default is that we error in undefined symbols
2163
- self .assertContained ('error: undefined symbol: something' , proc .stderr )
2164
- self .assertContained ('error: undefined symbol: elsey' , proc .stderr )
2163
+ self .assertContained ('undefined symbol: something' , proc .stderr )
2164
+ self .assertContained ('undefined symbol: elsey' , proc .stderr )
2165
2165
check_success = False
2166
2166
elif action == 'ERROR' and not value :
2167
2167
# Error disables, should only warn
@@ -3541,7 +3541,7 @@ def test_js_lib_missing_sig(self):
3541
3541
def test_js_lib_quoted_key (self ):
3542
3542
create_file ('lib.js' , r'''
3543
3543
mergeInto(LibraryManager.library, {
3544
- __internal_data:{
3544
+ __internal_data:{
3545
3545
'<' : 0,
3546
3546
'white space' : 1
3547
3547
},
@@ -6584,7 +6584,7 @@ def test_no_warn_exported_jslibfunc(self):
6584
6584
err = self .expect_fail ([EMCC , test_file ('hello_world.c' ),
6585
6585
'-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=alGetError' ,
6586
6586
'-sEXPORTED_FUNCTIONS=_main,_alGet' ])
6587
- self .assertContained ('undefined exported symbol: "_alGet"' , err )
6587
+ self .assertContained ('error: undefined exported symbol: "_alGet" [-Wundefined] [-Werror] ' , err )
6588
6588
6589
6589
def test_musl_syscalls (self ):
6590
6590
self .run_process ([EMCC , test_file ('hello_world.c' )])
@@ -8354,7 +8354,7 @@ def test_full_js_library(self):
8354
8354
def test_full_js_library_undefined (self ):
8355
8355
create_file ('main.c' , 'void foo(); int main() { foo(); return 0; }' )
8356
8356
err = self .expect_fail ([EMCC , 'main.c' , '-sSTRICT_JS' , '-sINCLUDE_FULL_LIBRARY' ])
8357
- self .assertContained ('error: undefined symbol: foo' , err )
8357
+ self .assertContained ('undefined symbol: foo' , err )
8358
8358
8359
8359
def test_full_js_library_except (self ):
8360
8360
self .set_setting ('INCLUDE_FULL_LIBRARY' , 1 )
@@ -9010,19 +9010,20 @@ def test_js_preprocess(self):
9010
9010
9011
9011
err = self .run_process ([EMCC , test_file ('hello_world.c' ), '--js-library' , 'lib.js' ], stderr = PIPE ).stderr
9012
9012
self .assertContained ('JSLIB: none of the above' , err )
9013
- self .assertEqual (err .count ('JSLIB' ), 1 )
9013
+ self .assertNotContained ('JSLIB: MAIN_MODULE' , err )
9014
+ self .assertNotContained ('JSLIB: EXIT_RUNTIME' , err )
9014
9015
9015
9016
err = self .run_process ([EMCC , test_file ('hello_world.c' ), '--js-library' , 'lib.js' , '-sMAIN_MODULE' ], stderr = PIPE ).stderr
9016
9017
self .assertContained ('JSLIB: MAIN_MODULE=1' , err )
9017
- self .assertEqual ( err . count ( 'JSLIB' ), 1 )
9018
+ self .assertNotContained ( 'JSLIB: EXIT_RUNTIME' , err )
9018
9019
9019
9020
err = self .run_process ([EMCC , test_file ('hello_world.c' ), '--js-library' , 'lib.js' , '-sMAIN_MODULE=2' ], stderr = PIPE ).stderr
9020
9021
self .assertContained ('JSLIB: MAIN_MODULE=2' , err )
9021
- self .assertEqual ( err . count ( 'JSLIB' ), 1 )
9022
+ self .assertNotContained ( 'JSLIB: EXIT_RUNTIME' , err )
9022
9023
9023
9024
err = self .run_process ([EMCC , test_file ('hello_world.c' ), '--js-library' , 'lib.js' , '-sEXIT_RUNTIME' ], stderr = PIPE ).stderr
9024
9025
self .assertContained ('JSLIB: EXIT_RUNTIME' , err )
9025
- self .assertEqual ( err . count ( 'JSLIB' ), 1 )
9026
+ self .assertNotContained ( 'JSLIB: MAIN_MODULE' , err )
9026
9027
9027
9028
def test_html_preprocess (self ):
9028
9029
src_file = test_file ('module/test_stdin.c' )
@@ -9195,7 +9196,7 @@ def test_dash_s_list_parsing(self):
9195
9196
# stray slash
9196
9197
('EXPORTED_FUNCTIONS=["_a", "_b",\\ "_c", "_d"]' , 'undefined exported symbol: "\\ \\ "_c"' ),
9197
9198
# missing comma
9198
- ('EXPORTED_FUNCTIONS=["_a", "_b" "_c", "_d"]' , 'undefined exported symbol: "_b" "_c"' ),
9199
+ ('EXPORTED_FUNCTIONS=["_a", "_b" "_c", "_d"]' , 'emcc: error: undefined exported symbol: "_b" "_c" [-Wundefined] [-Werror] ' ),
9199
9200
]:
9200
9201
print (export_arg )
9201
9202
proc = self .run_process ([EMCC , 'src.c' , '-s' , export_arg ], stdout = PIPE , stderr = PIPE , check = not expected )
@@ -10880,20 +10881,20 @@ def test_signature_mismatch(self):
10880
10881
self .expect_fail ([EMCC , '-Wl,--fatal-warnings' , 'a.c' , 'b.c' ])
10881
10882
self .expect_fail ([EMCC , '-sSTRICT' , 'a.c' , 'b.c' ])
10882
10883
10884
+ # TODO(sbc): Remove these tests once we remove the LLD_REPORT_UNDEFINED
10883
10885
def test_lld_report_undefined (self ):
10884
10886
create_file ('main.c' , 'void foo(); int main() { foo(); return 0; }' )
10885
- stderr = self .expect_fail ([EMCC , '-sLLD_REPORT_UNDEFINED' , 'main.c' ])
10886
- self .assertContained ('wasm-ld: error:' , stderr )
10887
- self .assertContained ('main_0.o: undefined symbol: foo' , stderr )
10887
+ stderr = self .expect_fail ([EMCC , '-sLLD_REPORT_UNDEFINED=0' , 'main.c' ])
10888
+ self .assertContained ('error: undefined symbol: foo (referenced by top-level compiled C/C++ code)' , stderr )
10888
10889
10889
10890
def test_lld_report_undefined_reverse_deps (self ):
10890
- self .run_process ([EMCC , '-sLLD_REPORT_UNDEFINED' , '-sREVERSE_DEPS=all' , test_file ('hello_world.c' )])
10891
+ self .run_process ([EMCC , '-sLLD_REPORT_UNDEFINED=0 ' , '-sREVERSE_DEPS=all' , test_file ('hello_world.c' )])
10891
10892
10892
10893
def test_lld_report_undefined_exceptions (self ):
10893
- self .run_process ([EMXX , '-sLLD_REPORT_UNDEFINED' , '-fwasm-exceptions' , test_file ('hello_libcxx.cpp' )])
10894
+ self .run_process ([EMXX , '-sLLD_REPORT_UNDEFINED=0 ' , '-fwasm-exceptions' , test_file ('hello_libcxx.cpp' )])
10894
10895
10895
10896
def test_lld_report_undefined_main_module (self ):
10896
- self .run_process ([EMCC , '-sLLD_REPORT_UNDEFINED' , '-sMAIN_MODULE=2' , test_file ('hello_world.c' )])
10897
+ self .run_process ([EMCC , '-sLLD_REPORT_UNDEFINED=0 ' , '-sMAIN_MODULE=2' , test_file ('hello_world.c' )])
10897
10898
10898
10899
# Verifies that warning messages that Closure outputs are recorded to console
10899
10900
def test_closure_warnings (self ):
@@ -11031,14 +11032,12 @@ def test_linker_version(self):
11031
11032
def test_chained_js_error_diagnostics (self ):
11032
11033
err = self .expect_fail ([EMCC , test_file ('test_chained_js_error_diagnostics.c' ), '--js-library' , test_file ('test_chained_js_error_diagnostics.js' )])
11033
11034
self .assertContained ("error: undefined symbol: nonexistent_function (referenced by bar__deps: ['nonexistent_function'], referenced by foo__deps: ['bar'], referenced by top-level compiled C/C++ code)" , err )
11034
- # Check that we don't recommend LLD_REPORT_UNDEFINED for chained dependencies.
11035
- self .assertNotContained ('LLD_REPORT_UNDEFINED' , err )
11036
11035
11037
- # Test without chaining. In this case we don't include the JS library at all resulting in `foo`
11038
- # being undefined in the native code and in this case we recommend LLD_REPORT_UNDEFINED .
11036
+ # Test without chaining. In this case we don't include the JS library at
11037
+ # all resulting in `foo` being undefined in the native code .
11039
11038
err = self .expect_fail ([EMCC , test_file ('test_chained_js_error_diagnostics.c' )])
11040
- self .assertContained ('error: undefined symbol: foo (referenced by top-level compiled C/C++ code) ' , err )
11041
- self .assertContained ( 'Link with `-sLLD_REPORT_UNDEFINED` to get more information on undefined symbols ' , err )
11039
+ self .assertContained ('undefined symbol: foo' , err )
11040
+ self .assertNotContained ( 'referenced by top-level compiled C/C++ code ' , err )
11042
11041
11043
11042
def test_xclang_flag (self ):
11044
11043
create_file ('foo.h' , ' ' )
@@ -11476,7 +11475,7 @@ def test_split_main_module(self):
11476
11475
11477
11476
self .run_process ([EMCC , side_src , '-sSIDE_MODULE' , '-g' , '-o' , 'libhello.wasm' ])
11478
11477
11479
- self .emcc_args += ['-g' ]
11478
+ self .emcc_args += ['-g' , 'libhello.wasm' ]
11480
11479
self .emcc_args += ['-sMAIN_MODULE=2' ]
11481
11480
self .emcc_args += ['-sEXPORTED_FUNCTIONS=_printf' ]
11482
11481
self .emcc_args += ['-sSPLIT_MODULE' , '-Wno-experimental' ]
@@ -11840,7 +11839,7 @@ def test_no_main_with_PROXY_TO_PTHREAD(self):
11840
11839
void foo() {}
11841
11840
''' )
11842
11841
err = self .expect_fail ([EMCC , 'lib.cpp' , '-pthread' , '-sPROXY_TO_PTHREAD' ])
11843
- self .assertContained ('error: PROXY_TO_PTHREAD proxies main() for you, but no main exists ' , err )
11842
+ self .assertContained ('crt1_proxy_main.o: undefined symbol: main' , err )
11844
11843
11845
11844
def test_archive_bad_extension (self ):
11846
11845
# Regression test for https://github.com/emscripten-core/emscripten/issues/14012
@@ -11882,7 +11881,7 @@ def test_unimplemented_syscalls(self, args):
11882
11881
cmd = [EMCC , 'main.c' , '-sASSERTIONS' ] + args
11883
11882
if args :
11884
11883
err = self .expect_fail (cmd )
11885
- self .assertContained ('error: undefined symbol: __syscall_mincore' , err )
11884
+ self .assertContained ('undefined symbol: __syscall_mincore' , err )
11886
11885
else :
11887
11886
self .run_process (cmd )
11888
11887
err = self .run_js ('a.out.js' )
0 commit comments