Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: correcting test_scan_multiline with respect to rpm parser #3870

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cve_bin_tool/helper_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ def extract_and_parse_file(self, filename: str) -> list[str] | None:

# if the file is ELF binary file, don't try to parse its filename or extract it
if self.version_scanner.is_executable(filename)[0]:
return self.parse_execfile(filename)
matches = self.parse_execfile(filename)
if not self.multiline_pattern:
self.version_pattern = [
x for x in self.version_pattern if "\\n" not in x
]
return matches
else:
self.parse_filename(filename)

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_scan_files_multiline(self, capfd):
scan_files(args)
out, _ = capfd.readouterr()
out = out.split("VERSION_PATTERNS")[1]
assert "(?:(?:\\r?\\n.*?)*)" in out
assert "(?:(?:\\r?\\n.*?)*)" not in out

# @pytest.mark.parametrize("filename", [
# "bash-4.2.46-34.el7.x86_64.abc" # unsupported file type
Expand Down
Loading