2 # SPDX-License-Identifier: GPL-2.0+
4 # Given a .litmus test and the corresponding .litmus.out file, check
5 # the .litmus.out file against the "Result:" comment to judge whether
6 # the test ran correctly.
9 # judgelitmus.sh file.litmus
11 # Run this in the directory containing the memory model, specifying the
12 # pathname of the litmus test to check.
14 # Copyright IBM Corporation, 2018
16 # Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
20 if test -f "$litmus" -a -r "$litmus"
24 echo ' --- ' error
: \"$litmus\" is not a readable
file
27 if test -f "$LKMM_DESTDIR/$litmus".out
-a -r "$LKMM_DESTDIR/$litmus".out
31 echo ' --- ' error
: \"$LKMM_DESTDIR/$litmus\".out is not a readable
file
34 if grep -q '^ \* Result: ' $litmus
36 outcome
=`grep -m 1 '^ \* Result: ' $litmus | awk '{ print $3 }'`
41 grep '^Observation' $LKMM_DESTDIR/$litmus.out
42 if grep -q '^Observation' $LKMM_DESTDIR/$litmus.out
46 echo ' !!! Verification error' $litmus
47 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
49 echo ' !!! Verification error' >> $LKMM_DESTDIR/$litmus.out
2>&1
53 if test "$outcome" = DEADLOCK
55 if grep '^Observation' $LKMM_DESTDIR/$litmus.out |
grep -q 'Never 0 0$'
59 echo " !!! Unexpected non-$outcome verification" $litmus
60 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
62 echo " !!! Unexpected non-$outcome verification" >> $LKMM_DESTDIR/$litmus.out
2>&1
66 elif grep '^Observation' $LKMM_DESTDIR/$litmus.out |
grep -q $outcome ||
test "$outcome" = Maybe
70 echo " !!! Unexpected non-$outcome verification" $litmus
71 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
73 echo " !!! Unexpected non-$outcome verification" >> $LKMM_DESTDIR/$litmus.out
2>&1
77 tail -2 $LKMM_DESTDIR/$litmus.out |
head -1