vulkzample/test.sh

41 lines
860 B
Bash

#!/bin/sh -e
unset ENABLE_DEBUG
unset ENABLE_SWRAST
export CMAKE_ENABLE_TESTS=ON
check_failure() {
if [ $? -ne 0 ]; then
echo "Test Failed: $1"
exit 1
fi
}
run_and_grep() {
echo "Testing Starting: $2"
OUTPUT=$($1 2>&1)
echo "$OUTPUT" | grep "Completed tests"
check_failure "$2"
echo "Test Success: $2"
}
echo "Testing Debug"
sh clean.sh
echo "Building Debug..."
ENABLE_TESTS=1 ENABLE_DEBUG=1 sh build.sh >/dev/null 2>&1
check_failure "Build Debug"
time ENABLE_SWRAST=1 run_and_grep "sh run.sh" "Debug CPU Test"
time run_and_grep "sh run.sh" "Debug GPU Test"
echo "Testing Release"
sh clean.sh
echo "Building Release..."
ENABLE_TESTS=1 sh build.sh >/dev/null 2>&1
check_failure "Build Release"
time ENABLE_SWRAST=1 run_and_grep "sh run.sh" "Release CPU Test"
time run_and_grep "sh run.sh" "Release GPU Test"
sh clean.sh
echo "Tests Succeeded"