Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0+
0003 #
0004 # Runs the C-language litmus tests matching the specified criteria
0005 # that do not already have a corresponding .litmus.out file, and does
0006 # not judge the result.
0007 #
0008 # sh newlitmushist.sh
0009 #
0010 # Run from the Linux kernel tools/memory-model directory.
0011 # See scripts/parseargs.sh for list of arguments.
0012 #
0013 # Copyright IBM Corporation, 2018
0014 #
0015 # Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
0016 
0017 . scripts/parseargs.sh
0018 
0019 T=/tmp/newlitmushist.sh.$$
0020 trap 'rm -rf $T' 0
0021 mkdir $T
0022 
0023 if test -d litmus
0024 then
0025         :
0026 else
0027         echo Run scripts/initlitmushist.sh first, need litmus repo.
0028         exit 1
0029 fi
0030 
0031 # Create any new directories that have appeared in the github litmus
0032 # repo since the last run.
0033 if test "$LKMM_DESTDIR" != "."
0034 then
0035         find litmus -type d -print |
0036         ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
0037 fi
0038 
0039 # Create a list of the C-language litmus tests previously run.
0040 ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
0041         sed -e 's/\.out$//' |
0042         xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
0043 
0044 # Form full list of litmus tests with no more than the specified
0045 # number of processes (per the --procs argument).
0046 find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C-all
0047 xargs < $T/list-C-all -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
0048 
0049 # Form list of new tests.  Note: This does not handle litmus-test deletion!
0050 sort $T/list-C-already $T/list-C-short | uniq -u > $T/list-C-new
0051 
0052 # Form list of litmus tests that have changed since the last run.
0053 sed < $T/list-C-short -e 's,^.*$,if test & -nt '"$LKMM_DESTDIR"'/&.out; then echo &; fi,' > $T/list-C-script
0054 sh $T/list-C-script > $T/list-C-newer
0055 
0056 # Merge the list of new and of updated litmus tests: These must be (re)run.
0057 sort -u $T/list-C-new $T/list-C-newer > $T/list-C-needed
0058 
0059 scripts/runlitmushist.sh < $T/list-C-needed
0060 
0061 exit 0