mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
b02eb5b096
The https://github.com/paulmckrcu/litmus repository contains a large number of C-language litmus tests that include "Result:" comments predicting the verification result. This commit adds a number of scripts that run tests on these litmus tests: checkghlitmus.sh: Runs all litmus tests in the https://github.com/paulmckrcu/litmus archive that are C-language and that have "Result:" comment lines documenting expected results, comparing the actual results to those expected. Clones the repository if it has not already been cloned into the "tools/memory-model/litmus" directory. initlitmushist.sh Run all litmus tests having no more than the specified number of processes given a specified timeout, recording the results in .litmus.out files. Clones the repository if it has not already been cloned into the "tools/memory-model/litmus" directory. newlitmushist.sh For all new or updated litmus tests having no more than the specified number of processes given a specified timeout, run and record the results in .litmus.out files. checklitmushist.sh Run all litmus tests having .litmus.out files from previous initlitmushist.sh or newlitmushist.sh runs, comparing the herd output to that of the original runs. The above scripts will run litmus tests concurrently, by default with one job per available CPU. Giving any of these scripts the --help argument will cause them to print usage information. This commit also adds a number of helper scripts that are not intended to be invoked from the command line: cmplitmushist.sh: Compare the output of two different runs of the same litmus test. judgelitmus.sh: Compare the output of a litmus test to its "Result:" comment line. parseargs.sh: Parse command-line arguments. runlitmushist.sh: Run the litmus tests whose pathnames are provided one per line on standard input. While in the area, this commit also makes the existing checklitmus.sh and checkalllitmus.sh scripts use parseargs.sh in order to provide a bit of uniformity. In addition, per-litmus-test status output is directed to stdout, while end-of-test summary information is directed to stderr. Finally, the error flag standardizes on "!!!" to assist those familiar with rcutorture output. The defaults for the parseargs.sh arguments may be overridden by using environment variables: LKMM_DESTDIR for --destdir, LKMM_HERD_OPTIONS for --herdoptions, LKMM_JOBS for --jobs, LKMM_PROCS for --procs, and LKMM_TIMEOUT for --timeout. [ paulmck: History-check summary-line changes per Alan Stern feedback. ] Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: akiyks@gmail.com Cc: boqun.feng@gmail.com Cc: dhowells@redhat.com Cc: j.alglave@ucl.ac.uk Cc: linux-arch@vger.kernel.org Cc: luc.maranget@inria.fr Cc: npiggin@gmail.com Cc: parri.andrea@gmail.com Cc: stern@rowland.harvard.edu Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/20181203230451.28921-2-paulmck@linux.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
62 lines
1.8 KiB
Bash
62 lines
1.8 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
# Runs the C-language litmus tests matching the specified criteria
|
|
# that do not already have a corresponding .litmus.out file, and does
|
|
# not judge the result.
|
|
#
|
|
# sh newlitmushist.sh
|
|
#
|
|
# Run from the Linux kernel tools/memory-model directory.
|
|
# See scripts/parseargs.sh for list of arguments.
|
|
#
|
|
# Copyright IBM Corporation, 2018
|
|
#
|
|
# Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
|
|
|
|
. scripts/parseargs.sh
|
|
|
|
T=/tmp/newlitmushist.sh.$$
|
|
trap 'rm -rf $T' 0
|
|
mkdir $T
|
|
|
|
if test -d litmus
|
|
then
|
|
:
|
|
else
|
|
echo Run scripts/initlitmushist.sh first, need litmus repo.
|
|
exit 1
|
|
fi
|
|
|
|
# Create any new directories that have appeared in the github litmus
|
|
# repo since the last run.
|
|
if test "$LKMM_DESTDIR" != "."
|
|
then
|
|
find litmus -type d -print |
|
|
( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
|
|
fi
|
|
|
|
# Create a list of the C-language litmus tests previously run.
|
|
( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
|
|
sed -e 's/\.out$//' |
|
|
xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
|
|
|
|
# Form full list of litmus tests with no more than the specified
|
|
# number of processes (per the --procs argument).
|
|
find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C-all
|
|
xargs < $T/list-C-all -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
|
|
|
|
# Form list of new tests. Note: This does not handle litmus-test deletion!
|
|
sort $T/list-C-already $T/list-C-short | uniq -u > $T/list-C-new
|
|
|
|
# Form list of litmus tests that have changed since the last run.
|
|
sed < $T/list-C-short -e 's,^.*$,if test & -nt '"$LKMM_DESTDIR"'/&.out; then echo &; fi,' > $T/list-C-script
|
|
sh $T/list-C-script > $T/list-C-newer
|
|
|
|
# Merge the list of new and of updated litmus tests: These must be (re)run.
|
|
sort -u $T/list-C-new $T/list-C-newer > $T/list-C-needed
|
|
|
|
scripts/runlitmushist.sh < $T/list-C-needed
|
|
|
|
exit 0
|