67 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0+3#4# Runs the C-language litmus tests having a maximum number of processes5# to run, defaults to 6.6#7# sh checkghlitmus.sh8#9# Run from the Linux kernel tools/memory-model directory. See the10# parseargs.sh scripts for arguments.11 12. scripts/parseargs.sh13. scripts/hwfnseg.sh14 15T=/tmp/checkghlitmus.sh.$$16trap 'rm -rf $T' 017mkdir $T18 19# Clone the repository if it is not already present.20if test -d litmus21then22 :23else24 git clone https://github.com/paulmckrcu/litmus25 ( cd litmus; git checkout origin/master )26fi27 28# Create any new directories that have appeared in the github litmus29# repo since the last run.30if test "$LKMM_DESTDIR" != "."31then32 find litmus -type d -print |33 ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )34fi35 36# Create a list of the specified litmus tests previously run.37( cd $LKMM_DESTDIR; find litmus -name "*.litmus${hwfnseg}.out" -print ) |38 sed -e "s/${hwfnseg}"'\.out$//' |39 xargs -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |40 xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already41 42# Create a list of C-language litmus tests with "Result:" commands and43# no more than the specified number of processes.44find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C45xargs < $T/list-C -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result46xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short47 48# Form list of tests without corresponding .out files49sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed50 51# Run any needed tests.52if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr53then54 errs=55else56 errs=157fi58 59sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |60 sh > $T/judge.stdout 2> $T/judge.stderr61 62if test -n "$errs"63then64 cat $T/run.stderr 1>&265fi66grep '!!!' $T/judge.stdout67