diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /dtc/tests/dtc-checkfails.sh | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'dtc/tests/dtc-checkfails.sh')
-rwxr-xr-x | dtc/tests/dtc-checkfails.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dtc/tests/dtc-checkfails.sh b/dtc/tests/dtc-checkfails.sh new file mode 100755 index 000000000..4fd9691a2 --- /dev/null +++ b/dtc/tests/dtc-checkfails.sh @@ -0,0 +1,45 @@ +#! /bin/sh + +SRCDIR=`dirname "$0"` +. "$SRCDIR/testutils.sh" + +for x; do + shift + if [ "$x" = "-n" ]; then + for x; do + shift + if [ "$x" = "--" ]; then + break; + fi + NOCHECKS="$NOCHECKS $x" + done + break; + fi + if [ "$x" = "--" ]; then + break; + fi + YESCHECKS="$YESCHECKS $x" +done + +LOG=tmp.log.$$ +rm -f $LOG +trap "rm -f $LOG" 0 + +verbose_run_log "$LOG" $VALGRIND "$DTC" -o /dev/null "$@" +ret="$?" + +FAIL_IF_SIGNAL $ret + +for c in $YESCHECKS; do + if ! grep -E "(ERROR|Warning) \($c\):" $LOG > /dev/null; then + FAIL "Failed to trigger check \"$c\"" + fi +done + +for c in $NOCHECKS; do + if grep -E "(ERROR|Warning) \($c\):" $LOG > /dev/null; then + FAIL "Incorrectly triggered check \"$c\"" + fi +done + +PASS |