Path: blob/master/tools/memory-model/scripts/newlitmushist.sh
29266 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.0+2#3# Runs the C-language litmus tests matching the specified criteria4# that do not already have a corresponding .litmus.out file, and does5# not judge the result.6#7# sh newlitmushist.sh8#9# Run from the Linux kernel tools/memory-model directory.10# See scripts/parseargs.sh for list of arguments.11#12# Copyright IBM Corporation, 201813#14# Author: Paul E. McKenney <[email protected]>1516. scripts/parseargs.sh1718T=/tmp/newlitmushist.sh.$$19trap 'rm -rf $T' 020mkdir $T2122if test -d litmus23then24:25else26echo Run scripts/initlitmushist.sh first, need litmus repo.27exit 128fi2930# Create any new directories that have appeared in the github litmus31# repo since the last run.32if test "$LKMM_DESTDIR" != "."33then34find litmus -type d -print |35( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )36fi3738# Create a list of the C-language litmus tests previously run.39( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |40sed -e 's/\.out$//' |41xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already4243# Form full list of litmus tests with no more than the specified44# number of processes (per the --procs argument).45find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C-all46xargs < $T/list-C-all -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short4748# Form list of new tests. Note: This does not handle litmus-test deletion!49sort $T/list-C-already $T/list-C-short | uniq -u > $T/list-C-new5051# Form list of litmus tests that have changed since the last run.52sed < $T/list-C-short -e 's,^.*$,if test & -nt '"$LKMM_DESTDIR"'/&.out; then echo &; fi,' > $T/list-C-script53sh $T/list-C-script > $T/list-C-newer5455# Merge the list of new and of updated litmus tests: These must be (re)run.56sort -u $T/list-C-new $T/list-C-newer > $T/list-C-needed5758scripts/runlitmushist.sh < $T/list-C-needed5960exit 0616263