@@ -1599,6 +1599,68 @@ def test_scanpipe_pipes_d2d_map_elf_symbols(self):
15991599 ).count (),
16001600 )
16011601
1602+ @skipIf (sys .platform == "darwin" , "Test is failing on macOS" )
1603+ def test_scanpipe_pipes_d2d_map_macho_symbols (self ):
1604+ input_dir = self .project1 .input_path
1605+ input_resources = [
1606+ self .data / "d2d-macho/from-lumen.zip" ,
1607+ self .data / "d2d-macho/to-lumen.zip" ,
1608+ ]
1609+ copy_inputs (input_resources , input_dir )
1610+ self .from_files , self .to_files = d2d .get_inputs (self .project1 )
1611+ inputs_with_codebase_path_destination = [
1612+ (self .from_files , self .project1 .codebase_path / d2d .FROM ),
1613+ (self .to_files , self .project1 .codebase_path / d2d .TO ),
1614+ ]
1615+ for input_files , codebase_path in inputs_with_codebase_path_destination :
1616+ for input_file_path in input_files :
1617+ scancode .extract_archive (input_file_path , codebase_path )
1618+
1619+ scancode .extract_archives (
1620+ self .project1 .codebase_path ,
1621+ recurse = True ,
1622+ )
1623+ pipes .collect_and_create_codebase_resources (self .project1 )
1624+ buffer = io .StringIO ()
1625+ d2d .map_macho_binaries_with_symbols (project = self .project1 , logger = buffer .write )
1626+ self .assertEqual (
1627+ 9 ,
1628+ CodebaseRelation .objects .filter (
1629+ project = self .project1 , map_type = "macho_symbols"
1630+ ).count (),
1631+ )
1632+
1633+ @skipIf (sys .platform == "darwin" , "Test is failing on macOS" )
1634+ def test_scanpipe_pipes_d2d_map_winpe_symbols (self ):
1635+ input_dir = self .project1 .input_path
1636+ input_resources = [
1637+ self .data / "d2d-winpe/to-translucent.zip" ,
1638+ self .data / "d2d-winpe/from-translucent.zip" ,
1639+ ]
1640+ copy_inputs (input_resources , input_dir )
1641+ self .from_files , self .to_files = d2d .get_inputs (self .project1 )
1642+ inputs_with_codebase_path_destination = [
1643+ (self .from_files , self .project1 .codebase_path / d2d .FROM ),
1644+ (self .to_files , self .project1 .codebase_path / d2d .TO ),
1645+ ]
1646+ for input_files , codebase_path in inputs_with_codebase_path_destination :
1647+ for input_file_path in input_files :
1648+ scancode .extract_archive (input_file_path , codebase_path )
1649+
1650+ scancode .extract_archives (
1651+ self .project1 .codebase_path ,
1652+ recurse = True ,
1653+ )
1654+ pipes .collect_and_create_codebase_resources (self .project1 )
1655+ buffer = io .StringIO ()
1656+ d2d .map_winpe_binaries_with_symbols (project = self .project1 , logger = buffer .write )
1657+ self .assertEqual (
1658+ 4 ,
1659+ CodebaseRelation .objects .filter (
1660+ project = self .project1 , map_type = "winpe_symbols"
1661+ ).count (),
1662+ )
1663+
16021664 @mock .patch ("scanpipe.pipes.purldb.match_resources" )
16031665 def test_scanpipe_pipes_d2d_match_purldb_resource_no_package_data (
16041666 self , mock_match_resource
0 commit comments