Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0+
0003 #
0004 # Run herd7 tests on all .litmus files in the litmus-tests directory
0005 # and check each file's result against a "Result:" comment within that
0006 # litmus test.  If the verification result does not match that specified
0007 # in the litmus test, this script prints an error message prefixed with
0008 # "^^^".  It also outputs verification results to a file whose name is
0009 # that of the specified litmus test, but with ".out" appended.
0010 #
0011 # Usage:
0012 #       checkalllitmus.sh
0013 #
0014 # Run this in the directory containing the memory model.
0015 #
0016 # This script makes no attempt to run the litmus tests concurrently.
0017 #
0018 # Copyright IBM Corporation, 2018
0019 #
0020 # Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
0021 
0022 . scripts/parseargs.sh
0023 
0024 litmusdir=litmus-tests
0025 if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"
0026 then
0027         :
0028 else
0029         echo ' --- ' error: $litmusdir is not an accessible directory
0030         exit 255
0031 fi
0032 
0033 # Create any new directories that have appeared in the github litmus
0034 # repo since the last run.
0035 if test "$LKMM_DESTDIR" != "."
0036 then
0037         find $litmusdir -type d -print |
0038         ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
0039 fi
0040 
0041 # Find the checklitmus script.  If it is not where we expect it, then
0042 # assume that the caller has the PATH environment variable set
0043 # appropriately.
0044 if test -x scripts/checklitmus.sh
0045 then
0046         clscript=scripts/checklitmus.sh
0047 else
0048         clscript=checklitmus.sh
0049 fi
0050 
0051 # Run the script on all the litmus tests in the specified directory
0052 ret=0
0053 for i in $litmusdir/*.litmus
0054 do
0055         if ! $clscript $i
0056         then
0057                 ret=1
0058         fi
0059 done
0060 if test "$ret" -ne 0
0061 then
0062         echo " ^^^ VERIFICATION MISMATCHES" 1>&2
0063 else
0064         echo All litmus tests verified as was expected. 1>&2
0065 fi
0066 exit $ret