@@ -2110,6 +2110,52 @@ def test_scanpipe_codebase_resource_queryset_has_directory_content_fingerprint(
21102110 results = self .project1 .codebaseresources .has_directory_content_fingerprint ()
21112111 self .assertQuerySetEqual (expected , results , ordered = False )
21122112
2113+ def test_scanpipe_codebase_resource_queryset_elfs (self ):
2114+ project = Project .objects .create (name = "Test" )
2115+ resource_starting_with_elf_and_executable_in_file_type = CodebaseResource (
2116+ file_type = """ELF 32-bit LSB executable, ARM, version 1 (ARM), statically
2117+ linked, with debug_info, not stripped""" ,
2118+ project = project ,
2119+ path = "a" ,
2120+ type = CodebaseResource .Type .FILE ,
2121+ )
2122+ resource_starting_with_elf_and_executable_in_file_type .save ()
2123+ resource_with_executable_in_file_type = CodebaseResource (
2124+ file_type = """32-bit LSB executable, ARM, version 1 (ARM), statically
2125+ linked, with debug_info, not stripped""" ,
2126+ project = project ,
2127+ path = "b" ,
2128+ type = CodebaseResource .Type .FILE ,
2129+ )
2130+ resource_with_executable_in_file_type .save ()
2131+ resource_starting_with_elf_in_file_type = CodebaseResource (
2132+ file_type = """ELF 32-bit LSB resourcable, ARM, version 1 (ARM), statically
2133+ linked, with debug_info, not stripped""" ,
2134+ project = project ,
2135+ path = "c" ,
2136+ type = CodebaseResource .Type .FILE ,
2137+ )
2138+ resource_starting_with_elf_in_file_type .save ()
2139+ resource = CodebaseResource (
2140+ file_type = """32-bit LSB relocatable, ARM, version 1 (ARM), statically
2141+ linked, with debug_info, not stripped""" ,
2142+ project = project ,
2143+ path = "d" ,
2144+ type = CodebaseResource .Type .FILE ,
2145+ )
2146+ resource .save ()
2147+ resource_starting_with_elf_and_relocatable_in_file_type = CodebaseResource (
2148+ file_type = """ELF 32-bit LSB relocatable, ARM, version 1 (ARM), statically
2149+ linked, with debug_info, not stripped""" ,
2150+ project = project ,
2151+ path = "e" ,
2152+ type = CodebaseResource .Type .FILE ,
2153+ )
2154+ resource_starting_with_elf_and_relocatable_in_file_type .save ()
2155+ paths = [str (resource .path ) for resource in project .codebaseresources .elfs ()]
2156+ self .assertTrue ("e" in paths )
2157+ self .assertTrue ("a" in paths )
2158+
21132159
21142160class ScanPipeModelsTransactionTest (TransactionTestCase ):
21152161 """
0 commit comments