xref: /openbmc/linux/tools/memory-model/scripts/checkalllitmus.sh (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1*579ecb2eSPaul E. McKenney#!/bin/bash
2b02eb5b0SPaul E. McKenney# SPDX-License-Identifier: GPL-2.0+
32fb6ae16SPaul E. McKenney#
437c600a3SAndrea Parri# Run herd7 tests on all .litmus files in the litmus-tests directory
5b02eb5b0SPaul E. McKenney# and check each file's result against a "Result:" comment within that
6b02eb5b0SPaul E. McKenney# litmus test.  If the verification result does not match that specified
7b02eb5b0SPaul E. McKenney# in the litmus test, this script prints an error message prefixed with
8b02eb5b0SPaul E. McKenney# "^^^".  It also outputs verification results to a file whose name is
9b02eb5b0SPaul E. McKenney# that of the specified litmus test, but with ".out" appended.
102fb6ae16SPaul E. McKenney#
11*579ecb2eSPaul E. McKenney# If the --hw argument is specified, this script translates the .litmus
12*579ecb2eSPaul E. McKenney# C-language file to the specified type of assembly and verifies that.
13*579ecb2eSPaul E. McKenney# But in this case, litmus tests using complex synchronization (such as
14*579ecb2eSPaul E. McKenney# locking, RCU, and SRCU) are cheerfully ignored.
15*579ecb2eSPaul E. McKenney#
162fb6ae16SPaul E. McKenney# Usage:
17b02eb5b0SPaul E. McKenney#	checkalllitmus.sh
182fb6ae16SPaul E. McKenney#
19b02eb5b0SPaul E. McKenney# Run this in the directory containing the memory model.
202fb6ae16SPaul E. McKenney#
212fb6ae16SPaul E. McKenney# This script makes no attempt to run the litmus tests concurrently.
222fb6ae16SPaul E. McKenney#
232fb6ae16SPaul E. McKenney# Copyright IBM Corporation, 2018
242fb6ae16SPaul E. McKenney#
2561f615ccSPaul E. McKenney# Author: Paul E. McKenney <paulmck@linux.ibm.com>
262fb6ae16SPaul E. McKenney
27b02eb5b0SPaul E. McKenney. scripts/parseargs.sh
28b02eb5b0SPaul E. McKenney
29b02eb5b0SPaul E. McKenneylitmusdir=litmus-tests
302fb6ae16SPaul E. McKenneyif test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"
312fb6ae16SPaul E. McKenneythen
322fb6ae16SPaul E. McKenney	:
332fb6ae16SPaul E. McKenneyelse
342fb6ae16SPaul E. McKenney	echo ' --- ' error: $litmusdir is not an accessible directory
352fb6ae16SPaul E. McKenney	exit 255
362fb6ae16SPaul E. McKenneyfi
372fb6ae16SPaul E. McKenney
38e029374bSPaul E. McKenney# Create any new directories that have appeared in the litmus-tests
39e029374bSPaul E. McKenney# directory since the last run.
40b02eb5b0SPaul E. McKenneyif test "$LKMM_DESTDIR" != "."
41b02eb5b0SPaul E. McKenneythen
42b02eb5b0SPaul E. McKenney	find $litmusdir -type d -print |
43b02eb5b0SPaul E. McKenney	( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
44b02eb5b0SPaul E. McKenneyfi
45b02eb5b0SPaul E. McKenney
462fb6ae16SPaul E. McKenney# Run the script on all the litmus tests in the specified directory
472fb6ae16SPaul E. McKenneyret=0
48b02eb5b0SPaul E. McKenneyfor i in $litmusdir/*.litmus
492fb6ae16SPaul E. McKenneydo
50*579ecb2eSPaul E. McKenney	if test -n "$LKMM_HW_MAP_FILE" && ! scripts/simpletest.sh $i
51*579ecb2eSPaul E. McKenney	then
52*579ecb2eSPaul E. McKenney		continue
53*579ecb2eSPaul E. McKenney	fi
54*579ecb2eSPaul E. McKenney	if ! scripts/checklitmus.sh $i
552fb6ae16SPaul E. McKenney	then
562fb6ae16SPaul E. McKenney		ret=1
572fb6ae16SPaul E. McKenney	fi
582fb6ae16SPaul E. McKenneydone
592fb6ae16SPaul E. McKenneyif test "$ret" -ne 0
602fb6ae16SPaul E. McKenneythen
61b02eb5b0SPaul E. McKenney	echo " ^^^ VERIFICATION MISMATCHES" 1>&2
622fb6ae16SPaul E. McKenneyelse
63b02eb5b0SPaul E. McKenney	echo All litmus tests verified as was expected. 1>&2
642fb6ae16SPaul E. McKenneyfi
652fb6ae16SPaul E. McKenneyexit $ret
66