66 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Run herd7 tests on all .litmus files in the litmus-tests directory5# and check each file's result against a "Result:" comment within that6# litmus test. If the verification result does not match that specified7# in the litmus test, this script prints an error message prefixed with8# "^^^". It also outputs verification results to a file whose name is9# that of the specified litmus test, but with ".out" appended.10#11# If the --hw argument is specified, this script translates the .litmus12# C-language file to the specified type of assembly and verifies that.13# But in this case, litmus tests using complex synchronization (such as14# locking, RCU, and SRCU) are cheerfully ignored.15#16# Usage:17# checkalllitmus.sh18#19# Run this in the directory containing the memory model.20#21# This script makes no attempt to run the litmus tests concurrently.22#23# Copyright IBM Corporation, 201824#25# Author: Paul E. McKenney <paulmck@linux.ibm.com>26 27. scripts/parseargs.sh28 29litmusdir=litmus-tests30if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"31then32 :33else34 echo ' --- ' error: $litmusdir is not an accessible directory35 exit 25536fi37 38# Create any new directories that have appeared in the litmus-tests39# directory since the last run.40if test "$LKMM_DESTDIR" != "."41then42 find $litmusdir -type d -print |43 ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )44fi45 46# Run the script on all the litmus tests in the specified directory47ret=048for i in $litmusdir/*.litmus49do50 if test -n "$LKMM_HW_MAP_FILE" && ! scripts/simpletest.sh $i51 then52 continue53 fi54 if ! scripts/checklitmus.sh $i55 then56 ret=157 fi58done59if test "$ret" -ne 060then61 echo " ^^^ VERIFICATION MISMATCHES" 1>&262else63 echo All litmus tests verified as was expected. 1>&264fi65exit $ret66