Skip to content

Commit 079dfd0

Browse files
terrikopdxjohnny
authored andcommitted
Fix final_log to check only the skip line, switch to scanning only a single binary for test speed
1 parent 0e08c41 commit 079dfd0

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

test/test_cli.py

+21-7
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def test_skips(self):
109109
"""Tests the skips option"""
110110

111111
logger = logging.getLogger()
112-
test_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "binaries")
112+
test_path = os.path.join(
113+
os.path.abspath(os.path.dirname(__file__)),
114+
"binaries",
115+
"test-sqlite-3.12.2.out",
116+
)
113117

114118
skip_checkers = ["systemd", "xerces", "xml2", "kerberos"]
115119
include_checkers = ["expat", "libgcrypt", "openssl", "sqlite"]
@@ -118,21 +122,31 @@ def test_skips(self):
118122
main(["cve-bin-tool", test_path, "-s", ",".join(skip_checkers)])
119123

120124
# The final log has all the checkers detected
121-
final_log = cm.output[-1]
125+
final_log = cm.output[1]
122126
for checker in skip_checkers:
123-
self.assertTrue(checker not in final_log)
127+
self.assertTrue(
128+
checker not in final_log, "found skipped checker {}".format(checker)
129+
)
124130

125131
for checker in include_checkers:
126-
self.assertTrue(checker in final_log)
132+
self.assertTrue(
133+
checker in final_log,
134+
"could not find expected checker {}".format(checker),
135+
)
127136

128137
# swap skip_checkers and include_checkers
129138
include_checkers, skip_checkers = skip_checkers, include_checkers
130139
with self.assertLogs(logger, logging.INFO) as cm:
131140
main(["cve-bin-tool", test_path, "-s", ",".join(skip_checkers)])
132141

133-
final_log = cm.output[-1]
142+
final_log = cm.output[1]
134143
for checker in skip_checkers:
135-
self.assertTrue(checker not in final_log)
144+
self.assertTrue(
145+
checker not in final_log, "found skipped checker {}".format(checker)
146+
)
136147

137148
for checker in include_checkers:
138-
self.assertTrue(checker in final_log)
149+
self.assertTrue(
150+
checker in final_log,
151+
"could not find expected checker {}".format(checker),
152+
)

0 commit comments

Comments
 (0)