Path: blob/master/tools/memory-model/scripts/checklitmushist.sh
29266 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.0+2#3# Reruns the C-language litmus tests previously run that match the4# specified criteria, and compares the result to that of the previous5# runs from initlitmushist.sh and/or newlitmushist.sh.6#7# sh checklitmushist.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/checklitmushist.sh.$$19trap 'rm -rf $T' 020mkdir $T2122if test -d litmus23then24:25else26echo Run scripts/initlitmushist.sh first, need litmus repo.27exit 128fi2930# Create the results directory and populate it with subdirectories.31# The initial output is created here to avoid clobbering the output32# generated earlier.33mkdir $T/results34find litmus -type d -print | ( cd $T/results; sed -e 's/^/mkdir -p /' | sh )3536# Create the list of litmus tests already run, then remove those that37# are excluded by this run's --procs argument.38( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |39sed -e 's/\.out$//' |40xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already41xargs < $T/list-C-already -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short4243# Redirect output, run tests, then restore destination directory.44destdir="$LKMM_DESTDIR"45LKMM_DESTDIR=$T/results; export LKMM_DESTDIR46scripts/runlitmushist.sh < $T/list-C-short > $T/runlitmushist.sh.out 2>&147LKMM_DESTDIR="$destdir"; export LKMM_DESTDIR4849# Move the newly generated .litmus.out files to .litmus.out.new files50# in the destination directory.51cdir=`pwd`52ddir=`awk -v c="$cdir" -v d="$LKMM_DESTDIR" \53'END { if (d ~ /^\//) print d; else print c "/" d; }' < /dev/null`54( cd $T/results; find litmus -type f -name '*.litmus.out' -print |55sed -e 's,^.*$,cp & '"$ddir"'/&.new,' | sh )5657sed < $T/list-C-short -e 's,^,'"$LKMM_DESTDIR/"',' |58sh scripts/cmplitmushist.sh59exit $?606162