GNU Linux-libre 6.9.1-gnu
[releases.git] / tools / memory-model / scripts / simpletest.sh
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
15 litmus=$1
16
17 if test -f "$litmus" -a -r "$litmus"
18 then
19         :
20 else
21         echo ' --- ' error: \"$litmus\" is not a readable file
22         exit 255
23 fi
24 exclude="^[[:space:]]*\("
25 exclude="${exclude}spin_lock(\|spin_unlock(\|spin_trylock(\|spin_is_locked("
26 exclude="${exclude}\|rcu_read_lock(\|rcu_read_unlock("
27 exclude="${exclude}\|synchronize_rcu(\|synchronize_rcu_expedited("
28 exclude="${exclude}\|srcu_read_lock(\|srcu_read_unlock("
29 exclude="${exclude}\|synchronize_srcu(\|synchronize_srcu_expedited("
30 exclude="${exclude}\)"
31 if grep -q $exclude $litmus
32 then
33         exit 255
34 fi
35 exit 0