cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

checkghlitmus.sh (1858B)


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