Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / memory-model / scripts / checkghlitmus.sh
blob6589fbb6f6538339c2a126288f75b8b476a3f0c3
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0+
4 # Runs the C-language litmus tests having a maximum number of processes
5 # to run, defaults to 6.
7 # sh checkghlitmus.sh
9 # Run from the Linux kernel tools/memory-model directory. See the
10 # parseargs.sh scripts for arguments.
12 . scripts/parseargs.sh
14 T=/tmp/checkghlitmus.sh.$$
15 trap 'rm -rf $T' 0
16 mkdir $T
18 # Clone the repository if it is not already present.
19 if test -d litmus
20 then
22 else
23 git clone https://github.com/paulmckrcu/litmus
24 ( cd litmus; git checkout origin/master )
27 # Create any new directories that have appeared in the github litmus
28 # repo since the last run.
29 if test "$LKMM_DESTDIR" != "."
30 then
31 find litmus -type d -print |
32 ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
35 # Create a list of the C-language litmus tests previously run.
36 ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
37 sed -e 's/\.out$//' |
38 xargs -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |
39 xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
41 # Create a list of C-language litmus tests with "Result:" commands and
42 # no more than the specified number of processes.
43 find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C
44 xargs < $T/list-C -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result
45 xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short
47 # Form list of tests without corresponding .litmus.out files
48 sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed
50 # Run any needed tests.
51 if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr
52 then
53 errs=
54 else
55 errs=1
58 sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |
59 sh > $T/judge.stdout 2> $T/judge.stderr
61 if test -n "$errs"
62 then
63 cat $T/run.stderr 1>&2
65 grep '!!!' $T/judge.stdout