7272)
7373
7474from tools import building , config , shared , utils , webassembly
75- from tools .shared import EMAR , EMCC , EMXX , FILE_PACKAGER , LLVM_COV , LLVM_PROFDATA , PIPE
75+ from tools .shared import PIPE , paths
7676from tools .utils import LINUX , MACOS , WINDOWS , delete_file , write_file
7777
7878# decorators for limiting which modes a test can run in
8282EM_SIGINT = 2
8383EM_SIGABRT = 6
8484
85+ EMAR = paths .EMAR
86+ EMCC = paths .EMCC
87+ EMXX = paths .EMXX
88+
8589
8690def esm_integration (func ):
8791 assert callable (func )
@@ -6599,7 +6603,7 @@ def test_neon_wasm_simd(self):
65996603 @no_big_endian ('SIMD support is currently not compatible with big endian' )
66006604 def test_sse1 (self , args ):
66016605 src = test_file ('sse/test_sse1.cpp' )
6602- self .run_process ([shared .CLANG_CXX , src , '-msse' , '-o' , 'test_sse1' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6606+ self .run_process ([paths .CLANG_CXX , src , '-msse' , '-o' , 'test_sse1' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66036607 native_result = self .run_process ('./test_sse1' , stdout = PIPE ).stdout
66046608
66056609 self .maybe_closure ()
@@ -6620,7 +6624,7 @@ def test_sse1(self, args):
66206624 @no_big_endian ('SIMD support is currently not compatible with big endian' )
66216625 def test_sse2 (self , args ):
66226626 src = test_file ('sse/test_sse2.cpp' )
6623- self .run_process ([shared .CLANG_CXX , src , '-msse2' , '-Wno-argument-outside-range' , '-o' , 'test_sse2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6627+ self .run_process ([paths .CLANG_CXX , src , '-msse2' , '-Wno-argument-outside-range' , '-o' , 'test_sse2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66246628 native_result = self .run_process ('./test_sse2' , stdout = PIPE ).stdout
66256629
66266630 self .cflags += ['-I' + test_file ('sse' ), '-msse2' , '-fno-inline-functions' , '-Wno-argument-outside-range' , '-sSTACK_SIZE=1MB' ] + args
@@ -6634,7 +6638,7 @@ def test_sse2(self, args):
66346638 @no_big_endian ('SIMD support is currently not compatible with big endian' )
66356639 def test_sse3 (self ):
66366640 src = test_file ('sse/test_sse3.cpp' )
6637- self .run_process ([shared .CLANG_CXX , src , '-msse3' , '-Wno-argument-outside-range' , '-o' , 'test_sse3' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6641+ self .run_process ([paths .CLANG_CXX , src , '-msse3' , '-Wno-argument-outside-range' , '-o' , 'test_sse3' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66386642 native_result = self .run_process ('./test_sse3' , stdout = PIPE ).stdout
66396643
66406644 self .cflags += ['-I' + test_file ('sse' ), '-msse3' , '-Wno-argument-outside-range' ]
@@ -6648,7 +6652,7 @@ def test_sse3(self):
66486652 @no_big_endian ('SIMD support is currently not compatible with big endian' )
66496653 def test_ssse3 (self ):
66506654 src = test_file ('sse/test_ssse3.cpp' )
6651- self .run_process ([shared .CLANG_CXX , src , '-mssse3' , '-Wno-argument-outside-range' , '-o' , 'test_ssse3' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6655+ self .run_process ([paths .CLANG_CXX , src , '-mssse3' , '-Wno-argument-outside-range' , '-o' , 'test_ssse3' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66526656 native_result = self .run_process ('./test_ssse3' , stdout = PIPE ).stdout
66536657
66546658 self .cflags += ['-I' + test_file ('sse' ), '-mssse3' , '-Wno-argument-outside-range' ]
@@ -6665,7 +6669,7 @@ def test_ssse3(self):
66656669 def test_sse4_1 (self ):
66666670 src = test_file ('sse/test_sse4_1.cpp' )
66676671 # Run with inlining disabled to avoid slow LLVM behavior with lots of macro expanded loops inside a function body.
6668- self .run_process ([shared .CLANG_CXX , src , '-msse4.1' , '-fno-inline-functions' , '-Wno-argument-outside-range' , '-o' , 'test_sse4_1' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6672+ self .run_process ([paths .CLANG_CXX , src , '-msse4.1' , '-fno-inline-functions' , '-Wno-argument-outside-range' , '-o' , 'test_sse4_1' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66696673 native_result = self .run_process ('./test_sse4_1' , stdout = PIPE ).stdout
66706674
66716675 self .cflags += ['-I' + test_file ('sse' ), '-msse4.1' , '-fno-inline-functions' , '-Wno-argument-outside-range' , '-sSTACK_SIZE=1MB' ]
@@ -6684,7 +6688,7 @@ def test_sse4_1(self):
66846688 def test_sse4 (self , use_4_2 ):
66856689 msse4 = '-msse4.2' if use_4_2 else '-msse4'
66866690 src = test_file ('sse/test_sse4_2.cpp' )
6687- self .run_process ([shared .CLANG_CXX , src , msse4 , '-Wno-argument-outside-range' , '-o' , 'test_sse4_2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6691+ self .run_process ([paths .CLANG_CXX , src , msse4 , '-Wno-argument-outside-range' , '-o' , 'test_sse4_2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
66886692 native_result = self .run_process ('./test_sse4_2' , stdout = PIPE ).stdout
66896693
66906694 self .cflags += ['-I' + test_file ('sse' ), msse4 , '-Wno-argument-outside-range' ]
@@ -6705,7 +6709,7 @@ def test_sse4(self, use_4_2):
67056709 @no_big_endian ('SIMD support is currently not compatible with big endian' )
67066710 def test_avx (self , args ):
67076711 src = test_file ('sse/test_avx.cpp' )
6708- self .run_process ([shared .CLANG_CXX , src , '-mavx' , '-Wno-argument-outside-range' , '-Wpedantic' , '-o' , 'test_avx' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6712+ self .run_process ([paths .CLANG_CXX , src , '-mavx' , '-Wno-argument-outside-range' , '-Wpedantic' , '-o' , 'test_avx' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
67096713 native_result = self .run_process ('./test_avx' , stdout = PIPE ).stdout
67106714
67116715 self .cflags += ['-I' + test_file ('sse' ), '-mavx' , '-fno-inline-functions' , '-Wno-argument-outside-range' , '-sSTACK_SIZE=1MB' ] + args
@@ -6726,7 +6730,7 @@ def test_avx(self, args):
67266730 @no_big_endian ('SIMD support is currently not compatible with big endian' )
67276731 def test_avx2 (self , args ):
67286732 src = test_file ('sse/test_avx2.cpp' )
6729- self .run_process ([shared .CLANG_CXX , src , '-mavx2' , '-Wno-argument-outside-range' , '-Wpedantic' , '-o' , 'test_avx2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
6733+ self .run_process ([paths .CLANG_CXX , src , '-mavx2' , '-Wno-argument-outside-range' , '-Wpedantic' , '-o' , 'test_avx2' , '-D_CRT_SECURE_NO_WARNINGS=1' ] + clang_native .get_clang_native_args (), stdout = PIPE )
67306734 native_result = self .run_process ('./test_avx2' , stdout = PIPE ).stdout
67316735
67326736 self .cflags += ['-I' + test_file ('sse' ), '-mavx2' , '-Wno-argument-outside-range' , '-sSTACK_SIZE=1MB' ] + args
@@ -6738,9 +6742,7 @@ def test_sse_diagnostics(self):
67386742 self .cflags .remove ('-Werror' )
67396743 src = test_file ('sse/test_sse_diagnostic.cpp' )
67406744
6741- p = self .run_process (
6742- [shared .EMXX , src , '-msse' , '-DWASM_SIMD_COMPAT_SLOW' ] + self .get_cflags (),
6743- stderr = PIPE )
6745+ p = self .run_process ([paths .EMXX , src , '-msse' , '-DWASM_SIMD_COMPAT_SLOW' ] + self .get_cflags (), stderr = PIPE )
67446746 self .assertContained ('Instruction emulated via slow path.' , p .stderr )
67456747
67466748 @wasm_relaxed_simd
@@ -7960,7 +7962,7 @@ def test_dwarf(self):
79607962
79617963 self .emcc ('test_dwarf.c' )
79627964
7963- out = self .run_process ([shared .LLVM_DWARFDUMP , 'a.out.wasm' , '-all' ], stdout = PIPE ).stdout
7965+ out = self .run_process ([paths .LLVM_DWARFDUMP , 'a.out.wasm' , '-all' ], stdout = PIPE ).stdout
79647966
79657967 # parse the sections
79667968 sections = {}
@@ -9680,7 +9682,7 @@ def test_emscripten_async_load_script(self):
96809682 create_file ('file2.txt' , 'second' )
96819683 # `--from-emcc` needed here otherwise the output defines `var Module =` which will shadow the
96829684 # global `Module`.
9683- self .run_process ([FILE_PACKAGER , 'test.data' , '--preload' , 'file1.txt' , 'file2.txt' , '--from-emcc' , '--js-output=script2.js' ])
9685+ self .run_process ([paths . FILE_PACKAGER , 'test.data' , '--preload' , 'file1.txt' , 'file2.txt' , '--from-emcc' , '--js-output=script2.js' ])
96849686 self .do_runf ('test_emscripten_async_load_script.c' , cflags = ['-sFORCE_FILESYSTEM' ])
96859687
96869688 @node_pthreads
@@ -9820,9 +9822,9 @@ def test_fcoverage_mapping(self):
98209822 self .set_setting ('EXIT_RUNTIME' )
98219823 self .do_core_test ('test_hello_world.c' , cflags = ['-fprofile-instr-generate' , '-fcoverage-mapping' , '-g' ])
98229824 self .assertExists ('default.profraw' )
9823- self .run_process ([LLVM_PROFDATA , 'merge' , '-sparse' , 'default.profraw' , '-o' , 'out.profdata' ])
9825+ self .run_process ([paths . LLVM_PROFDATA , 'merge' , '-sparse' , 'default.profraw' , '-o' , 'out.profdata' ])
98249826 self .assertExists ('out.profdata' )
9825- self .assertEqual (expected , self .run_process ([LLVM_COV , 'show' , 'test_hello_world.wasm' , '-instr-profile=out.profdata' ], stdout = PIPE ).stdout )
9827+ self .assertEqual (expected , self .run_process ([paths . LLVM_COV , 'show' , 'test_hello_world.wasm' , '-instr-profile=out.profdata' ], stdout = PIPE ).stdout )
98269828
98279829# Generate tests for everything
98289830def make_run (name , cflags = None , settings = None , env = None , # noqa
0 commit comments