diff --git a/.circleci/config.yml b/.circleci/config.yml index 6cfce5c20d8a3..ce07eac4e0bfa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -804,6 +804,13 @@ jobs: esm_integration.test_fs_js_api* instance.test_hello_world instance.test_dylink_basics + instance.test_cube2hash* + instance.test_exceptions_3* + instance.test_memorygrowth + instance.test_stat + instance.test_iostream_and_determinism + instance.test_fannkuch + instance.test_fasta esm_integration.test_inlinejs3 esm_integration.test_embind_val_basics " diff --git a/test/test_core.py b/test/test_core.py index 63ebb67e5a75b..37be9b79c1642 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -592,11 +592,12 @@ def test_cube2hash(self): self.do_run('// empty file', 'Usage: hashstring ', libraries=self.get_library('third_party/cube2hash', ['libcube2hash.a'], configure=None), includes=[test_file('third_party/cube2hash')], assert_returncode=NON_ZERO) + js_out = self.output_name('src') for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'), ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'), ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]: - self.do_run('src.js', 'hash value: ' + output, args=[text], no_build=True) + self.do_run(js_out, 'hash value: ' + output, args=[text], no_build=True) @only_wasm2js('tests 64-bit alignment of structs') def test_align64(self): @@ -1163,12 +1164,13 @@ def test_exceptions_3(self): } ''' + js_out = self.output_name('src') print('0') self.do_run(src, 'Caught C string: a c string\nDone.', args=['0']) print('1') - self.do_run('src.js', 'Caught exception: std::exception\nDone.', args=['1'], no_build=True) + self.do_run(js_out, 'Caught exception: std::exception\nDone.', args=['1'], no_build=True) print('2') - self.do_run('src.js', 'Caught exception: Hello\nDone.', args=['2'], no_build=True) + self.do_run(js_out, 'Caught exception: Hello\nDone.', args=['2'], no_build=True) def test_exceptions_allowed(self): self.set_setting('EXCEPTION_CATCHING_ALLOWED', ["_Z12somefunctionv"]) @@ -1176,33 +1178,34 @@ def test_exceptions_allowed(self): self.set_setting('INLINING_LIMIT') self.do_core_test('test_exceptions_allowed.cpp') - size = os.path.getsize('test_exceptions_allowed.js') + js_out = self.output_name('test_exceptions_allowed') + size = os.path.getsize(js_out) if self.is_wasm(): size += os.path.getsize('test_exceptions_allowed.wasm') - shutil.copy('test_exceptions_allowed.js', 'orig.js') + shutil.copy(js_out, 'orig.js') # check that an empty allow list works properly (as in, same as exceptions disabled) self.set_setting('EXCEPTION_CATCHING_ALLOWED', []) self.do_run_in_out_file_test('core/test_exceptions_allowed.cpp', out_suffix='_empty', assert_returncode=NON_ZERO) - empty_size = os.path.getsize('test_exceptions_allowed.js') + empty_size = os.path.getsize(js_out) if self.is_wasm(): empty_size += os.path.getsize('test_exceptions_allowed.wasm') - shutil.copy('test_exceptions_allowed.js', 'empty.js') + shutil.copy(js_out, 'empty.js') self.set_setting('EXCEPTION_CATCHING_ALLOWED', ['fake']) self.do_run_in_out_file_test('core/test_exceptions_allowed.cpp', out_suffix='_empty', assert_returncode=NON_ZERO) - fake_size = os.path.getsize('test_exceptions_allowed.js') + fake_size = os.path.getsize(js_out) if self.is_wasm(): fake_size += os.path.getsize('test_exceptions_allowed.wasm') - shutil.copy('test_exceptions_allowed.js', 'fake.js') + shutil.copy(js_out, 'fake.js') self.clear_setting('EXCEPTION_CATCHING_ALLOWED') self.do_run_in_out_file_test('core/test_exceptions_allowed.cpp', out_suffix='_empty', assert_returncode=NON_ZERO) - disabled_size = os.path.getsize('test_exceptions_allowed.js') + disabled_size = os.path.getsize(js_out) if self.is_wasm(): disabled_size += os.path.getsize('test_exceptions_allowed.wasm') - shutil.copy('test_exceptions_allowed.js', 'disabled.js') + shutil.copy(js_out, 'disabled.js') print('size: %d' % size) print('empty_size: %d' % empty_size) @@ -1966,7 +1969,7 @@ def test_em_js(self, args, force_c): self.setup_node_pthreads() self.do_core_test('test_em_js.cpp', force_c=force_c) - self.assertContained("no args returning int", read_file('test_em_js.js')) + self.assertContained('no args returning int', read_file(self.output_name('test_em_js'))) @no_wasm2js('test depends on WASM_BIGINT which is not compatible with wasm2js') def test_em_js_i64(self): @@ -2013,12 +2016,12 @@ def test_memorygrowth(self): # Fail without memory growth self.do_runf(src, 'OOM', assert_returncode=NON_ZERO) - fail = read_file('test_memorygrowth.js') + fail = read_file(self.output_name('test_memorygrowth')) # Win with it self.set_setting('ALLOW_MEMORY_GROWTH') self.do_runf(src, '*pre: hello,4.955*\n*hello,4.955*\n*hello,4.955*') - win = read_file('test_memorygrowth.js') + win = read_file(self.output_name('test_memorygrowth')) if '-O2' in self.emcc_args and self.is_wasm2js(): # Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized) @@ -2046,12 +2049,12 @@ def test_memorygrowth_2(self): # Fail without memory growth self.do_runf(src, 'OOM', assert_returncode=NON_ZERO) - fail = read_file('test_memorygrowth_2.js') + fail = read_file(self.output_name('test_memorygrowth_2')) # Win with it self.set_setting('ALLOW_MEMORY_GROWTH') self.do_runf(src, '*pre: hello,4.955*\n*hello,4.955*\n*hello,4.955*') - win = read_file('test_memorygrowth_2.js') + win = read_file(self.output_name('test_memorygrowth_2')) if '-O2' in self.emcc_args and self.is_wasm2js(): # Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized) @@ -5561,7 +5564,7 @@ def test_readdir_unlink(self): def test_stat(self): self.set_setting("FORCE_FILESYSTEM") self.do_runf('stat/test_stat.c', 'success') - self.verify_in_strict_mode('test_stat.js') + self.verify_in_strict_mode(self.output_name('test_stat')) def test_statx(self): self.set_setting("FORCE_FILESYSTEM") @@ -6154,6 +6157,7 @@ def test_iostream_and_determinism(self): return 0; } ''') + js_out = self.output_name('src') num = 5 for i in range(num): @@ -6165,8 +6169,8 @@ def test_iostream_and_determinism(self): # Verify that this build is identical to the previous one if os.path.exists('src.js.previous'): - self.assertBinaryEqual('src.js', 'src.js.previous') - shutil.copy2('src.js', 'src.js.previous') + self.assertBinaryEqual(js_out, 'src.js.previous') + shutil.copy2(js_out, 'src.js.previous') # Same but for the wasm file. if self.is_wasm(): @@ -6269,10 +6273,10 @@ def test_constglobalunion(self): def test_fannkuch(self): results = [(1, 0), (2, 1), (3, 2), (4, 4), (5, 7), (6, 10), (7, 16), (8, 22)] - self.build('third_party/fannkuch.c') + js_out = self.build('third_party/fannkuch.c') for i, j in results: print(i, j) - self.do_run('fannkuch.js', 'Pfannkuchen(%d) = %d.' % (i, j), args=[str(i)], no_build=True) + self.do_run(js_out, 'Pfannkuchen(%d) = %d.' % (i, j), args=[str(i)], no_build=True) def test_raytrace(self): # TODO: Should we remove this test? @@ -6295,9 +6299,9 @@ def test_fasta(self, float_type): src = orig_src.replace('double', float_type) create_file('fasta.cpp', src) - self.build('fasta.cpp') + js_out = self.build('fasta.cpp') for arg, output in results: - self.do_run('fasta.js', output, args=[arg], no_build=True) + self.do_run(js_out, output, args=[arg], no_build=True) @needs_non_trapping_float_to_int def test_fasta_nontrapping(self): @@ -7677,7 +7681,7 @@ def test_source_map(self): ''' create_file('src.cpp', src) - out_filename = 'a.out.js' + out_filename = self.output_name('a.out') wasm_filename = 'a.out.wasm' no_maps_filename = 'no-maps.out.js' @@ -7761,13 +7765,11 @@ def test_embind_dylink_visibility_hidden(self): def test_dwarf(self): self.emcc_args.append('-g') - js_filename = 'a.out.js' - wasm_filename = 'a.out.wasm' shutil.copy(test_file('core/test_dwarf.c'), '.') - self.emcc('test_dwarf.c', output_filename=js_filename) + self.emcc('test_dwarf.c') - out = self.run_process([shared.LLVM_DWARFDUMP, wasm_filename, '-all'], stdout=PIPE).stdout + out = self.run_process([shared.LLVM_DWARFDUMP, 'a.out.wasm', '-all'], stdout=PIPE).stdout # parse the sections sections = {} @@ -7837,7 +7839,7 @@ def get_dwarf_addr(line, col): # Get the wat, printing with -g which has binary offsets wat = self.run_process([os.path.join(building.get_binaryen_bin(), 'wasm-opt'), - wasm_filename, '-g', '--print', '-all'], stdout=PIPE).stdout + 'a.out.wasm', '-g', '--print', '-all'], stdout=PIPE).stdout # We expect to see a pattern like this in optimized builds (there isn't # much that can change with such calls to JS (they can't be reordered or @@ -8577,7 +8579,7 @@ def test_environment(self): def test(assert_returncode=0): self.do_core_test('test_hello_world.c', assert_returncode=assert_returncode) - js = read_file('test_hello_world.js') + js = read_file(self.output_name('test_hello_world')) assert ('require(' in js) == ('node' in self.get_setting('ENVIRONMENT')), 'we should have require() calls only if node js specified' for engine in config.JS_ENGINES: @@ -8613,8 +8615,8 @@ def test_postrun_exception(self): # verify that an exception thrown in postRun() will not trigger the # compilation failed handler, and will be printed to stderr. self.add_post_run('ThisFunctionDoesNotExist()') - self.build('core/test_hello_world.c') - output = self.run_js('test_hello_world.js', assert_returncode=NON_ZERO) + out_js = self.build('core/test_hello_world.c') + output = self.run_js(out_js, assert_returncode=NON_ZERO) self.assertStartswith(output, 'hello, world!') self.assertContained('ThisFunctionDoesNotExist is not defined', output)