Path: blob/master/tools/memory-model/scripts/checkalllitmus.sh
29266 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.0+2#3# Run herd7 tests on all .litmus files in the litmus-tests directory4# and check each file's result against a "Result:" comment within that5# litmus test. If the verification result does not match that specified6# in the litmus test, this script prints an error message prefixed with7# "^^^". It also outputs verification results to a file whose name is8# that of the specified litmus test, but with ".out" appended.9#10# If the --hw argument is specified, this script translates the .litmus11# C-language file to the specified type of assembly and verifies that.12# But in this case, litmus tests using complex synchronization (such as13# locking, RCU, and SRCU) are cheerfully ignored.14#15# Usage:16# checkalllitmus.sh17#18# Run this in the directory containing the memory model.19#20# This script makes no attempt to run the litmus tests concurrently.21#22# Copyright IBM Corporation, 201823#24# Author: Paul E. McKenney <[email protected]>2526. scripts/parseargs.sh2728litmusdir=litmus-tests29if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"30then31:32else33echo ' --- ' error: $litmusdir is not an accessible directory34exit 25535fi3637# Create any new directories that have appeared in the litmus-tests38# directory since the last run.39if test "$LKMM_DESTDIR" != "."40then41find $litmusdir -type d -print |42( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )43fi4445# Run the script on all the litmus tests in the specified directory46ret=047for i in $litmusdir/*.litmus48do49if test -n "$LKMM_HW_MAP_FILE" && ! scripts/simpletest.sh $i50then51continue52fi53if ! scripts/checklitmus.sh $i54then55ret=156fi57done58if test "$ret" -ne 059then60echo " ^^^ VERIFICATION MISMATCHES" 1>&261else62echo All litmus tests verified as was expected. 1>&263fi64exit $ret656667