41
41
from common import also_with_modularize, also_with_wasmfs, with_all_fs
42
42
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, also_with_asan, flaky
43
43
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
44
- from common import requires_network, parameterize
44
+ from common import requires_network, parameterize, copytree
45
45
from tools import shared, building, utils, response_file, cache
46
46
from tools.utils import read_file, write_file, delete_file, read_binary, MACOS, WINDOWS
47
47
import common
@@ -3137,11 +3137,10 @@ def test_dwarf_sourcemap_names(self):
3137
3137
@with_env_modify({'EMSCRIPTEN_ROOT': path_from_root()})
3138
3138
def test_scons(self):
3139
3139
# this test copies the site_scons directory alongside the test
3140
- shutil.copytree(test_file('scons/simple'), 'test')
3141
- shutil.copytree(path_from_root('tools/scons/site_scons'), 'test/site_scons')
3142
- with common.chdir('test'):
3143
- self.run_process(['scons'])
3144
- output = self.run_js('scons_integration.js', assert_returncode=5)
3140
+ copytree(test_file('scons/simple'), '.')
3141
+ copytree(path_from_root('tools/scons/site_scons'), 'site_scons')
3142
+ self.run_process(['scons'])
3143
+ output = self.run_js('scons_integration.js', assert_returncode=5)
3145
3144
self.assertContained('If you see this - the world is all right!', output)
3146
3145
3147
3146
@requires_scons
@@ -3152,8 +3151,8 @@ def test_scons(self):
3152
3151
})
3153
3152
def test_scons_env(self):
3154
3153
# this test copies the site_scons directory alongside the test
3155
- shutil. copytree(test_file('scons/env'), 'test ')
3156
- shutil. copytree(path_from_root('tools/scons/site_scons'), 'test/ site_scons')
3154
+ copytree(test_file('scons/env'), '. ')
3155
+ copytree(path_from_root('tools/scons/site_scons'), 'site_scons')
3157
3156
3158
3157
expected_to_propagate = json.dumps({
3159
3158
'CC': path_from_root('emcc'),
@@ -3166,13 +3165,12 @@ def test_scons_env(self):
3166
3165
}
3167
3166
})
3168
3167
3169
- with common.chdir('test'):
3170
- self.run_process(['scons', '--expected-env', expected_to_propagate])
3168
+ self.run_process(['scons', '--expected-env', expected_to_propagate])
3171
3169
3172
3170
@requires_scons
3173
3171
def test_scons_env_no_emscons(self):
3174
- shutil. copytree(test_file('scons/env'), 'test ')
3175
- shutil. copytree(path_from_root('tools/scons/site_scons'), 'test/ site_scons')
3172
+ copytree(test_file('scons/env'), '. ')
3173
+ copytree(path_from_root('tools/scons/site_scons'), 'site_scons')
3176
3174
3177
3175
expected_to_propagate = json.dumps({
3178
3176
'CC': 'emcc',
@@ -3185,20 +3183,18 @@ def test_scons_env_no_emscons(self):
3185
3183
}
3186
3184
})
3187
3185
3188
- with common.chdir('test'):
3189
- self.run_process(['scons', '--expected-env', expected_to_propagate])
3186
+ self.run_process(['scons', '--expected-env', expected_to_propagate])
3190
3187
3191
3188
@requires_scons
3192
3189
def test_emscons(self):
3193
- shutil.copytree(test_file('scons/simple'), 'test')
3194
- with common.chdir('test'):
3195
- self.run_process([path_from_root('emscons'), 'scons'])
3196
- output = self.run_js('scons_integration.js', assert_returncode=5)
3190
+ copytree(test_file('scons/simple'), '.')
3191
+ self.run_process([path_from_root('emscons'), 'scons'])
3192
+ output = self.run_js('scons_integration.js', assert_returncode=5)
3197
3193
self.assertContained('If you see this - the world is all right!', output)
3198
3194
3199
3195
@requires_scons
3200
3196
def test_emscons_env(self):
3201
- shutil. copytree(test_file('scons/env'), 'test ')
3197
+ copytree(test_file('scons/env'), '. ')
3202
3198
3203
3199
building_env = get_building_env()
3204
3200
expected_to_propagate = json.dumps({
@@ -3212,8 +3208,7 @@ def test_emscons_env(self):
3212
3208
}
3213
3209
})
3214
3210
3215
- with common.chdir('test'):
3216
- self.run_process([path_from_root('emscons'), 'scons', '--expected-env', expected_to_propagate])
3211
+ self.run_process([path_from_root('emscons'), 'scons', '--expected-env', expected_to_propagate])
3217
3212
3218
3213
def test_embind_fail(self):
3219
3214
out = self.expect_fail([EMXX, test_file('embind/test_unsigned.cpp')])
@@ -15591,9 +15586,9 @@ def test_embool(self):
15591
15586
15592
15587
@requires_rust
15593
15588
def test_rust_integration_basics(self):
15594
- shutil. copytree(test_file('rust/basics'), 'basics ')
15595
- self.run_process(['cargo', 'build', '--target=wasm32-unknown-emscripten'], cwd='basics' )
15596
- lib = 'basics/ target/wasm32-unknown-emscripten/debug/libbasics.a'
15589
+ copytree(test_file('rust/basics'), '. ')
15590
+ self.run_process(['cargo', 'build', '--target=wasm32-unknown-emscripten'])
15591
+ lib = 'target/wasm32-unknown-emscripten/debug/libbasics.a'
15597
15592
self.assertExists(lib)
15598
15593
15599
15594
create_file('main.cpp', '''
@@ -15699,8 +15694,7 @@ def test_late_module_api_assignment(self):
15699
15694
self.do_runf(test_file('hello_world.c'), expected, emcc_args=['--post-js=post.js', '-sWASM_ASYNC_COMPILATION=0'], assert_returncode=NON_ZERO)
15700
15695
15701
15696
def test_rollup(self):
15702
- shutil.copytree(test_file('rollup_node'), 'rollup_node')
15703
- with common.chdir('rollup_node'):
15704
- self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sENVIRONMENT=node', '-sMODULARIZE', '-o', 'hello.mjs'])
15705
- self.run_process(shared.get_npm_cmd('rollup') + ['--config'])
15706
- self.assertContained('hello, world!', self.run_js('bundle.mjs'))
15697
+ copytree(test_file('rollup_node'), '.')
15698
+ self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sENVIRONMENT=node', '-sMODULARIZE', '-o', 'hello.mjs'])
15699
+ self.run_process(shared.get_npm_cmd('rollup') + ['--config'])
15700
+ self.assertContained('hello, world!', self.run_js('bundle.mjs'))
0 commit comments