@@ -573,7 +573,7 @@ def test_emcc_3(self, compiler, suffix):
573573 self.assertContained('hello, world!', self.run_js('a.out.js'))
574574
575575 # emcc [..] -o [path] ==> should work with absolute paths
576- for path in (os.path.abspath(Path( '../file1.js')), Path( 'b_dir/file2.js') ):
576+ for path in (os.path.abspath('../file1.js'), 'b_dir/file2.js'):
577577 print(path)
578578 os.chdir(self.get_dir())
579579 self.clear()
@@ -1327,26 +1327,24 @@ def test_l_link(self):
13271327 ''')
13281328
13291329 ensure_dir('libdir')
1330- libfile = Path('libdir/libfile.so')
1331- aout = 'a.out.js'
13321330
13331331 def build(path, args):
13341332 self.run_process([EMCC, path] + args)
13351333
13361334 # Test linking the library built here by emcc
13371335 build('libfile.c', ['-c'])
1338- shutil.move('libfile.o', libfile)
1336+ shutil.move('libfile.o', 'libdir/ libfile.so' )
13391337 build('main.c', ['-L' + 'libdir', '-lfile'])
13401338
1341- self.assertContained('hello from lib', self.run_js(aout ))
1339+ self.assertContained('hello from lib', self.run_js('a.out.js' ))
13421340
13431341 # Also test execution with `-l c` and space-separated library linking syntax
1344- os.remove(aout )
1342+ os.remove('a.out.js' )
13451343 build('libfile.c', ['-c', '-l', 'c'])
1346- shutil.move('libfile.o', libfile)
1344+ shutil.move('libfile.o', 'libdir/ libfile.so' )
13471345 build('main.c', ['-L', 'libdir', '-l', 'file'])
13481346
1349- self.assertContained('hello from lib', self.run_js(aout ))
1347+ self.assertContained('hello from lib', self.run_js('a.out.js' ))
13501348
13511349 # Must not leave unneeded linker stubs
13521350 self.assertNotExists('a.out')
@@ -1837,14 +1835,14 @@ def test_identical_basenames(self):
18371835 void printey() { printf("hello there\\n"); }
18381836 ''')
18391837
1840- self.run_process([EMCC, Path( 'foo/main.c'), Path( 'bar/main.c') ])
1838+ self.run_process([EMCC, 'foo/main.c', 'bar/main.c'])
18411839 self.assertContained('hello there', self.run_js('a.out.js'))
18421840
18431841 # ditto with first creating .o files
18441842 delete_file('a.out.js')
1845- self.run_process([EMCC, '-c', Path( 'foo/main.c') , '-o', Path( 'foo/main.o') ])
1846- self.run_process([EMCC, '-c', Path( 'bar/main.c') , '-o', Path( 'bar/main.o') ])
1847- self.run_process([EMCC, Path( 'foo/main.o'), Path( 'bar/main.o') ])
1843+ self.run_process([EMCC, '-c', 'foo/main.c', '-o', 'foo/main.o'])
1844+ self.run_process([EMCC, '-c', 'bar/main.c', '-o', 'bar/main.o'])
1845+ self.run_process([EMCC, 'foo/main.o', 'bar/main.o'])
18481846 self.assertContained('hello there', self.run_js('a.out.js'))
18491847
18501848 def test_main_a(self):
@@ -1913,7 +1911,7 @@ def test_archive_duplicate_basenames(self):
19131911 printf("a\n");
19141912 }
19151913 ''')
1916- self.run_process([EMCC, Path( 'a/common.c') , '-c', '-o', Path( 'a/common.o') ])
1914+ self.run_process([EMCC, 'a/common.c', '-c', '-o', 'a/common.o'])
19171915
19181916 ensure_dir('b')
19191917 create_file('b/common.c', r'''
@@ -1922,10 +1920,10 @@ def test_archive_duplicate_basenames(self):
19221920 printf("b...\n");
19231921 }
19241922 ''')
1925- self.run_process([EMCC, Path( 'b/common.c') , '-c', '-o', Path( 'b/common.o') ])
1923+ self.run_process([EMCC, 'b/common.c', '-c', '-o', 'b/common.o'])
19261924
19271925 delete_file('liba.a')
1928- self.run_process([EMAR, 'rc', 'liba.a', Path( 'a/common.o'), Path( 'b/common.o') ])
1926+ self.run_process([EMAR, 'rc', 'liba.a', 'a/common.o', 'b/common.o'])
19291927
19301928 # Verify that archive contains basenames with hashes to avoid duplication
19311929 text = self.run_process([EMAR, 't', 'liba.a'], stdout=PIPE).stdout
@@ -1948,7 +1946,7 @@ def test_archive_duplicate_basenames(self):
19481946
19491947 # Using llvm-ar directly should cause duplicate basenames
19501948 delete_file('libdup.a')
1951- self.run_process([LLVM_AR, 'rc', 'libdup.a', Path( 'a/common.o'), Path( 'b/common.o') ])
1949+ self.run_process([LLVM_AR, 'rc', 'libdup.a', 'a/common.o', 'b/common.o'])
19521950 text = self.run_process([EMAR, 't', 'libdup.a'], stdout=PIPE).stdout
19531951 self.assertEqual(text.count('common.o'), 2)
19541952
@@ -2164,9 +2162,9 @@ def test(link_flags, lib_suffix):
21642162 ''')
21652163
21662164 # Build libfile normally into an .so
2167- self.run_process([EMCC, Path( 'libdir/libfile.c') , '-shared', '-o', Path( 'libdir/libfile.so' + lib_suffix) ])
2165+ self.run_process([EMCC, 'libdir/libfile.c', '-shared', '-o', 'libdir/libfile.so' + lib_suffix])
21682166 # Build libother and dynamically link it to libfile
2169- self.run_process([EMCC, '-Llibdir', Path( 'libdir/libother.c') ] + link_flags + ['-shared', '-o', Path( 'libdir/libother.so') ])
2167+ self.run_process([EMCC, '-Llibdir', 'libdir/libother.c'] + link_flags + ['-shared', '-o', 'libdir/libother.so'])
21702168 # Build the main file, linking in both the libs
21712169 self.run_process([EMCC, '-Llibdir', os.path.join('main.c')] + link_flags + ['-lother', '-c'])
21722170 print('...')
@@ -2177,7 +2175,7 @@ def test(link_flags, lib_suffix):
21772175 self.assertContained('*hello from lib\n|hello from lib|\n*\n', self.run_js('a.out.js'))
21782176
21792177 test(['-lfile'], '') # -l, auto detection from library path
2180- test([self.in_dir( 'libdir/libfile.so.3.1.4.1.5.9') ], '.3.1.4.1.5.9') # handle libX.so.1.2.3 as well
2178+ test(['libdir/libfile.so.3.1.4.1.5.9'], '.3.1.4.1.5.9') # handle libX.so.1.2.3 as well
21812179
21822180 @node_pthreads
21832181 def test_dylink_pthread_static_data(self):
@@ -3138,7 +3136,7 @@ def test_dwarf_sourcemap_names(self):
31383136 def test_scons(self):
31393137 # this test copies the site_scons directory alongside the test
31403138 shutil.copytree(test_file('scons/simple'), 'test')
3141- shutil.copytree(path_from_root('tools/scons/site_scons'), Path( 'test/site_scons') )
3139+ shutil.copytree(path_from_root('tools/scons/site_scons'), 'test/site_scons')
31423140 with common.chdir('test'):
31433141 self.run_process(['scons'])
31443142 output = self.run_js('scons_integration.js', assert_returncode=5)
@@ -3153,7 +3151,7 @@ def test_scons(self):
31533151 def test_scons_env(self):
31543152 # this test copies the site_scons directory alongside the test
31553153 shutil.copytree(test_file('scons/env'), 'test')
3156- shutil.copytree(path_from_root('tools/scons/site_scons'), Path( 'test/site_scons') )
3154+ shutil.copytree(path_from_root('tools/scons/site_scons'), 'test/site_scons')
31573155
31583156 expected_to_propagate = json.dumps({
31593157 'CC': path_from_root('emcc'),
@@ -3172,7 +3170,7 @@ def test_scons_env(self):
31723170 @requires_scons
31733171 def test_scons_env_no_emscons(self):
31743172 shutil.copytree(test_file('scons/env'), 'test')
3175- shutil.copytree(path_from_root('tools/scons/site_scons'), Path( 'test/site_scons') )
3173+ shutil.copytree(path_from_root('tools/scons/site_scons'), 'test/site_scons')
31763174
31773175 expected_to_propagate = json.dumps({
31783176 'CC': 'emcc',
@@ -8772,8 +8770,8 @@ def test_invalid_memory_max(self):
87728770 self.assertContained('emcc: error: MAXIMUM_MEMORY is only meaningful with ALLOW_MEMORY_GROWTH', err)
87738771
87748772 def test_dasho_invalid_dir(self):
8775- ret = self.expect_fail([EMCC, test_file('hello_world.c'), '-o', Path( 'NONEXISTING_DIRECTORY/out.js') ])
8776- self.assertContained('specified output file (NONEXISTING_DIRECTORY%sout .js) is in a directory that does not exist' % os.path.sep , ret)
8773+ ret = self.expect_fail([EMCC, test_file('hello_world.c'), '-o', 'NONEXISTING_DIRECTORY/out.js'])
8774+ self.assertContained('specified output file (NONEXISTING_DIRECTORY/out .js) is in a directory that does not exist', ret)
87778775
87788776 def test_dasho_is_dir(self):
87798777 ret = self.expect_fail([EMCC, test_file('hello_world.c'), '-o', '.'])
@@ -10472,13 +10470,13 @@ def test_separate_dwarf(self):
1047210470 os.mkdir('subdir')
1047310471 self.run_process([EMCC, test_file('hello_world.c'),
1047410472 '-gseparate-dwarf',
10475- '-o', Path( 'subdir/output.js') ])
10473+ '-o', 'subdir/output.js'])
1047610474 wasm = read_binary('subdir/output.wasm')
1047710475 self.assertIn(b'output.wasm.debug.wasm', wasm)
1047810476 # check both unix-style slashes and the system's slashes, so that we don't
1047910477 # assume the encoding of the section in this test
1048010478 self.assertNotIn(b'subdir/output.wasm.debug.wasm', wasm)
10481- self.assertNotIn(bytes( os.path.join('subdir', 'output.wasm.debug.wasm'), 'ascii' ), wasm)
10479+ self.assertNotIn(os.path.join('subdir', 'output.wasm.debug.wasm').encode( ), wasm)
1048210480
1048310481 # Check that the dwarf file has only dwarf, name, and non-code sections
1048410482 with webassembly.Module('subdir/output.wasm.debug.wasm') as debug_wasm:
@@ -10540,7 +10538,7 @@ def test_separate_dwarf_with_filename(self):
1054010538 # should leave a relative path to the debug wasm
1054110539 os.mkdir('subdir')
1054210540 self.run_process([EMCC, test_file('hello_world.c'),
10543- '-o', Path( 'subdir/output.js') ,
10541+ '-o', 'subdir/output.js',
1054410542 '-gseparate-dwarf=with_dwarf2.wasm'])
1054510543 self.assertExists('with_dwarf2.wasm')
1054610544 wasm = read_binary('subdir/output.wasm')
@@ -10756,7 +10754,7 @@ def test_html_preprocess(self):
1075610754 @requires_node
1075710755 def test_node_js_run_from_different_directory(self):
1075810756 ensure_dir('subdir')
10759- self.run_process([EMCC, test_file('hello_world.c'), '-o', Path( 'subdir/a.js') , '-O3'])
10757+ self.run_process([EMCC, test_file('hello_world.c'), '-o', 'subdir/a.js', '-O3'])
1076010758 ret = self.run_js('subdir/a.js')
1076110759 self.assertContained('hello, world!', ret)
1076210760
0 commit comments