@@ -592,11 +592,12 @@ def test_cube2hash(self):
592
592
self .do_run ('// empty file' , 'Usage: hashstring <seed>' ,
593
593
libraries = self .get_library ('third_party/cube2hash' , ['libcube2hash.a' ], configure = None ),
594
594
includes = [test_file ('third_party/cube2hash' )], assert_returncode = NON_ZERO )
595
+ js_out = self .output_name ('src' )
595
596
596
597
for text , output in [('fleefl' , '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9' ),
597
598
('fleefl2' , 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61' ),
598
599
('64bitisslow' , '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670' )]:
599
- self .do_run ('src.js' , 'hash value: ' + output , args = [text ], no_build = True )
600
+ self .do_run (js_out , 'hash value: ' + output , args = [text ], no_build = True )
600
601
601
602
@only_wasm2js ('tests 64-bit alignment of structs' )
602
603
def test_align64 (self ):
@@ -1163,46 +1164,48 @@ def test_exceptions_3(self):
1163
1164
}
1164
1165
'''
1165
1166
1167
+ js_out = self .output_name ('src' )
1166
1168
print ('0' )
1167
1169
self .do_run (src , 'Caught C string: a c string\n Done.' , args = ['0' ])
1168
1170
print ('1' )
1169
- self .do_run ('src.js' , 'Caught exception: std::exception\n Done.' , args = ['1' ], no_build = True )
1171
+ self .do_run (js_out , 'Caught exception: std::exception\n Done.' , args = ['1' ], no_build = True )
1170
1172
print ('2' )
1171
- self .do_run ('src.js' , 'Caught exception: Hello\n Done.' , args = ['2' ], no_build = True )
1173
+ self .do_run (js_out , 'Caught exception: Hello\n Done.' , args = ['2' ], no_build = True )
1172
1174
1173
1175
def test_exceptions_allowed (self ):
1174
1176
self .set_setting ('EXCEPTION_CATCHING_ALLOWED' , ["_Z12somefunctionv" ])
1175
1177
# otherwise it is inlined and not identified
1176
1178
self .set_setting ('INLINING_LIMIT' )
1177
1179
1178
1180
self .do_core_test ('test_exceptions_allowed.cpp' )
1179
- size = os .path .getsize ('test_exceptions_allowed.js' )
1181
+ js_out = self .output_name ('test_exceptions_allowed' )
1182
+ size = os .path .getsize (js_out )
1180
1183
if self .is_wasm ():
1181
1184
size += os .path .getsize ('test_exceptions_allowed.wasm' )
1182
- shutil .copy ('test_exceptions_allowed.js' , 'orig.js' )
1185
+ shutil .copy (js_out , 'orig.js' )
1183
1186
1184
1187
# check that an empty allow list works properly (as in, same as exceptions disabled)
1185
1188
1186
1189
self .set_setting ('EXCEPTION_CATCHING_ALLOWED' , [])
1187
1190
self .do_run_in_out_file_test ('core/test_exceptions_allowed.cpp' , out_suffix = '_empty' , assert_returncode = NON_ZERO )
1188
- empty_size = os .path .getsize ('test_exceptions_allowed.js' )
1191
+ empty_size = os .path .getsize (js_out )
1189
1192
if self .is_wasm ():
1190
1193
empty_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1191
- shutil .copy ('test_exceptions_allowed.js' , 'empty.js' )
1194
+ shutil .copy (js_out , 'empty.js' )
1192
1195
1193
1196
self .set_setting ('EXCEPTION_CATCHING_ALLOWED' , ['fake' ])
1194
1197
self .do_run_in_out_file_test ('core/test_exceptions_allowed.cpp' , out_suffix = '_empty' , assert_returncode = NON_ZERO )
1195
- fake_size = os .path .getsize ('test_exceptions_allowed.js' )
1198
+ fake_size = os .path .getsize (js_out )
1196
1199
if self .is_wasm ():
1197
1200
fake_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1198
- shutil .copy ('test_exceptions_allowed.js' , 'fake.js' )
1201
+ shutil .copy (js_out , 'fake.js' )
1199
1202
1200
1203
self .clear_setting ('EXCEPTION_CATCHING_ALLOWED' )
1201
1204
self .do_run_in_out_file_test ('core/test_exceptions_allowed.cpp' , out_suffix = '_empty' , assert_returncode = NON_ZERO )
1202
- disabled_size = os .path .getsize ('test_exceptions_allowed.js' )
1205
+ disabled_size = os .path .getsize (js_out )
1203
1206
if self .is_wasm ():
1204
1207
disabled_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1205
- shutil .copy ('test_exceptions_allowed.js' , 'disabled.js' )
1208
+ shutil .copy (js_out , 'disabled.js' )
1206
1209
1207
1210
print ('size: %d' % size )
1208
1211
print ('empty_size: %d' % empty_size )
@@ -1966,7 +1969,7 @@ def test_em_js(self, args, force_c):
1966
1969
self .setup_node_pthreads ()
1967
1970
1968
1971
self .do_core_test ('test_em_js.cpp' , force_c = force_c )
1969
- self .assertContained (" no args returning int" , read_file ('test_em_js.js' ))
1972
+ self .assertContained (' no args returning int' , read_file (self . output_name ( 'test_em_js' ) ))
1970
1973
1971
1974
@no_wasm2js ('test depends on WASM_BIGINT which is not compatible with wasm2js' )
1972
1975
def test_em_js_i64 (self ):
@@ -2013,12 +2016,12 @@ def test_memorygrowth(self):
2013
2016
2014
2017
# Fail without memory growth
2015
2018
self .do_runf (src , 'OOM' , assert_returncode = NON_ZERO )
2016
- fail = read_file ('test_memorygrowth.js' )
2019
+ fail = read_file (self . output_name ( 'test_memorygrowth' ) )
2017
2020
2018
2021
# Win with it
2019
2022
self .set_setting ('ALLOW_MEMORY_GROWTH' )
2020
2023
self .do_runf (src , '*pre: hello,4.955*\n *hello,4.955*\n *hello,4.955*' )
2021
- win = read_file ('test_memorygrowth.js' )
2024
+ win = read_file (self . output_name ( 'test_memorygrowth' ) )
2022
2025
2023
2026
if '-O2' in self .emcc_args and self .is_wasm2js ():
2024
2027
# Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized)
@@ -2046,12 +2049,12 @@ def test_memorygrowth_2(self):
2046
2049
2047
2050
# Fail without memory growth
2048
2051
self .do_runf (src , 'OOM' , assert_returncode = NON_ZERO )
2049
- fail = read_file ('test_memorygrowth_2.js' )
2052
+ fail = read_file (self . output_name ( 'test_memorygrowth_2' ) )
2050
2053
2051
2054
# Win with it
2052
2055
self .set_setting ('ALLOW_MEMORY_GROWTH' )
2053
2056
self .do_runf (src , '*pre: hello,4.955*\n *hello,4.955*\n *hello,4.955*' )
2054
- win = read_file ('test_memorygrowth_2.js' )
2057
+ win = read_file (self . output_name ( 'test_memorygrowth_2' ) )
2055
2058
2056
2059
if '-O2' in self .emcc_args and self .is_wasm2js ():
2057
2060
# Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized)
@@ -5561,7 +5564,7 @@ def test_readdir_unlink(self):
5561
5564
def test_stat (self ):
5562
5565
self .set_setting ("FORCE_FILESYSTEM" )
5563
5566
self .do_runf ('stat/test_stat.c' , 'success' )
5564
- self .verify_in_strict_mode ('test_stat.js' )
5567
+ self .verify_in_strict_mode (self . output_name ( 'test_stat' ) )
5565
5568
5566
5569
def test_statx (self ):
5567
5570
self .set_setting ("FORCE_FILESYSTEM" )
@@ -6154,6 +6157,7 @@ def test_iostream_and_determinism(self):
6154
6157
return 0;
6155
6158
}
6156
6159
''' )
6160
+ js_out = self .output_name ('src' )
6157
6161
6158
6162
num = 5
6159
6163
for i in range (num ):
@@ -6165,8 +6169,8 @@ def test_iostream_and_determinism(self):
6165
6169
6166
6170
# Verify that this build is identical to the previous one
6167
6171
if os .path .exists ('src.js.previous' ):
6168
- self .assertBinaryEqual ('src.js' , 'src.js.previous' )
6169
- shutil .copy2 ('src.js' , 'src.js.previous' )
6172
+ self .assertBinaryEqual (js_out , 'src.js.previous' )
6173
+ shutil .copy2 (js_out , 'src.js.previous' )
6170
6174
6171
6175
# Same but for the wasm file.
6172
6176
if self .is_wasm ():
@@ -6269,10 +6273,10 @@ def test_constglobalunion(self):
6269
6273
6270
6274
def test_fannkuch (self ):
6271
6275
results = [(1 , 0 ), (2 , 1 ), (3 , 2 ), (4 , 4 ), (5 , 7 ), (6 , 10 ), (7 , 16 ), (8 , 22 )]
6272
- self .build ('third_party/fannkuch.c' )
6276
+ js_out = self .build ('third_party/fannkuch.c' )
6273
6277
for i , j in results :
6274
6278
print (i , j )
6275
- self .do_run ('fannkuch.js' , 'Pfannkuchen(%d) = %d.' % (i , j ), args = [str (i )], no_build = True )
6279
+ self .do_run (js_out , 'Pfannkuchen(%d) = %d.' % (i , j ), args = [str (i )], no_build = True )
6276
6280
6277
6281
def test_raytrace (self ):
6278
6282
# TODO: Should we remove this test?
@@ -6295,9 +6299,9 @@ def test_fasta(self, float_type):
6295
6299
6296
6300
src = orig_src .replace ('double' , float_type )
6297
6301
create_file ('fasta.cpp' , src )
6298
- self .build ('fasta.cpp' )
6302
+ js_out = self .build ('fasta.cpp' )
6299
6303
for arg , output in results :
6300
- self .do_run ('fasta.js' , output , args = [arg ], no_build = True )
6304
+ self .do_run (js_out , output , args = [arg ], no_build = True )
6301
6305
6302
6306
@needs_non_trapping_float_to_int
6303
6307
def test_fasta_nontrapping (self ):
@@ -7677,7 +7681,7 @@ def test_source_map(self):
7677
7681
'''
7678
7682
create_file ('src.cpp' , src )
7679
7683
7680
- out_filename = 'a.out.js'
7684
+ out_filename = self . output_name ( 'a.out' )
7681
7685
wasm_filename = 'a.out.wasm'
7682
7686
no_maps_filename = 'no-maps.out.js'
7683
7687
@@ -7761,13 +7765,11 @@ def test_embind_dylink_visibility_hidden(self):
7761
7765
def test_dwarf (self ):
7762
7766
self .emcc_args .append ('-g' )
7763
7767
7764
- js_filename = 'a.out.js'
7765
- wasm_filename = 'a.out.wasm'
7766
7768
shutil .copy (test_file ('core/test_dwarf.c' ), '.' )
7767
7769
7768
- self .emcc ('test_dwarf.c' , output_filename = js_filename )
7770
+ self .emcc ('test_dwarf.c' )
7769
7771
7770
- out = self .run_process ([shared .LLVM_DWARFDUMP , wasm_filename , '-all' ], stdout = PIPE ).stdout
7772
+ out = self .run_process ([shared .LLVM_DWARFDUMP , 'a.out.wasm' , '-all' ], stdout = PIPE ).stdout
7771
7773
7772
7774
# parse the sections
7773
7775
sections = {}
@@ -7837,7 +7839,7 @@ def get_dwarf_addr(line, col):
7837
7839
7838
7840
# Get the wat, printing with -g which has binary offsets
7839
7841
wat = self .run_process ([os .path .join (building .get_binaryen_bin (), 'wasm-opt' ),
7840
- wasm_filename , '-g' , '--print' , '-all' ], stdout = PIPE ).stdout
7842
+ 'a.out.wasm' , '-g' , '--print' , '-all' ], stdout = PIPE ).stdout
7841
7843
7842
7844
# We expect to see a pattern like this in optimized builds (there isn't
7843
7845
# much that can change with such calls to JS (they can't be reordered or
@@ -8577,7 +8579,7 @@ def test_environment(self):
8577
8579
8578
8580
def test (assert_returncode = 0 ):
8579
8581
self .do_core_test ('test_hello_world.c' , assert_returncode = assert_returncode )
8580
- js = read_file ('test_hello_world.js' )
8582
+ js = read_file (self . output_name ( 'test_hello_world' ) )
8581
8583
assert ('require(' in js ) == ('node' in self .get_setting ('ENVIRONMENT' )), 'we should have require() calls only if node js specified'
8582
8584
8583
8585
for engine in config .JS_ENGINES :
@@ -8613,8 +8615,8 @@ def test_postrun_exception(self):
8613
8615
# verify that an exception thrown in postRun() will not trigger the
8614
8616
# compilation failed handler, and will be printed to stderr.
8615
8617
self .add_post_run ('ThisFunctionDoesNotExist()' )
8616
- self .build ('core/test_hello_world.c' )
8617
- output = self .run_js ('test_hello_world.js' , assert_returncode = NON_ZERO )
8618
+ out_js = self .build ('core/test_hello_world.c' )
8619
+ output = self .run_js (out_js , assert_returncode = NON_ZERO )
8618
8620
self .assertStartswith (output , 'hello, world!' )
8619
8621
self .assertContained ('ThisFunctionDoesNotExist is not defined' , output )
8620
8622
0 commit comments