Path: blob/master/tools/memory-model/scripts/checkghlitmus.sh
29266 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.0+2#3# Runs the C-language litmus tests having a maximum number of processes4# to run, defaults to 6.5#6# sh checkghlitmus.sh7#8# Run from the Linux kernel tools/memory-model directory. See the9# parseargs.sh scripts for arguments.1011. scripts/parseargs.sh12. scripts/hwfnseg.sh1314T=/tmp/checkghlitmus.sh.$$15trap 'rm -rf $T' 016mkdir $T1718# Clone the repository if it is not already present.19if test -d litmus20then21:22else23git clone https://github.com/paulmckrcu/litmus24( cd litmus; git checkout origin/master )25fi2627# Create any new directories that have appeared in the github litmus28# repo since the last run.29if test "$LKMM_DESTDIR" != "."30then31find litmus -type d -print |32( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )33fi3435# Create a list of the specified litmus tests previously run.36( cd $LKMM_DESTDIR; find litmus -name "*.litmus${hwfnseg}.out" -print ) |37sed -e "s/${hwfnseg}"'\.out$//' |38xargs -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |39xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already4041# Create a list of C-language litmus tests with "Result:" commands and42# no more than the specified number of processes.43find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C44xargs < $T/list-C -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result45xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short4647# Form list of tests without corresponding .out files48sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed4950# Run any needed tests.51if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr52then53errs=54else55errs=156fi5758sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |59sh > $T/judge.stdout 2> $T/judge.stderr6061if test -n "$errs"62then63cat $T/run.stderr 1>&264fi65grep '!!!' $T/judge.stdout666768