Skip to content

Commit

Permalink
Treat scriptlet check problems as warnings, not errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpopelka committed Jan 29, 2024
1 parent a54b81d commit 09dad40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 09dad40

Please sign in to comment.