1*4882a593Smuzhiyun#!/bin/sh 2*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0+ 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# Run herd7 tests on all .litmus files in the litmus-tests directory 5*4882a593Smuzhiyun# and check each file's result against a "Result:" comment within that 6*4882a593Smuzhiyun# litmus test. If the verification result does not match that specified 7*4882a593Smuzhiyun# in the litmus test, this script prints an error message prefixed with 8*4882a593Smuzhiyun# "^^^". It also outputs verification results to a file whose name is 9*4882a593Smuzhiyun# that of the specified litmus test, but with ".out" appended. 10*4882a593Smuzhiyun# 11*4882a593Smuzhiyun# Usage: 12*4882a593Smuzhiyun# checkalllitmus.sh 13*4882a593Smuzhiyun# 14*4882a593Smuzhiyun# Run this in the directory containing the memory model. 15*4882a593Smuzhiyun# 16*4882a593Smuzhiyun# This script makes no attempt to run the litmus tests concurrently. 17*4882a593Smuzhiyun# 18*4882a593Smuzhiyun# Copyright IBM Corporation, 2018 19*4882a593Smuzhiyun# 20*4882a593Smuzhiyun# Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun. scripts/parseargs.sh 23*4882a593Smuzhiyun 24*4882a593Smuzhiyunlitmusdir=litmus-tests 25*4882a593Smuzhiyunif test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir" 26*4882a593Smuzhiyunthen 27*4882a593Smuzhiyun : 28*4882a593Smuzhiyunelse 29*4882a593Smuzhiyun echo ' --- ' error: $litmusdir is not an accessible directory 30*4882a593Smuzhiyun exit 255 31*4882a593Smuzhiyunfi 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun# Create any new directories that have appeared in the github litmus 34*4882a593Smuzhiyun# repo since the last run. 35*4882a593Smuzhiyunif test "$LKMM_DESTDIR" != "." 36*4882a593Smuzhiyunthen 37*4882a593Smuzhiyun find $litmusdir -type d -print | 38*4882a593Smuzhiyun ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh ) 39*4882a593Smuzhiyunfi 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun# Find the checklitmus script. If it is not where we expect it, then 42*4882a593Smuzhiyun# assume that the caller has the PATH environment variable set 43*4882a593Smuzhiyun# appropriately. 44*4882a593Smuzhiyunif test -x scripts/checklitmus.sh 45*4882a593Smuzhiyunthen 46*4882a593Smuzhiyun clscript=scripts/checklitmus.sh 47*4882a593Smuzhiyunelse 48*4882a593Smuzhiyun clscript=checklitmus.sh 49*4882a593Smuzhiyunfi 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun# Run the script on all the litmus tests in the specified directory 52*4882a593Smuzhiyunret=0 53*4882a593Smuzhiyunfor i in $litmusdir/*.litmus 54*4882a593Smuzhiyundo 55*4882a593Smuzhiyun if ! $clscript $i 56*4882a593Smuzhiyun then 57*4882a593Smuzhiyun ret=1 58*4882a593Smuzhiyun fi 59*4882a593Smuzhiyundone 60*4882a593Smuzhiyunif test "$ret" -ne 0 61*4882a593Smuzhiyunthen 62*4882a593Smuzhiyun echo " ^^^ VERIFICATION MISMATCHES" 1>&2 63*4882a593Smuzhiyunelse 64*4882a593Smuzhiyun echo All litmus tests verified as was expected. 1>&2 65*4882a593Smuzhiyunfi 66*4882a593Smuzhiyunexit $ret 67