18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# Run a herd7 test and invokes judgelitmus.sh to check the result against
58c2ecf20Sopenharmony_ci# a "Result:" comment within the litmus test.  It also outputs verification
68c2ecf20Sopenharmony_ci# results to a file whose name is that of the specified litmus test, but
78c2ecf20Sopenharmony_ci# with ".out" appended.
88c2ecf20Sopenharmony_ci#
98c2ecf20Sopenharmony_ci# Usage:
108c2ecf20Sopenharmony_ci#	checklitmus.sh file.litmus
118c2ecf20Sopenharmony_ci#
128c2ecf20Sopenharmony_ci# Run this in the directory containing the memory model, specifying the
138c2ecf20Sopenharmony_ci# pathname of the litmus test to check.  The caller is expected to have
148c2ecf20Sopenharmony_ci# properly set up the LKMM environment variables.
158c2ecf20Sopenharmony_ci#
168c2ecf20Sopenharmony_ci# Copyright IBM Corporation, 2018
178c2ecf20Sopenharmony_ci#
188c2ecf20Sopenharmony_ci# Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cilitmus=$1
218c2ecf20Sopenharmony_ciherdoptions=${LKMM_HERD_OPTIONS--conf linux-kernel.cfg}
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciif test -f "$litmus" -a -r "$litmus"
248c2ecf20Sopenharmony_cithen
258c2ecf20Sopenharmony_ci	:
268c2ecf20Sopenharmony_cielse
278c2ecf20Sopenharmony_ci	echo ' --- ' error: \"$litmus\" is not a readable file
288c2ecf20Sopenharmony_ci	exit 255
298c2ecf20Sopenharmony_cifi
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciecho Herd options: $herdoptions > $LKMM_DESTDIR/$litmus.out
328c2ecf20Sopenharmony_ci/usr/bin/time $LKMM_TIMEOUT_CMD herd7 $herdoptions $litmus >> $LKMM_DESTDIR/$litmus.out 2>&1
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciscripts/judgelitmus.sh $litmus
35