File: upstream-binaries

package info (click to toggle)
rocthrust 6.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,588 kB
  • sloc: cpp: 66,309; ansic: 34,184; python: 1,519; sh: 331; xml: 212; makefile: 115
file content (72 lines) | stat: -rw-r--r-- 2,006 bytes parent folder | download | duplicates (8)
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
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
# autopkgtest driver for ROCm upstream binaries
#
# Expects argument "$1" to be the name of a sub-directory, such that the
# following following directory exists:
#
#   /usr/libexec/rocm/$1
#
# Will run all executables in that directory, and exit with status=1 if
# any failure occurred, otherwise with status=0. A failure is defined as an
# executable exiting with a status != 0.


TESTSDIR="/usr/libexec/rocm/$1"

if [ ! -e /dev/kfd ]
then
	echo "/dev/kfd not present, system either lacks AMD GPU or AMDGPU driver is not loaded."
	echo "Skipping tests."
	# Magic number to signal 'skipped'
	exit 77
elif [ "$(id -u)" != "0" ] && [ ! -r /dev/kfd ]
then
	echo "/dev/kfd present but no read permission."
	echo "Skipping tests."
	exit 77
elif [ -z "$1" ]
then
	echo "This script needs to be called with a directory name as an argument." >&2
	echo "Aborting." >&2
	exit 1
elif [ ! -d "$TESTSDIR" ]
then
	echo "The directory $TESTSDIR does not exist." >&2
	echo "Aborting." >&2
	exit 1
fi

# 16 = testbed failure
cd "$AUTOPKGTEST_TMP" || exit 16

# First, gather system info
sudo -n mount -t debugfs none /sys/kernel/debug || true
if sudo -n [ -d /sys/kernel/debug/dri ]
then
	for index in $(sudo -n ls /sys/kernel/debug/dri)
	do
		info="/sys/kernel/debug/dri/$index/amdgpu_firmware_info"
		if sudo -n [ -f "$info" ]
		then
			# shellcheck disable=SC2024   # we don't need privileged write
			sudo -n cat "$info" > "$AUTOPKGTEST_ARTIFACTS/amdgpu_firmware_info.$index"
		fi
	done
else
	echo "Could not read /sys/kernel/debug/dri" >> "$AUTOPKGTEST_ARTIFACTS/firmware.err"
fi
# shellcheck disable=SC2024   # we don't need privileged write
sudo -n dmesg > "$AUTOPKGTEST_ARTIFACTS/dmesg.before" || true

# Any individual failure is overall failure
EXITCODE=0
for TESTNAME in "$TESTSDIR"/*
do
	$TESTNAME || EXITCODE=1
done

# Tests might have generated new messages
# shellcheck disable=SC2024   # we don't need privileged write
sudo -n dmesg > "$AUTOPKGTEST_ARTIFACTS/dmesg.after" || true

exit $EXITCODE