@@ -767,64 +767,24 @@ def test_gecko_collector_preserves_source_file_paths(self):
767767 profile_data = collector ._build_profile ()
768768
769769 string_array = profile_data ["shared" ]["stringArray" ]
770- thread_data = profile_data ["threads" ][0 ]
771- func_table = thread_data ["funcTable" ]
770+ func_table = profile_data ["threads" ][0 ]["funcTable" ]
772771
773772 self .assertEqual (func_table ["length" ], 2 )
774- self .assertEqual (len (func_table ["name" ]), 2 )
775- self .assertEqual (len (func_table ["fileName" ]), 2 )
776- self .assertEqual (len (func_table ["lineNumber" ]), 2 )
777-
778- # Strictly validate that string table contains both full paths
779- self .assertIn (file_a , string_array )
780- self .assertIn (file_b , string_array )
781- expected_idx_a = string_array .index (file_a )
782- expected_idx_b = string_array .index (file_b )
783- self .assertNotEqual (
784- expected_idx_a ,
785- expected_idx_b ,
786- "Distinct file paths must have distinct string table indices" ,
787- )
788-
789- # Build mapping of func_name -> (file_idx, file_name, line_no)
790- funcs_by_name = {}
791- for i in range (func_table ["length" ]):
792- name_idx = func_table ["name" ][i ]
793- self .assertIsInstance (name_idx , int )
794- self .assertGreaterEqual (name_idx , 0 )
795- self .assertLess (name_idx , len (string_array ))
796- func_name = string_array [name_idx ]
797-
798- file_idx = func_table ["fileName" ][i ]
799- self .assertIsInstance (file_idx , int )
800- self .assertGreaterEqual (file_idx , 0 )
801- self .assertLess (file_idx , len (string_array ))
802- file_name = string_array [file_idx ]
803-
804- line_no = func_table ["lineNumber" ][i ]
805- self .assertIsInstance (line_no , int )
806-
807- funcs_by_name [func_name ] = (file_idx , file_name , line_no )
808-
809- self .assertEqual (set (funcs_by_name .keys ()), {"func_a" , "func_b" })
810-
811- # Strictly validate func_a filename index, path string, and line
812- file_idx_a , resolved_file_a , line_a = funcs_by_name ["func_a" ]
813- self .assertEqual (file_idx_a , expected_idx_a )
814- self .assertEqual (resolved_file_a , file_a )
815- self .assertEqual (line_a , 10 )
816773
817- # Strictly validate func_b filename index, path string, and line
818- file_idx_b , resolved_file_b , line_b = funcs_by_name ["func_b" ]
819- self .assertEqual (file_idx_b , expected_idx_b )
820- self .assertEqual (resolved_file_b , file_b )
821- self .assertEqual (line_b , 20 )
774+ funcs_by_name = {
775+ string_array [func_table ["name" ][i ]]: (
776+ func_table ["fileName" ][i ],
777+ string_array [func_table ["fileName" ][i ]],
778+ )
779+ for i in range (func_table ["length" ])
780+ }
781+
782+ file_idx_a , resolved_file_a = funcs_by_name ["func_a" ]
783+ file_idx_b , resolved_file_b = funcs_by_name ["func_b" ]
822784
823- # Ensure the filename indices and resolved paths in funcTable are distinct
785+ self .assertEqual (resolved_file_a , file_a )
786+ self .assertEqual (resolved_file_b , file_b )
824787 self .assertNotEqual (file_idx_a , file_idx_b )
825- self .assertNotEqual (resolved_file_a , resolved_file_b )
826- self .assertNotEqual (resolved_file_a , os .path .basename (file_a ))
827- self .assertNotEqual (resolved_file_b , os .path .basename (file_b ))
828788
829789 def test_gecko_collector_async_aware (self ):
830790 collector = GeckoCollector (1000 )
0 commit comments