Skip to content

Commit 58e7f5b

Browse files
matttbekuba-moo
authored andcommitted
tests: error rc in case of errors and warnings
Before, in case of new errors and new warnings, the script was exiting with rc=250 (warning) instead of rc=1 (error). This is fixed simply by looking at the warnings counter before the errors one, so rc=1 will be set last. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 3a489d4 commit 58e7f5b

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

tests/patch/pylint/pylint.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ current_w=$(grep -i -c ": [WC][0-9][0-9][0-9][0-9]: " $tmpfile_n)
4848

4949
echo "Errors before: $incumbent (+warn: $incumbent_w) this patch: $current (+warn: $current_w)" >&$DESC_FD
5050

51+
if [ $current_w -gt $incumbent_w ]; then
52+
echo "New warnings added" 1>&2
53+
54+
rc=250
55+
fi
56+
5157
if [ $current -gt $incumbent ]; then
5258
echo "New errors added" 1>&2
5359
diff -U 0 $tmpfile_o $tmpfile_n 1>&2
5460

5561
rc=1
5662
fi
5763

58-
if [ $current_w -gt $incumbent_w ]; then
59-
echo "New warnings added" 1>&2
60-
61-
rc=250
62-
fi
63-
6464
rm "$tmpfile_o" "$tmpfile_n"
6565

6666
exit $rc

tests/patch/shellcheck/shellcheck.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ done
9090

9191
echo "Errors before: $incumbent (+warn: $incumbent_w) this patch: $current (+warn: $current_w)" >&$DESC_FD
9292

93+
if [ $current_w -gt $incumbent_w ]; then
94+
echo "New warnings added" 1>&2
95+
96+
rc=250
97+
fi
98+
9399
if [ $current -gt $incumbent ]; then
94100
echo "New errors added" 1>&2
95101
diff -U 0 $tmpfile_o $tmpfile_n 1>&2
96102

97103
rc=1
98104
fi
99105

100-
if [ $current_w -gt $incumbent_w ]; then
101-
echo "New warnings added" 1>&2
102-
103-
rc=250
104-
fi
105-
106106
rm "$tmpfile_o"* "$tmpfile_n"*
107107

108108
exit $rc

tests/patch/yamllint/yamllint.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ current_w=$(grep -i -c " warning " $tmpfile_n)
4848

4949
echo "Errors before: $incumbent (+warn: $incumbent_w) this patch: $current (+warn: $current_w)" >&$DESC_FD
5050

51+
if [ $current_w -gt $incumbent_w ]; then
52+
echo "New warnings added" 1>&2
53+
54+
rc=250
55+
fi
56+
5157
if [ $current -gt $incumbent ]; then
5258
echo "New errors added" 1>&2
5359
diff -U 0 $tmpfile_o $tmpfile_n 1>&2
5460

5561
rc=1
5662
fi
5763

58-
if [ $current_w -gt $incumbent_w ]; then
59-
echo "New warnings added" 1>&2
60-
61-
rc=250
62-
fi
63-
6464
rm "$tmpfile_o" "$tmpfile_n"
6565

6666
exit $rc

0 commit comments

Comments
 (0)