62 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0+3#4# Runs the C-language litmus tests matching the specified criteria5# that do not already have a corresponding .litmus.out file, and does6# not judge the result.7#8# sh newlitmushist.sh9#10# Run from the Linux kernel tools/memory-model directory.11# See scripts/parseargs.sh for list of arguments.12#13# Copyright IBM Corporation, 201814#15# Author: Paul E. McKenney <paulmck@linux.ibm.com>16 17. scripts/parseargs.sh18 19T=/tmp/newlitmushist.sh.$$20trap 'rm -rf $T' 021mkdir $T22 23if test -d litmus24then25 :26else27 echo Run scripts/initlitmushist.sh first, need litmus repo.28 exit 129fi30 31# Create any new directories that have appeared in the github litmus32# repo since the last run.33if test "$LKMM_DESTDIR" != "."34then35 find litmus -type d -print |36 ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )37fi38 39# Create a list of the C-language litmus tests previously run.40( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |41 sed -e 's/\.out$//' |42 xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already43 44# Form full list of litmus tests with no more than the specified45# number of processes (per the --procs argument).46find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C-all47xargs < $T/list-C-all -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short48 49# Form list of new tests. Note: This does not handle litmus-test deletion!50sort $T/list-C-already $T/list-C-short | uniq -u > $T/list-C-new51 52# Form list of litmus tests that have changed since the last run.53sed < $T/list-C-short -e 's,^.*$,if test & -nt '"$LKMM_DESTDIR"'/&.out; then echo &; fi,' > $T/list-C-script54sh $T/list-C-script > $T/list-C-newer55 56# Merge the list of new and of updated litmus tests: These must be (re)run.57sort -u $T/list-C-new $T/list-C-newer > $T/list-C-needed58 59scripts/runlitmushist.sh < $T/list-C-needed60 61exit 062