Add self-test workflow

This commit is contained in:
Dave Rolsky
2023-03-12 10:38:01 -04:00
parent 4dfe96e52b
commit 5bd32448aa
3 changed files with 190 additions and 0 deletions

26
tests/check-binary.sh Executable file
View File

@@ -0,0 +1,26 @@
set -e
set -x
TARGET=$1
EXPECT_CROSS=$2
EXPECT_FILE_RE=$3
if [ "$EXPECT_CROSS" == "true" ]; then
if [ ! -f "$RUNNER_TEMP/cross" ]; then
echo "Could not find cross in path: $PATH"
exit 1
fi
else
if [ -f "$RUNNER_TEMP/cross" ]; then
echo "Found cross in path: $PATH"
exit 1
fi
fi
FILE=$(file --brief ./target/$TARGET/debug/test-project)
if [[ "$FILE" =~ $EXPECT_FILE_RE ]]; then
echo "file output matches $EXPECT_FILE_RE"
else
echo "file output does not match $EXPECT_FILE_RE"
exit 2
fi