aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/arm64/fp/fpsimd-stress
blob: 781b5b022eafa3f7ae89489eac2c74956aadd282 (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
53
54
55
56
57
58
59
60
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2015-2019 ARM Limited.
# Original author: Dave Martin <Dave.Martin@arm.com>

set -ue

NR_CPUS=`nproc`

pids=
logs=

cleanup () {
	trap - INT TERM CHLD
	set +e

	if [ -n "$pids" ]; then
		kill $pids
		wait $pids
		pids=
	fi

	if [ -n "$logs" ]; then
		cat $logs
		rm $logs
		logs=
	fi
}

interrupt () {
	cleanup
	exit 0
}

child_died () {
	cleanup
	exit 1
}

trap interrupt INT TERM EXIT
trap child_died CHLD

for x in `seq 0 $((NR_CPUS * 4))`; do
	log=`mktemp`
	logs=$logs\ $log
	./fpsimd-test >$log &
	pids=$pids\ $!
done

# Wait for all child processes to be created:
sleep 10

while :; do
	kill -USR1 $pids
done &
pids=$pids\ $!

wait

exit 1