#!/bin/sh

testsdir="/usr/libexec/migraphx/migraphx-tests"
tmpdir="$AUTOPKGTEST_TMP/migraphx-tests"

mkdir -p "$tmpdir" && cp -a "$testsdir/"* "$tmpdir/"

cd "$tmpdir"

exitcode=0
for testname in ./*
do
    case "$testname" in *.onnx)
            continue
            ;;
    esac
    case "$testname" in ./test_process_test|./test_msgpack)
            continue
            ;;
    esac
    if [ -d $testname ]; then
        continue
    fi
    if [ -x $testname ]; then
        $testname || exitcode=1
    fi
done

exit $exitcode
