Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0+
0003 #
0004 # Reruns the C-language litmus tests previously run that match the
0005 # specified criteria, and compares the result to that of the previous
0006 # runs from initlitmushist.sh and/or newlitmushist.sh.
0007 #
0008 # sh checklitmushist.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/checklitmushist.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 the results directory and populate it with subdirectories.
0032 # The initial output is created here to avoid clobbering the output
0033 # generated earlier.
0034 mkdir $T/results
0035 find litmus -type d -print | ( cd $T/results; sed -e 's/^/mkdir -p /' | sh )
0036 
0037 # Create the list of litmus tests already run, then remove those that
0038 # are excluded by this run's --procs argument.
0039 ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
0040         sed -e 's/\.out$//' |
0041         xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
0042 xargs < $T/list-C-already -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
0043 
0044 # Redirect output, run tests, then restore destination directory.
0045 destdir="$LKMM_DESTDIR"
0046 LKMM_DESTDIR=$T/results; export LKMM_DESTDIR
0047 scripts/runlitmushist.sh < $T/list-C-short > $T/runlitmushist.sh.out 2>&1
0048 LKMM_DESTDIR="$destdir"; export LKMM_DESTDIR
0049 
0050 # Move the newly generated .litmus.out files to .litmus.out.new files
0051 # in the destination directory.
0052 cdir=`pwd`
0053 ddir=`awk -v c="$cdir" -v d="$LKMM_DESTDIR" \
0054         'END { if (d ~ /^\//) print d; else print c "/" d; }' < /dev/null`
0055 ( cd $T/results; find litmus -type f -name '*.litmus.out' -print |
0056   sed -e 's,^.*$,cp & '"$ddir"'/&.new,' | sh )
0057 
0058 sed < $T/list-C-short -e 's,^,'"$LKMM_DESTDIR/"',' |
0059         sh scripts/cmplitmushist.sh
0060 exit $?