treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / rseq / run_param_test.sh
blobe426304fd4a02bab10fdf7e841e92e9f8160cadd
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+ or MIT
4 NR_CPUS=`grep '^processor' /proc/cpuinfo | wc -l`
6 EXTRA_ARGS=${@}
8 OLDIFS="$IFS"
9 IFS=$'\n'
10 TEST_LIST=(
11 "-T s"
12 "-T l"
13 "-T b"
14 "-T b -M"
15 "-T m"
16 "-T m -M"
17 "-T i"
20 TEST_NAME=(
21 "spinlock"
22 "list"
23 "buffer"
24 "buffer with barrier"
25 "memcpy"
26 "memcpy with barrier"
27 "increment"
29 IFS="$OLDIFS"
31 REPS=1000
32 SLOW_REPS=100
33 NR_THREADS=$((6*${NR_CPUS}))
35 function do_tests()
37 local i=0
38 while [ "$i" -lt "${#TEST_LIST[@]}" ]; do
39 echo "Running test ${TEST_NAME[$i]}"
40 ./param_test ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
41 echo "Running compare-twice test ${TEST_NAME[$i]}"
42 ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
43 let "i++"
44 done
47 echo "Default parameters"
48 do_tests
50 echo "Loop injection: 10000 loops"
52 OLDIFS="$IFS"
53 IFS=$'\n'
54 INJECT_LIST=(
55 "1"
56 "2"
57 "3"
58 "4"
59 "5"
60 "6"
61 "7"
62 "8"
63 "9"
65 IFS="$OLDIFS"
67 NR_LOOPS=10000
69 i=0
70 while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
71 echo "Injecting at <${INJECT_LIST[$i]}>"
72 do_tests -${INJECT_LIST[i]} ${NR_LOOPS}
73 let "i++"
74 done
75 NR_LOOPS=
77 function inject_blocking()
79 OLDIFS="$IFS"
80 IFS=$'\n'
81 INJECT_LIST=(
82 "7"
83 "8"
84 "9"
86 IFS="$OLDIFS"
88 NR_LOOPS=-1
90 i=0
91 while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
92 echo "Injecting at <${INJECT_LIST[$i]}>"
93 do_tests -${INJECT_LIST[i]} -1 ${@}
94 let "i++"
95 done
96 NR_LOOPS=
99 echo "Yield injection (25%)"
100 inject_blocking -m 4 -y
102 echo "Yield injection (50%)"
103 inject_blocking -m 2 -y
105 echo "Yield injection (100%)"
106 inject_blocking -m 1 -y
108 echo "Kill injection (25%)"
109 inject_blocking -m 4 -k
111 echo "Kill injection (50%)"
112 inject_blocking -m 2 -k
114 echo "Kill injection (100%)"
115 inject_blocking -m 1 -k
117 echo "Sleep injection (1ms, 25%)"
118 inject_blocking -m 4 -s 1
120 echo "Sleep injection (1ms, 50%)"
121 inject_blocking -m 2 -s 1
123 echo "Sleep injection (1ms, 100%)"
124 inject_blocking -m 1 -s 1