blob: ed99e7ccb0328349daa960f13d930b05b77b9da5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
# pi_stress checks Priority Inheritence Mutexes and their ability to avoid
# Priority Inversion from occuring by running groups of threads that cause
# Priority Inversions.
# shellcheck disable=SC1091
. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
RESULT_FILE="${OUTPUT}/result.txt"
export RESULT_FILE
DURATION="300"
MLOCKALL="false"
RR="false"
usage() {
echo "Usage: $0 [-d duration] [-m <true|false>] [-r <true|false>]" 1>&2
exit 1
}
while getopts ":d:m:r:" opt; do
case "${opt}" in
d) DURATION="${OPTARG}" ;;
m) MLOCKALL="${OPTARG}" ;;
r) RR="${OPTARG}" ;;
*) usage ;;
esac
done
! check_root && error_msg "Please run this script as root."
[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
mkdir -p "${OUTPUT}"
if "${MLOCKALL}"; then
MLOCKALL="--mlockall"
else
MLOCKALL=""
fi
if "${RR}"; then
RR="--rr"
else
RR=""
fi
detect_abi
# pi_stress will send SIGTERM when test fails. The single will terminate the
# test script. Catch and ignore it with trap.
trap '' TERM
# shellcheck disable=SC2154
./bin/"${abi}"/pi_stress --duration "${DURATION}" "${MLOCKALL}" "${RR}"
check_return 'pi-stress'
|