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.ibm.com>
20 T=/tmp/runlitmushist.sh.$$
28 echo Directory \"litmus\" missing, aborting run.
32 # Prefixes for per-CPU scripts
33 for ((i=0;i<$LKMM_JOBS;i++))
36 cat << '___EOF___' >> $T/$i.sh
38 if scripts/runlitmus.sh $1
40 if ! grep -q '^Observation ' $LKMM_DESTDIR/$1$2.out
42 echo ' !!! Herd failed, no Observation:' $1
46 if test "$exitcode" -eq 124
49 elif test "$exitcode" -eq 253
53 exitmsg="failed, exit code $exitcode"
57 echo ' !!! Herd' ${exitmsg}: $1
64 awk -v q="'" -v b='\\' '
66 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
68 awk -v dq='"' -v hwfnseg="$hwfnseg" -v ncpu="$LKMM_JOBS" -v t="$T" '
70 print "if test -z " dq hwfnseg dq " || scripts/simpletest.sh " dq $2 dq
72 print "\techo runtest " dq $2 dq " " hwfnseg " >> " t "/" NR % ncpu ".sh";
77 for (i = 0; i < ncpu; i++) {
78 print "sh " t "/" i ".sh > " t "/" i ".sh.out 2>&1 &";
84 if grep -q '!!!' $T/*.sh.out
86 echo ' ---' Summary: 1>&2
87 grep '!!!' $T/*.sh.out 1>&2
88 nfail="`grep '!!!' $T/*.sh.out | wc -l`"
89 echo 'Number of failed herd7 runs (e.g., timeout): ' $nfail 1>&2
92 echo All runs completed successfully. 1>&2