#!/bin/sh

testsdir="/usr/libexec/rocm/librocrand1-tests"

# Any individual failure is overall failure
exitcode=0
for testname in "$testsdir"/test*; do
    if [ -n "$AUTOPKGTEST_ARTIFACTS" ]; then
        # autopkgtest called us, save output to artifacts
        "$testname" --gtest_output=xml:"${AUTOPKGTEST_ARTIFACTS}"/ || exitcode=1
    else
        # Something else called us, pass on all arguments to the test binaries
        "$testname" "$@" || exitcode=1
    fi
done
exit $exitcode
