@@ -116,6 +116,49 @@ def test_system_against_dockerfile_findings(self):
116
116
dockerfile .write_dockerfile_report_csv (args .out_scan , args .out_dockerfile_scan_csv )
117
117
dockerfile .write_dockerfile_report_md (args .out_scan , args .out_dockerfile_scan_md )
118
118
119
+ def test_get_sbomgen_arch (self ):
120
+
121
+ test_cases = [
122
+ # supported platforms (ARM and Intel 64-bit)
123
+ {"input" : "x86_64" , "expected" : "amd64" },
124
+ {"input" : "amd64" , "expected" : "amd64" },
125
+ {"input" : "arm64" , "expected" : "arm64" },
126
+ {"input" : "aarch64" , "expected" : "arm64" },
127
+
128
+ # test case insensitivity
129
+ {"input" : "X86_64" , "expected" : "amd64" },
130
+ {"input" : "AMD64" , "expected" : "amd64" },
131
+ {"input" : "ARM64" , "expected" : "arm64" },
132
+ {"input" : "aARCh64" , "expected" : "arm64" },
133
+
134
+ # unsupported platforms (32-bit, non-intel, non-arm)
135
+ {"input" : "arm" , "expected" : None },
136
+ {"input" : "armv6l" , "expected" : None },
137
+ {"input" : "armv7l" , "expected" : None },
138
+ {"input" : "armv8l" , "expected" : None },
139
+ {"input" : "i386" , "expected" : None },
140
+ {"input" : "i486" , "expected" : None },
141
+ {"input" : "i586" , "expected" : None },
142
+ {"input" : "i686" , "expected" : None },
143
+ {"input" : "ppc" , "expected" : None },
144
+ {"input" : "ppc64" , "expected" : None },
145
+ {"input" : "ppc64le" , "expected" : None },
146
+ {"input" : "sparc" , "expected" : None },
147
+ {"input" : "sparc64" , "expected" : None },
148
+ {"input" : "mips" , "expected" : None },
149
+ {"input" : "mips64" , "expected" : None },
150
+
151
+ # malformed input
152
+ {"input" : "garbage" , "expected" : None },
153
+ {"input" : "213123123123" , "expected" : None },
154
+ {"input" : "" , "expected" : None },
155
+ {"input" : None , "expected" : None },
156
+ ]
157
+
158
+ for each_test in test_cases :
159
+ result = orchestrator .get_sbomgen_arch (each_test ["input" ])
160
+ self .assertEqual (result , each_test ["expected" ])
161
+
119
162
120
163
def read_test_file (file : str ) -> str :
121
164
file_contents = ""
0 commit comments