dm writecache: fix incorrect flush sequence when doing SSD mode commit
[linux/fpc-iii.git] / tools / memory-model / scripts / judgelitmus.sh
blob0cc63875e395d06fe890c0f711e748a6226f25ea
1 #!/bin/sh
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.
8 # Usage:
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>
18 litmus=$1
20 if test -f "$litmus" -a -r "$litmus"
21 then
23 else
24 echo ' --- ' error: \"$litmus\" is not a readable file
25 exit 255
27 if test -f "$LKMM_DESTDIR/$litmus".out -a -r "$LKMM_DESTDIR/$litmus".out
28 then
30 else
31 echo ' --- ' error: \"$LKMM_DESTDIR/$litmus\".out is not a readable file
32 exit 255
34 if grep -q '^ \* Result: ' $litmus
35 then
36 outcome=`grep -m 1 '^ \* Result: ' $litmus | awk '{ print $3 }'`
37 else
38 outcome=specified
41 grep '^Observation' $LKMM_DESTDIR/$litmus.out
42 if grep -q '^Observation' $LKMM_DESTDIR/$litmus.out
43 then
45 else
46 echo ' !!! Verification error' $litmus
47 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
48 then
49 echo ' !!! Verification error' >> $LKMM_DESTDIR/$litmus.out 2>&1
51 exit 255
53 if test "$outcome" = DEADLOCK
54 then
55 if grep '^Observation' $LKMM_DESTDIR/$litmus.out | grep -q 'Never 0 0$'
56 then
57 ret=0
58 else
59 echo " !!! Unexpected non-$outcome verification" $litmus
60 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
61 then
62 echo " !!! Unexpected non-$outcome verification" >> $LKMM_DESTDIR/$litmus.out 2>&1
64 ret=1
66 elif grep '^Observation' $LKMM_DESTDIR/$litmus.out | grep -q $outcome || test "$outcome" = Maybe
67 then
68 ret=0
69 else
70 echo " !!! Unexpected non-$outcome verification" $litmus
71 if ! grep -q '!!!' $LKMM_DESTDIR/$litmus.out
72 then
73 echo " !!! Unexpected non-$outcome verification" >> $LKMM_DESTDIR/$litmus.out 2>&1
75 ret=1
77 tail -2 $LKMM_DESTDIR/$litmus.out | head -1
78 exit $ret