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

Treat scriptlet check problems as warnings, not errors #40

Merged
merged 1 commit into from
Jan 29, 2024
Merged
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: 4 additions & 3 deletions mtps-pkg-test
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
: "${PROG:=${0##*/}}"

EXIT_CODE_SKIP=7
EXIT_CODE_WARN=8

# Source `mtps-setup' from $PATH
if command -v "mtps-setup" >/dev/null; then source "mtps-setup"; fi
Expand Down Expand Up @@ -121,7 +122,7 @@ run_with_scriptlet_check() {
local ret=${PIPESTATUS[0]}
cmd_output_parts_prefix="cmd-output-part"
if [ "$ret" -eq 0 ]; then
# The script is running with globbing off, but it's useful here, so let's enabled it temporarily
# The script is running with globbing off, but it's useful here, so let's enable it temporarily
set +f
rm -f "$cmd_output_parts_prefix"*
# Split the output into separate files on the lines containing the "Running scriptlet: " string
Expand Down Expand Up @@ -153,8 +154,8 @@ run_with_scriptlet_check() {
# Note: we ignore cases where there is a leading or trailing dash (-),
# the reason is that the keyword ("error" for example) can appear in package names.
# See how the regexp works (and play with it!): https://regex101.com/r/Yws0tT/1
grep -P -i -q '(?<![-a-z])error|failure|failed|warning(?![-a-z])' "$output_part" && ret=1
if [ "$ret" -eq 1 ]; then
grep -P -i -q '(?<![-a-z])error|failure|failed|warning(?![-a-z])' "$output_part" && ret=$EXIT_CODE_WARN
if [ "$ret" -eq $EXIT_CODE_WARN ]; then
echo
echo
echo "***"
Expand Down
3 changes: 3 additions & 0 deletions mtps-run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
: "${PROG:=${0##*/}}"

EXIT_CODE_SKIP=7
EXIT_CODE_WARN=8

# Source `mtps-setup' from $PATH
if command -v "mtps-setup" >/dev/null; then source "mtps-setup"; fi
Expand Down Expand Up @@ -209,6 +210,8 @@ for nevra in $nevras_in_repo; do
#yum -y history rollback "$START" || echo "Ignoring rollback error: RHBZ#1614346"
if [ "$test_status" -eq $EXIT_CODE_SKIP ]; then
new_logfname="$(dirname "$logfname")/SKIP-$(basename "$logfname")"
elif [ "$test_status" -eq $EXIT_CODE_WARN ]; then
new_logfname="$(dirname "$logfname")/WARN-$(basename "$logfname")"
elif [ "$test_status" -ne 0 ]; then
ret=1
if [ -n "$CRITICAL" ]; then
Expand Down