brintos

brintos / linux-shallow public Read only

0
0
Text · 2.4 KiB · 94608d4 Raw
81 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0+3#4# Without the -hw argument, runs a herd7 test and outputs verification5# results to a file whose name is that of the specified litmus test,6# but with ".out" appended.7#8# If the --hw argument is specified, this script translates the .litmus9# C-language file to the specified type of assembly and verifies that.10# But in this case, litmus tests using complex synchronization (such as11# locking, RCU, and SRCU) are cheerfully ignored.12#13# Either way, return the status of the herd7 command.14#15# Usage:16#	runlitmus.sh file.litmus17#18# Run this in the directory containing the memory model, specifying the19# pathname of the litmus test to check.  The caller is expected to have20# properly set up the LKMM environment variables.21#22# Copyright IBM Corporation, 201923#24# Author: Paul E. McKenney <paulmck@linux.ibm.com>25 26litmus=$127if test -f "$litmus" -a -r "$litmus"28then29	:30else31	echo ' !!! ' error: \"$litmus\" is not a readable file32	exit 25533fi34 35if test -z "$LKMM_HW_MAP_FILE" -o ! -e $LKMM_DESTDIR/$litmus.out36then37	# LKMM run38	herdoptions=${LKMM_HERD_OPTIONS--conf linux-kernel.cfg}39	echo Herd options: $herdoptions > $LKMM_DESTDIR/$litmus.out40	/usr/bin/time $LKMM_TIMEOUT_CMD herd7 $herdoptions $litmus >> $LKMM_DESTDIR/$litmus.out 2>&141	ret=$?42	if test -z "$LKMM_HW_MAP_FILE"43	then44		exit $ret45	fi46	echo " --- " Automatically generated LKMM output for '"'--hw $LKMM_HW_MAP_FILE'"' run47fi48 49# Hardware run50 51T=/tmp/checklitmushw.sh.$$52trap 'rm -rf $T' 0 253mkdir $T54 55# Generate filenames56mapfile="Linux2${LKMM_HW_MAP_FILE}.map"57themefile="$T/${LKMM_HW_MAP_FILE}.theme"58herdoptions="-model $LKMM_HW_CAT_FILE"59hwlitmus=`echo $litmus | sed -e 's/\.litmus$/.litmus.'${LKMM_HW_MAP_FILE}'/'`60hwlitmusfile=`echo $hwlitmus | sed -e 's,^.*/,,'`61 62# Don't run on litmus tests with complex synchronization63if ! scripts/simpletest.sh $litmus64then65	echo ' --- ' error: \"$litmus\" contains locking, RCU, or SRCU66	exit 25467fi68 69# Generate the assembly code and run herd7 on it.70gen_theme7 -n 10 -map $mapfile -call Linux.call > $themefile71jingle7 -v -theme $themefile $litmus > $LKMM_DESTDIR/$hwlitmus 2> $T/$hwlitmusfile.jingle7.out72if grep -q "Generated 0 tests" $T/$hwlitmusfile.jingle7.out73then74	echo ' !!! ' jingle7 failed, errors in $hwlitmus.err75	cp $T/$hwlitmusfile.jingle7.out $LKMM_DESTDIR/$hwlitmus.err76	exit 25377fi78/usr/bin/time $LKMM_TIMEOUT_CMD herd7 -unroll 0 $LKMM_DESTDIR/$hwlitmus > $LKMM_DESTDIR/$hwlitmus.out 2>&179 80exit $?81