| 1 |
#!/bin/sh |
| 2 |
# autopkgtest driver for ROCm upstream binaries |
| 3 |
# |
| 4 |
# Expects argument "$1" to be the name of a sub-directory, such that the |
| 5 |
# following following directory exists: |
| 6 |
# |
| 7 |
# /usr/libexec/rocm/$1 |
| 8 |
# |
| 9 |
# Will run all executables in that directory, and exit with status=1 if |
| 10 |
# any failure occured, otherwise with status=0. A failure is defined as an |
| 11 |
# executable exiting with a status != 0. |
| 12 |
|
| 13 |
|
| 14 |
TESTSDIR="/usr/libexec/rocm/$1" |
| 15 |
|
| 16 |
if [ ! -e /dev/kfd ] |
| 17 |
then |
| 18 |
echo "/dev/kfd not present, system either lacks AMD GPU or AMDGPU driver is not loaded." |
| 19 |
echo "Skipping tests." |
| 20 |
# Magic number to signal 'skipped' |
| 21 |
exit 77 |
| 22 |
elif [ "`id -u`" != "0" ] && [ ! -r /dev/kfd ] |
| 23 |
then |
| 24 |
echo "/dev/kfd present but no read permission." |
| 25 |
echo "Skipping tests." |
| 26 |
exit 77 |
| 27 |
elif [ -z "$1" ] |
| 28 |
then |
| 29 |
echo "This script needs to be called with a directory name as an argument." >&2 |
| 30 |
echo "Aborting." >&2 |
| 31 |
exit 1 |
| 32 |
elif [ ! -d "$TESTSDIR" ] |
| 33 |
then |
| 34 |
echo "The directory $TESTSDIR does not exist." >&2 |
| 35 |
echo "Aborting." >&2 |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
|
| 39 |
cd "$AUTOPKGTEST_TMP" |
| 40 |
|
| 41 |
# Any individual failure is overall failure |
| 42 |
EXITCODE=0 |
| 43 |
for TESTNAME in $TESTSDIR/* |
| 44 |
do |
| 45 |
$TESTNAME || EXITCODE=1 |
| 46 |
done |
| 47 |
|
| 48 |
exit $EXITCODE |