summaryrefslogtreecommitdiff
path: root/scripts/sbom/tests
AgeCommit message (Collapse)Author
2026-07-31scripts/sbom: catch ValueError from malformed shell quotingCarlos Sampaio Ribeiro
parse_inputs_from_commands() only caught CmdParsingError and IndexError when dispatching to command parsers, but several parsers call shlex.split() internally, which raises ValueError on malformed shell quoting (e.g. an unterminated quote). This exception was not caught, so a single malformed build command would abort SBOM generation entirely, even with fail_on_unknown_build_command=False, defeating the purpose of tolerant mode. The issue was found while reviewing the exception handling around the saved-command parser after running its existing tests. It can be reproduced with: parse_inputs_from_commands('gcc "unterminated', fail_on_unknown_build_command=False) Catch ValueError alongside CmdParsingError and IndexError so such commands are logged as a warning/error and skipped instead of aborting the whole run. Add tests covering malformed shell quoting and a missing positional argument. Signed-off-by: Carlos Sampaio Ribeiro <otakurack@gmail.com> Link: https://patch.msgid.link/20260719081859.1001-1-otakurack@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-22scripts/sbom: add unit tests for SPDX-License-Identifier parsingLuis Augenstein
Verify that SPDX-License-Identifier headers at the top of source files are parsed correctly. Assisted-by: Cursor:claude-sonnet-4-5 Assisted-by: OpenCode:GLM-4-7 Co-developed-by: Maximilian Huber <maximilian.huber@tngtech.com> Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com> Signed-off-by: Luis Augenstein <luis.augenstein@tngtech.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-22scripts/sbom: add unit tests for command parsersLuis Augenstein
Add unit tests to verify that command parsers correctly extract input files from build commands. Assisted-by: Cursor:claude-sonnet-4-5 Assisted-by: OpenCode:GLM-4-7 Co-developed-by: Maximilian Huber <maximilian.huber@tngtech.com> Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com> Signed-off-by: Luis Augenstein <luis.augenstein@tngtech.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>