xref: /OK3568_Linux_fs/kernel/tools/memory-model/scripts/checklitmus.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#!/bin/sh
2*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0+
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun# Run a herd7 test and invokes judgelitmus.sh to check the result against
5*4882a593Smuzhiyun# a "Result:" comment within the litmus test.  It also outputs verification
6*4882a593Smuzhiyun# results to a file whose name is that of the specified litmus test, but
7*4882a593Smuzhiyun# with ".out" appended.
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# Usage:
10*4882a593Smuzhiyun#	checklitmus.sh file.litmus
11*4882a593Smuzhiyun#
12*4882a593Smuzhiyun# Run this in the directory containing the memory model, specifying the
13*4882a593Smuzhiyun# pathname of the litmus test to check.  The caller is expected to have
14*4882a593Smuzhiyun# properly set up the LKMM environment variables.
15*4882a593Smuzhiyun#
16*4882a593Smuzhiyun# Copyright IBM Corporation, 2018
17*4882a593Smuzhiyun#
18*4882a593Smuzhiyun# Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
19*4882a593Smuzhiyun
20*4882a593Smuzhiyunlitmus=$1
21*4882a593Smuzhiyunherdoptions=${LKMM_HERD_OPTIONS--conf linux-kernel.cfg}
22*4882a593Smuzhiyun
23*4882a593Smuzhiyunif test -f "$litmus" -a -r "$litmus"
24*4882a593Smuzhiyunthen
25*4882a593Smuzhiyun	:
26*4882a593Smuzhiyunelse
27*4882a593Smuzhiyun	echo ' --- ' error: \"$litmus\" is not a readable file
28*4882a593Smuzhiyun	exit 255
29*4882a593Smuzhiyunfi
30*4882a593Smuzhiyun
31*4882a593Smuzhiyunecho Herd options: $herdoptions > $LKMM_DESTDIR/$litmus.out
32*4882a593Smuzhiyun/usr/bin/time $LKMM_TIMEOUT_CMD herd7 $herdoptions $litmus >> $LKMM_DESTDIR/$litmus.out 2>&1
33*4882a593Smuzhiyun
34*4882a593Smuzhiyunscripts/judgelitmus.sh $litmus
35