emscripten-core / emscripten-core/emscripten
Some standalone tests fail on lsan + wasm2c
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Command:
```
$ ./tests/runner.py lsan.*_standalone
```
fails with 4 tests:
```
FAIL: test_autodebug_wasm_standalone (test_core.lsan)
FAIL: test_cube2hash_standalone (test_core.lsan)
FAIL: test_longjmp_standalone (test_core.lsan)
FAIL: test_posixtime_standalone (test_core.lsan)
```
They all fail on wasm2c. If we disable this part from `also_with_standalone_wasm`, they succeed. https://github.com/emscripten-core/emscripten/blob/2052018c7a07588956a45c09efb39cabb04ebd6d/tests/test_core.py#L163-L167
It looks wasm2c is missing implementation for some library functions necessary for lsan. They only fail on `lsan` and run OK with `wasm0`/`wasm2`.
The error log for `lsan.test_longjmp_standalone` is as follows. Error logs for other tests are similar.
```
runner:WARNING: use EMTEST_ALL_ENGINES=1 in the env to run against all JS engines, which is slower but provides more coverage
shared:INFO: (Emscripten: Running sanity checks)
test_longjmp_standalone (test_core.lsan) ... common:WARNING: no wasm engine was found to run the standalone part of this test
common:WARNING: no wasm engine was found to run the standalone part of this test
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__EmscriptenSymbolizerTool__SymbolizePC_unsigned_long____sanitizer__SymbolizedStack__':
test_longjmp.wasm.c:(.text+0xe878): undefined reference to `Z_envZ_emscripten_pc_get_functionZ_ii'
/usr/bin/ld: test_longjmp.wasm.c:(.text+0xe903): undefined reference to `Z_envZ_emscripten_pc_get_fileZ_ii'
/usr/bin/ld: test_longjmp.wasm.c:(.text+0xe961): undefined reference to `Z_envZ_emscripten_pc_get_lineZ_ii'
/usr/bin/ld: test_longjmp.wasm.c:(.text+0xe998): undefined reference to `Z_envZ_emscripten_pc_get_columnZ_ii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__FlagHandlerInclude__Parse_char_const__':
test_longjmp.wasm.c:(.text+0xef1d): undefined reference to `Z_envZ___sys_getpidZ_iv'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___lsan_init':
test_longjmp.wasm.c:(.text+0x1a9b4): undefined reference to `Z_envZ_emscripten_asm_const_intZ_iiii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__CheckFailed_char_const___int__char_const___unsigned_long_long__unsigned_long_long_':
test_longjmp.wasm.c:(.text+0x1ddf0): undefined reference to `Z_envZ_emscripten_thread_sleepZ_vd'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__ReadBinaryName_char___unsigned_long_':
test_longjmp.wasm.c:(.text+0x1de92): undefined reference to `Z_envZ_emscripten_get_module_nameZ_iii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__Die__':
test_longjmp.wasm.c:(.text+0x21906): undefined reference to `Z_envZ_sigactionZ_iiii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__ListOfModules__init__':
test_longjmp.wasm.c:(.text+0x21c4b): undefined reference to `Z_envZ_emscripten_get_module_nameZ_iii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__RawWrite_char_const__':
test_longjmp.wasm.c:(.text+0x2342b): undefined reference to `Z_envZ___sys_getpidZ_iv'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__OpenFile_char_const_____sanitizer__FileAccessMode__int__':
test_longjmp.wasm.c:(.text+0x23d78): undefined reference to `Z_envZ___sys_dupZ_ii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__SharedPrintfCode_bool__char_const___void__':
test_longjmp.wasm.c:(.text+0x258e4): undefined reference to `Z_envZ___sys_getpidZ_iv'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__internal_munmap_void___unsigned_long_':
test_longjmp.wasm.c:(.text+0x28bc4): undefined reference to `Z_envZ_emscripten_builtin_munmapZ_iii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__internal_mmap_void___unsigned_long__int__int__int__unsigned_long_long_':
test_longjmp.wasm.c:(.text+0x2de6e): undefined reference to `Z_envZ_emscripten_builtin_mmap2Z_iiiiiii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__StackTrace__GetCurrentPc__':
test_longjmp.wasm.c:(.text+0x2f9f0): undefined reference to `Z_envZ_emscripten_stack_snapshotZ_iv'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__BufferedStackTrace__UnwindImpl_unsigned_long__unsigned_long__void___bool__unsigned_int_':
test_longjmp.wasm.c:(.text+0x2fd4b): undefined reference to `Z_envZ_emscripten_stack_unwind_bufferZ_iiii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sanitizer__ColorizeReports__':
test_longjmp.wasm.c:(.text+0x35e05): undefined reference to `Z_envZ_emscripten_asm_const_intZ_iiii'
/usr/bin/ld: /tmp/test_longjmp-76cb8a.o: in function `w2c___sancov___anonymous_namespace___WriteModuleCoverage_char___char_const___unsigned_long_const___unsigned_long_':
test_longjmp.wasm.c:(.text+0x455e1): undefined reference to `Z_envZ___sys_getpidZ_iv'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
FAIL
======================================================================
FAIL: test_longjmp_standalone (test_core.lsan)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/google/home/aheejin/emscripten/tests/common.py", line 827, in run_process
return shared.run_process(cmd, check=check, **args)
File "/usr/local/google/home/aheejin/emscripten/tools/shared.py", line 101, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "/usr/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/google/home/aheejin/llvm-vanilla/install.release/bin/clang', 'test_longjmp.wasm.c', '-o', 'test_longjmp.exe']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/google/home/aheejin/emscripten/tests/common.py", line 302, in resulting_test
return func(self, *args)
File "/usr/local/google/home/aheejin/emscripten/tests/test_core.py", line 167, in metafunc
func(self)
File "/usr/local/google/home/aheejin/emscripten/tests/test_core.py", line 921, in test_longjmp
self.do_core_test('test_longjmp.c')
File "/usr/local/google/home/aheejin/emscripten/tests/test_core.py", line 279, in do_core_test
self.do_run_in_out_file_test(Path('core', testname), **kwargs)
File "/usr/local/google/home/aheejin/emscripten/tests/common.py", line 1017, in do_run_in_out_file_test
self._build_and_run(srcfile, expected, **kwargs)
File "/usr/local/google/home/aheejin/emscripten/tests/common.py", line 1052, in _build_and_run
self.run_process(cmd, env=clang_native.get_clang_native_env())
File "/usr/local/google/home/aheejin/emscripten/tests/common.py", line 832, in run_process
self.fail('subprocess exited with non-zero return code(%d): `%s`' %
AssertionError: subprocess exited with non-zero return code(1): `/usr/local/google/home/aheejin/llvm-vanilla/install.release/bin/clang test_longjmp.wasm.c -o test_longjmp.exe`
----------------------------------------------------------------------
Ran 1 test in 9.341s
FAILED (failures=1)
```
Contributor guide
Assessment
This issue has not been assessed yet.