@@ -2372,7 +2372,7 @@ def test_link_memcpy(self):
2372
2372
self.assertNotContained('warning: library.js memcpy should not be running, it is only for testing!', output)
2373
2373
2374
2374
def test_undefined_exported_function(self):
2375
- cmd = [EMXX , test_file('hello_world.cpp ')]
2375
+ cmd = [EMCC , test_file('hello_world.c ')]
2376
2376
self.run_process(cmd)
2377
2377
2378
2378
# adding a missing symbol to EXPORTED_FUNCTIONS should cause failure
@@ -5357,19 +5357,19 @@ def test(args):
5357
5357
5358
5358
def test_dashE_respect_dashO(self):
5359
5359
# issue #3365
5360
- with_dash_o = self.run_process([EMXX , test_file('hello_world.cpp '), '-E', '-o', 'ignored.js'], stdout=PIPE, stderr=PIPE).stdout
5361
- without_dash_o = self.run_process([EMXX , test_file('hello_world.cpp '), '-E'], stdout=PIPE, stderr=PIPE).stdout
5360
+ with_dash_o = self.run_process([EMCC , test_file('hello_world.c '), '-E', '-o', 'ignored.js'], stdout=PIPE, stderr=PIPE).stdout
5361
+ without_dash_o = self.run_process([EMCC , test_file('hello_world.c '), '-E'], stdout=PIPE, stderr=PIPE).stdout
5362
5362
self.assertEqual(len(with_dash_o), 0)
5363
5363
self.assertNotEqual(len(without_dash_o), 0)
5364
5364
5365
5365
def test_dashM(self):
5366
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-M'], stdout=PIPE).stdout
5366
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-M'], stdout=PIPE).stdout
5367
5367
self.assertContained('hello_world.o:', out) # Verify output is just a dependency rule instead of bitcode or js
5368
5368
5369
5369
def test_dashM_respect_dashO(self):
5370
5370
# issue #3365
5371
- with_dash_o = self.run_process([EMXX , test_file('hello_world.cpp '), '-M', '-o', 'ignored.js'], stdout=PIPE).stdout
5372
- without_dash_o = self.run_process([EMXX , test_file('hello_world.cpp '), '-M'], stdout=PIPE).stdout
5371
+ with_dash_o = self.run_process([EMCC , test_file('hello_world.c '), '-M', '-o', 'ignored.js'], stdout=PIPE).stdout
5372
+ without_dash_o = self.run_process([EMCC , test_file('hello_world.c '), '-M'], stdout=PIPE).stdout
5373
5373
self.assertEqual(len(with_dash_o), 0)
5374
5374
self.assertNotEqual(len(without_dash_o), 0)
5375
5375
@@ -7607,42 +7607,42 @@ def test_dash_s_link_flag(self):
7607
7607
# its used to set a settings based on looking at the argument that follows.
7608
7608
7609
7609
# Test the case when -s is the last flag
7610
- self.run_process([EMXX , test_file('hello_world.cpp '), '-s'])
7610
+ self.run_process([EMCC , test_file('hello_world.c '), '-s'])
7611
7611
self.assertContained('hello, world!', self.run_js('a.out.js'))
7612
7612
7613
7613
# Test the case when the following flag is all uppercase but starts with a `-`
7614
- self.run_process([EMXX , test_file('hello_world.cpp '), '-s', '-DFOO'])
7614
+ self.run_process([EMCC , test_file('hello_world.c '), '-s', '-DFOO'])
7615
7615
self.assertContained('hello, world!', self.run_js('a.out.js'))
7616
7616
7617
7617
# Test that case when the following flag is not all uppercase
7618
- self.run_process([EMXX , '-s', test_file('hello_world.cpp ')])
7618
+ self.run_process([EMCC , '-s', test_file('hello_world.c ')])
7619
7619
self.assertContained('hello, world!', self.run_js('a.out.js'))
7620
7620
7621
7621
def test_dash_s_response_file_string(self):
7622
7622
create_file('response_file.txt', 'MyModule\n')
7623
7623
create_file('response_file.json', '"MyModule"\n')
7624
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sEXPORT_NAME=@response_file.txt'])
7625
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sEXPORT_NAME=@response_file.json'])
7624
+ self.run_process([EMCC , test_file('hello_world.c '), '-sEXPORT_NAME=@response_file.txt'])
7625
+ self.run_process([EMCC , test_file('hello_world.c '), '-sEXPORT_NAME=@response_file.json'])
7626
7626
7627
7627
def test_dash_s_response_file_list(self):
7628
7628
create_file('response_file.txt', '_main\n_malloc\n')
7629
7629
create_file('response_file.json', '["_main", "_malloc"]\n')
7630
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sEXPORTED_FUNCTIONS=@response_file.txt'])
7631
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sEXPORTED_FUNCTIONS=@response_file.json'])
7630
+ self.run_process([EMCC , test_file('hello_world.c '), '-sEXPORTED_FUNCTIONS=@response_file.txt'])
7631
+ self.run_process([EMCC , test_file('hello_world.c '), '-sEXPORTED_FUNCTIONS=@response_file.json'])
7632
7632
7633
7633
def test_dash_s_response_file_misssing(self):
7634
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), '-sEXPORTED_FUNCTIONS=@foo'])
7634
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), '-sEXPORTED_FUNCTIONS=@foo'])
7635
7635
self.assertContained('error: foo: file not found parsing argument: EXPORTED_FUNCTIONS=@foo', err)
7636
7636
7637
7637
def test_dash_s_unclosed_quote(self):
7638
7638
# Unclosed quote
7639
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), '-s', "TEST_KEY='MISSING_QUOTE"])
7639
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), '-s', "TEST_KEY='MISSING_QUOTE"])
7640
7640
self.assertNotContained('AssertionError', err) # Do not mention that it is an assertion error
7641
7641
self.assertContained('unclosed opened quoted string. expected final character to be "\'"', err)
7642
7642
7643
7643
def test_dash_s_single_quote(self):
7644
7644
# Only one quote
7645
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), "-sTEST_KEY='"])
7645
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), "-sTEST_KEY='"])
7646
7646
self.assertNotContained('AssertionError', err) # Do not mention that it is an assertion error
7647
7647
self.assertContained('unclosed opened quoted string.', err)
7648
7648
@@ -7678,7 +7678,7 @@ def test_dash_s_typo(self):
7678
7678
7679
7679
def test_dash_s_with_space(self):
7680
7680
self.run_process([EMCC, test_file('hello_world.c'), '-s', 'EXPORT_ALL'])
7681
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), '-s', 'EXPORTED_FUNCTIONS=foo'])
7681
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), '-s', 'EXPORTED_FUNCTIONS=foo'])
7682
7682
self.assertContained('error: undefined exported symbol: "foo"', err)
7683
7683
7684
7684
def test_dash_s_hex(self):
@@ -8020,13 +8020,13 @@ def test_binaryen_warn_mem(self):
8020
8020
# if user changes INITIAL_MEMORY at runtime, the wasm module may not accept the memory import if
8021
8021
# it is too big/small
8022
8022
create_file('pre.js', 'Module.INITIAL_MEMORY = 50 * 1024 * 1024')
8023
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY'])
8023
+ self.run_process([EMCC , test_file('hello_world.c '), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY'])
8024
8024
out = self.run_js('a.out.js', assert_returncode=NON_ZERO)
8025
8025
self.assertContained('LinkError', out)
8026
8026
self.assertContained("memory import 2 has a larger maximum size 800 than the module's declared maximum", out)
8027
8027
self.assertNotContained('hello, world!', out)
8028
8028
# and with memory growth, all should be good
8029
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sALLOW_MEMORY_GROWTH', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY'])
8029
+ self.run_process([EMCC , test_file('hello_world.c '), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sALLOW_MEMORY_GROWTH', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY'])
8030
8030
self.assertContained('hello, world!', self.run_js('a.out.js'))
8031
8031
8032
8032
def test_memory_size(self):
@@ -8126,7 +8126,7 @@ def test_binaryen_debug(self):
8126
8126
]:
8127
8127
print(args, expect_emit_text)
8128
8128
delete_file('a.out.wat')
8129
- cmd = [EMXX , test_file('hello_world.cpp ')] + args
8129
+ cmd = [EMCC , test_file('hello_world.c ')] + args
8130
8130
print(' '.join(cmd))
8131
8131
self.run_process(cmd)
8132
8132
js = read_file('a.out.js')
@@ -8154,7 +8154,7 @@ def test_binaryen_ignore_implicit_traps(self):
8154
8154
8155
8155
def test_binaryen_passes_extra(self):
8156
8156
def build(args):
8157
- return self.run_process([EMXX , test_file('hello_world.cpp '), '-O3'] + args, stdout=PIPE).stdout
8157
+ return self.run_process([EMCC , test_file('hello_world.c '), '-O3'] + args, stdout=PIPE).stdout
8158
8158
8159
8159
build([])
8160
8160
base_size = os.path.getsize('a.out.wasm')
@@ -8409,7 +8409,7 @@ def test_exported_runtime_methods_metadce(self, use_legacy_name):
8409
8409
setting_name = 'EXPORTED_RUNTIME_METHODS'
8410
8410
if use_legacy_name:
8411
8411
setting_name = 'EXTRA_EXPORTED_RUNTIME_METHODS'
8412
- err = self.run_process([EMXX , test_file('hello_world.cpp '), '-Os', '-s%s=%s' % (setting_name, ','.join(exports))], stderr=PIPE).stderr
8412
+ err = self.run_process([EMCC , test_file('hello_world.c '), '-Os', '-s%s=%s' % (setting_name, ','.join(exports))], stderr=PIPE).stderr
8413
8413
if use_legacy_name:
8414
8414
self.assertContained('warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]', err)
8415
8415
js = read_file('a.out.js')
@@ -8530,7 +8530,7 @@ def test_wasm_target_and_STANDALONE_WASM(self):
8530
8530
print(opts, potentially_expect_minified_exports_and_imports, target, ' => ', expect_minified_exports_and_imports, standalone)
8531
8531
8532
8532
self.clear()
8533
- self.run_process([EMXX , test_file('hello_world.cpp '), '-o', target] + opts)
8533
+ self.run_process([EMCC , test_file('hello_world.c '), '-o', target] + opts)
8534
8534
self.assertExists('out.wasm')
8535
8535
if target.endswith('.wasm'):
8536
8536
# only wasm requested
@@ -8654,7 +8654,7 @@ def test_lto_flags(self):
8654
8654
(['-sWASM_OBJECT_FILES=0'], True),
8655
8655
(['-sWASM_OBJECT_FILES'], False),
8656
8656
]:
8657
- self.run_process([EMXX , test_file('hello_world.cpp ')] + flags + ['-c', '-o', 'a.o'])
8657
+ self.run_process([EMCC , test_file('hello_world.c ')] + flags + ['-c', '-o', 'a.o'])
8658
8658
seen_bitcode = building.is_bitcode('a.o')
8659
8659
self.assertEqual(expect_bitcode, seen_bitcode, 'must emit LTO-capable bitcode when flags indicate so (%s)' % str(flags))
8660
8660
@@ -8671,7 +8671,7 @@ def test_wasm_nope(self):
8671
8671
print(opts)
8672
8672
# check we show a good error message if there is no wasm support
8673
8673
create_file('pre.js', 'WebAssembly = undefined;\n')
8674
- self.run_process([EMXX , test_file('hello_world.cpp '), '--pre-js', 'pre.js'] + opts)
8674
+ self.run_process([EMCC , test_file('hello_world.c '), '--pre-js', 'pre.js'] + opts)
8675
8675
out = self.run_js('a.out.js', assert_returncode=NON_ZERO)
8676
8676
self.assertContained('no native wasm support detected', out)
8677
8677
@@ -8862,7 +8862,7 @@ def test_jsrun(self):
8862
8862
8863
8863
def test_error_on_missing_libraries(self):
8864
8864
# -llsomenonexistingfile is an error by default
8865
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), '-lsomenonexistingfile'])
8865
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), '-lsomenonexistingfile'])
8866
8866
self.assertContained('wasm-ld: error: unable to find library -lsomenonexistingfile', err)
8867
8867
8868
8868
# Tests that if user accidentally attempts to link native object code, we show an error
@@ -11490,32 +11490,32 @@ def test_missing_stdlibs(self):
11490
11490
# Certain standard libraries are expected to be useable via -l flags but
11491
11491
# don't actually exist in our standard library path. Make sure we don't
11492
11492
# error out when linking with these flags.
11493
- self.run_process([EMXX , test_file('hello_world.cpp '), '-lm', '-ldl', '-lrt', '-lpthread'])
11493
+ self.run_process([EMCC , test_file('hello_world.c '), '-lm', '-ldl', '-lrt', '-lpthread'])
11494
11494
11495
11495
def test_supported_linker_flags(self):
11496
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-Wl,-rpath=foo'], stderr=PIPE).stderr
11496
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-Wl,-rpath=foo'], stderr=PIPE).stderr
11497
11497
self.assertContained('warning: ignoring unsupported linker flag: `-rpath=foo`', out)
11498
11498
11499
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-Wl,-rpath-link,foo'], stderr=PIPE).stderr
11499
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-Wl,-rpath-link,foo'], stderr=PIPE).stderr
11500
11500
self.assertContained('warning: ignoring unsupported linker flag: `-rpath-link`', out)
11501
11501
11502
- out = self.run_process([EMXX , test_file('hello_world.cpp '),
11502
+ out = self.run_process([EMCC , test_file('hello_world.c '),
11503
11503
'-Wl,--no-check-features,-mllvm,--data-sections'], stderr=PIPE).stderr
11504
11504
self.assertNotContained('warning: ignoring unsupported linker flag', out)
11505
11505
11506
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-Wl,-allow-shlib-undefined'], stderr=PIPE).stderr
11506
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-Wl,-allow-shlib-undefined'], stderr=PIPE).stderr
11507
11507
self.assertContained('warning: ignoring unsupported linker flag: `-allow-shlib-undefined`', out)
11508
11508
11509
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-Wl,--allow-shlib-undefined'], stderr=PIPE).stderr
11509
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-Wl,--allow-shlib-undefined'], stderr=PIPE).stderr
11510
11510
self.assertContained('warning: ignoring unsupported linker flag: `--allow-shlib-undefined`', out)
11511
11511
11512
- out = self.run_process([EMXX , test_file('hello_world.cpp '), '-Wl,-version-script,foo'], stderr=PIPE).stderr
11512
+ out = self.run_process([EMCC , test_file('hello_world.c '), '-Wl,-version-script,foo'], stderr=PIPE).stderr
11513
11513
self.assertContained('warning: ignoring unsupported linker flag: `-version-script`', out)
11514
11514
11515
11515
def test_supported_linker_flag_skip_next(self):
11516
11516
# Regression test for a bug where skipping an unsupported linker flag
11517
11517
# could skip the next unrelated linker flag.
11518
- err = self.expect_fail([EMXX , test_file('hello_world.cpp '), '-Wl,-rpath=foo', '-lbar'])
11518
+ err = self.expect_fail([EMCC , test_file('hello_world.c '), '-Wl,-rpath=foo', '-lbar'])
11519
11519
self.assertContained('error: unable to find library -lbar', err)
11520
11520
11521
11521
def test_linker_flags_pass_through(self):
@@ -11532,27 +11532,27 @@ def test_linker_flags_pass_through(self):
11532
11532
self.assertContained('wasm-ld: warning: unknown -z value: foo', err)
11533
11533
11534
11534
def test_linker_flags_unused(self):
11535
- err = self.run_process([EMXX , test_file('hello_world.cpp '), '-c', '-lbar'], stderr=PIPE).stderr
11535
+ err = self.run_process([EMCC , test_file('hello_world.c '), '-c', '-lbar'], stderr=PIPE).stderr
11536
11536
self.assertContained("warning: -lbar: 'linker' input unused [-Wunused-command-line-argument]", err)
11537
11537
11538
11538
def test_linker_input_unused(self):
11539
- self.run_process([EMXX , '-c', test_file('hello_world.cpp ')])
11539
+ self.run_process([EMCC , '-c', test_file('hello_world.c ')])
11540
11540
err = self.run_process([EMCC, 'hello_world.o', '-c', '-o', 'out.o'], stderr=PIPE).stderr
11541
11541
self.assertContained("clang: warning: hello_world.o: 'linker' input unused [-Wunused-command-line-argument]", err)
11542
11542
# In this case the compiler does not produce any output file.
11543
11543
self.assertNotExists('out.o')
11544
11544
11545
11545
def test_non_wasm_without_wasm_in_vm(self):
11546
11546
# Test that our non-wasm output does not depend on wasm support in the vm.
11547
- self.run_process([EMXX , test_file('hello_world.cpp '), '-sWASM=0', '-sENVIRONMENT=node,shell'])
11547
+ self.run_process([EMCC , test_file('hello_world.c '), '-sWASM=0', '-sENVIRONMENT=node,shell'])
11548
11548
js = read_file('a.out.js')
11549
11549
create_file('a.out.js', 'var WebAssembly = null;\n' + js)
11550
11550
for engine in config.JS_ENGINES:
11551
11551
self.assertContained('hello, world!', self.run_js('a.out.js', engine=engine))
11552
11552
11553
11553
def test_empty_output_extension(self):
11554
11554
# Default to JS output when no extension is present
11555
- self.run_process([EMXX , test_file('hello_world.cpp '), '-Werror', '-o', 'hello'])
11555
+ self.run_process([EMCC , test_file('hello_world.c '), '-Werror', '-o', 'hello'])
11556
11556
self.assertContained('hello, world!', self.run_js('hello'))
11557
11557
11558
11558
def test_backwards_deps_in_archive(self):
@@ -11665,11 +11665,11 @@ def test_stdin_compile_and_link(self):
11665
11665
def test_stdout_link(self):
11666
11666
# linking to stdout `-` doesn't work, we have no way to pass such an output filename
11667
11667
# through post-link tools such as binaryen.
11668
- err = self.expect_fail([EMXX , '-o', '-', test_file('hello_world.cpp ')])
11668
+ err = self.expect_fail([EMCC , '-o', '-', test_file('hello_world.c ')])
11669
11669
self.assertContained('invalid output filename: `-`', err)
11670
11670
self.assertNotExists('-')
11671
11671
11672
- err = self.expect_fail([EMXX , '-o', '-foo', test_file('hello_world.cpp ')])
11672
+ err = self.expect_fail([EMCC , '-o', '-foo', test_file('hello_world.c ')])
11673
11673
self.assertContained('invalid output filename: `-foo`', err)
11674
11674
self.assertNotExists('-foo')
11675
11675
@@ -11698,7 +11698,7 @@ def ok(args, filename='hello_world.cpp', expected='hello, world!'):
11698
11698
def fail(args, details):
11699
11699
print('fail', args, details)
11700
11700
args += ['-sERROR_ON_WASM_CHANGES_AFTER_LINK']
11701
- err = self.expect_fail([EMXX , test_file('hello_world.cpp ')] + args)
11701
+ err = self.expect_fail([EMCC , test_file('hello_world.c ')] + args)
11702
11702
self.assertContained('changes to the wasm are required after link, but disallowed by ERROR_ON_WASM_CHANGES_AFTER_LINK', err)
11703
11703
self.assertContained(details, err)
11704
11704
@@ -11712,7 +11712,7 @@ def fail(args, details):
11712
11712
11713
11713
@crossplatform
11714
11714
def test_output_to_nowhere(self):
11715
- self.run_process([EMXX , test_file('hello_world.cpp '), '-o', os.devnull, '-c'])
11715
+ self.run_process([EMCC , test_file('hello_world.c '), '-o', os.devnull, '-c'])
11716
11716
11717
11717
# Test that passing -sMIN_X_VERSION=-1 on the command line will result in browser X being not supported at all.
11718
11718
# I.e. -sMIN_X_VERSION=-1 is equal to -sMIN_X_VERSION=Infinity
@@ -11752,7 +11752,7 @@ def test(args, expect_fail):
11752
11752
# legacy browsers may lack Promise, which wasm2js depends on. see what
11753
11753
# happens when we kill the global Promise function.
11754
11754
create_file('extern-post.js', extern_post_js)
11755
- self.run_process([EMXX , test_file('hello_world.cpp ')] + constant_args + args + ['--extern-post-js', 'extern-post.js'])
11755
+ self.run_process([EMCC , test_file('hello_world.c ')] + constant_args + args + ['--extern-post-js', 'extern-post.js'])
11756
11756
js = read_file('a.out.js')
11757
11757
create_file('a.out.js', 'Promise = undefined;\n' + js)
11758
11758
return self.run_js('a.out.js', assert_returncode=NON_ZERO if expect_fail else 0)
0 commit comments