xref: /linux/tools/memory-model/scripts/simpletest.sh (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0+
3#
4# Give zero status if this is a simple test and non-zero otherwise.
5# Simple tests do not contain locking, RCU, or SRCU.
6#
7# Usage:
8#	simpletest.sh file.litmus
9#
10# Copyright IBM Corporation, 2019
11#
12# Author: Paul E. McKenney <paulmck@linux.ibm.com>
13
14
15litmus=$1
16
17if test -f "$litmus" -a -r "$litmus"
18then
19	:
20else
21	echo ' --- ' error: \"$litmus\" is not a readable file
22	exit 255
23fi
24exclude="^[[:space:]]*\("
25exclude="${exclude}spin_lock(\|spin_unlock(\|spin_trylock(\|spin_is_locked("
26exclude="${exclude}\|rcu_read_lock(\|rcu_read_unlock("
27exclude="${exclude}\|synchronize_rcu(\|synchronize_rcu_expedited("
28exclude="${exclude}\|srcu_read_lock(\|srcu_read_unlock("
29exclude="${exclude}\|synchronize_srcu(\|synchronize_srcu_expedited("
30exclude="${exclude}\)"
31if grep -q $exclude $litmus
32then
33	exit 255
34fi
35exit 0
36