Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0+
0003 #
0004 # Runs the C-language litmus tests having a maximum number of processes
0005 # to run, defaults to 6.
0006 #
0007 # sh checkghlitmus.sh
0008 #
0009 # Run from the Linux kernel tools/memory-model directory.  See the
0010 # parseargs.sh scripts for arguments.
0011 
0012 . scripts/parseargs.sh
0013 
0014 T=/tmp/checkghlitmus.sh.$$
0015 trap 'rm -rf $T' 0
0016 mkdir $T
0017 
0018 # Clone the repository if it is not already present.
0019 if test -d litmus
0020 then
0021         :
0022 else
0023         git clone https://github.com/paulmckrcu/litmus
0024         ( cd litmus; git checkout origin/master )
0025 fi
0026 
0027 # Create any new directories that have appeared in the github litmus
0028 # repo since the last run.
0029 if test "$LKMM_DESTDIR" != "."
0030 then
0031         find litmus -type d -print |
0032         ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
0033 fi
0034 
0035 # Create a list of the C-language litmus tests previously run.
0036 ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
0037         sed -e 's/\.out$//' |
0038         xargs -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |
0039         xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
0040 
0041 # Create a list of C-language litmus tests with "Result:" commands and
0042 # no more than the specified number of processes.
0043 find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C
0044 xargs < $T/list-C -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result
0045 xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short
0046 
0047 # Form list of tests without corresponding .litmus.out files
0048 sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed
0049 
0050 # Run any needed tests.
0051 if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr
0052 then
0053         errs=
0054 else
0055         errs=1
0056 fi
0057 
0058 sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |
0059         sh > $T/judge.stdout 2> $T/judge.stderr
0060 
0061 if test -n "$errs"
0062 then
0063         cat $T/run.stderr 1>&2
0064 fi
0065 grep '!!!' $T/judge.stdout