2 # SPDX-License-Identifier: GPL-2.0+
4 # Runs the C-language litmus tests specified on standard input, using up
5 # to the specified number of CPUs (defaulting to all of them) and placing
6 # the results in the specified directory (defaulting to the same place
7 # the litmus test came from).
11 # Run from the Linux kernel tools/memory-model directory.
12 # This script uses environment variables produced by parseargs.sh.
14 # Copyright IBM Corporation, 2018
16 # Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
18 T
=/tmp
/runlitmushist.sh.$$
26 echo Directory
\"litmus
\" missing
, aborting run.
30 # Prefixes for per-CPU scripts
31 for ((i
=0;i
<$LKMM_JOBS;i
++))
33 echo dir
="$LKMM_DESTDIR" > $T/$i.sh
35 echo herdoptions
=\"$LKMM_HERD_OPTIONS\" >> $T/$i.sh
36 cat << '___EOF___' >> $T/$i.sh
38 echo ' ... ' /usr
/bin
/time $LKMM_TIMEOUT_CMD herd7
$herdoptions $1 '>' $dir/$1.out
'2>&1'
39 if /usr
/bin
/time $LKMM_TIMEOUT_CMD herd7
$herdoptions $1 > $dir/$1.out
2>&1
41 if ! grep -q '^Observation ' $dir/$1.out
43 echo ' !!! Herd failed, no Observation:' $1
47 if test "$exitcode" -eq 124
51 exitmsg
="failed, exit code $exitcode"
53 echo ' !!! Herd' ${exitmsg}: $1
59 awk -v q
="'" -v b
='\\' '
61 print "echo `grep " q "^P[0-9]" b "+(" q " " $0 " | tail -1 | sed -e " q "s/^P" b "([0-9]" b "+" b ")(.*$/" b "1/" q "` " $0
64 awk -v ncpu
=$LKMM_JOBS -v t
=$T '
66 print "runtest " $2 >> t "/" NR % ncpu ".sh";
70 for (i = 0; i < ncpu; i++) {
71 print "sh " t "/" i ".sh > " t "/" i ".sh.out 2>&1 &";
77 if grep -q '!!!' $T/*.sh.out
79 echo ' ---' Summary
: 1>&2
80 grep '!!!' $T/*.sh.out
1>&2
81 nfail
="`grep '!!!' $T/*.sh.out | wc -l`"
82 echo 'Number of failed herd7 runs (e.g., timeout): ' $nfail 1>&2
85 echo All runs completed successfully.
1>&2