#! /bin/sh
set -e

# Skip this test if no amdgpu is caught by the kernel
test -d /sys/class/kfd || exit 77

if [ "${AUTOPKGTEST_TMP}" = "" ]
then
	AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
	# Double quote below to expand the temporary directory variable now
	# versus later is on purpose.
	# shellcheck disable=SC2064
	trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
cd "$AUTOPKGTEST_TMP"

# Superficial tests
echo '$ hipcc --help'
hipcc --help
echo '$ hipcc --version'
hipcc --version

# Basic build test.
cat > main.cpp << END
int main(int argc, char **argv) { return (0); }
END
echo '$ cat main.cpp'
cat main.cpp
echo '$ hipcc main.cpp -o main'
hipcc main.cpp -o main
echo '$ ./main'
./main
