@@ -8894,7 +8894,8 @@ def test_wasm_sourcemap(self):
88948894 '--dwarfdump-output' ,
88958895 path_from_root ('tests' , 'other' , 'wasm_sourcemap' , 'foo.wasm.dump' ),
88968896 '-o' , 'a.out.wasm.map' ,
8897- path_from_root ('tests' , 'other' , 'wasm_sourcemap' , 'foo.wasm' )]
8897+ path_from_root ('tests' , 'other' , 'wasm_sourcemap' , 'foo.wasm' ),
8898+ '--basepath=' + os .getcwd ()]
88988899 run_process (wasm_map_cmd )
88998900 output = open ('a.out.wasm.map' ).read ()
89008901 # has "sources" entry with file (includes also `--prefix =wasm-src:///` replacement)
@@ -8909,12 +8910,35 @@ def test_wasm_sourcemap_dead(self):
89098910 '--dwarfdump-output' ,
89108911 path_from_root ('tests' , 'other' , 'wasm_sourcemap_dead' , 't.wasm.dump' ),
89118912 '-o' , 'a.out.wasm.map' ,
8912- path_from_root ('tests' , 'other' , 'wasm_sourcemap_dead' , 't.wasm' )]
8913+ path_from_root ('tests' , 'other' , 'wasm_sourcemap_dead' , 't.wasm' ),
8914+ '--basepath=' + os .getcwd ()]
89138915 run_process (wasm_map_cmd , stdout = PIPE , stderr = PIPE )
89148916 output = open ('a.out.wasm.map' ).read ()
89158917 # has only two entries
89168918 self .assertRegexpMatches (output , r'"mappings":\s*"[A-Za-z0-9+/]+,[A-Za-z0-9+/]+"' )
89178919
8920+ @no_fastcomp ()
8921+ def test_wasm_sourcemap_relative_paths (self ):
8922+ def test (infile , source_map_added_dir = '' ):
8923+ expected_source_map_path = os .path .join (source_map_added_dir , 'a.cpp' )
8924+ print (infile , expected_source_map_path )
8925+ shutil .copyfile (path_from_root ('tests' , 'hello_123.c' ), infile )
8926+ infiles = [
8927+ infile ,
8928+ os .path .abspath (infile ),
8929+ './' + infile
8930+ ]
8931+ for curr in infiles :
8932+ print (' ' , curr )
8933+ run_process ([PYTHON , EMCC , curr , '-g4' ])
8934+ with open ('a.out.wasm.map' , 'r' ) as f :
8935+ self .assertIn ('"%s"' % expected_source_map_path , str (f .read ()))
8936+
8937+ test ('a.cpp' )
8938+
8939+ os .mkdir ('inner' )
8940+ test (os .path .join ('inner' , 'a.cpp' ), 'inner' )
8941+
89188942 def test_wasm_producers_section (self ):
89198943 # no producers section by default
89208944 run_process ([PYTHON , EMCC , path_from_root ('tests' , 'hello_world.c' )])
@@ -9690,17 +9714,17 @@ def test_lsan_leaks(self, ext):
96909714 @parameterized ({
96919715 'c' : ['c' , [
96929716 r'in malloc.*a\.out\.wasm\+0x' ,
9693- r'(?im)in f (/|[ a-z]:).*/test_lsan_leaks\.c:6:21$' ,
9694- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.c:10:16$' ,
9695- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.c:12:3$' ,
9696- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.c:13:3$' ,
9717+ r'(?im)in f (|[/ a-z\. ]:).*/test_lsan_leaks\.c:6:21$' ,
9718+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.c:10:16$' ,
9719+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.c:12:3$' ,
9720+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.c:13:3$' ,
96979721 ]],
96989722 'cpp' : ['cpp' , [
96999723 r'in operator new\[\]\(unsigned long\).*a\.out\.wasm\+0x' ,
9700- r'(?im)in f\(\) (/|[ a-z]:).*/test_lsan_leaks\.cpp:4:21$' ,
9701- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.cpp:8:16$' ,
9702- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.cpp:10:3$' ,
9703- r'(?im)in main (/|[ a-z]:).*/test_lsan_leaks\.cpp:11:3$' ,
9724+ r'(?im)in f\(\) (|[/ a-z\. ]:).*/test_lsan_leaks\.cpp:4:21$' ,
9725+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.cpp:8:16$' ,
9726+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.cpp:10:3$' ,
9727+ r'(?im)in main (|[/ a-z\. ]:).*/test_lsan_leaks\.cpp:11:3$' ,
97049728 ]],
97059729 })
97069730 @no_fastcomp ('lsan not supported on fastcomp' )
0 commit comments