2022-04-27 05:11:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Arg 1: Dist location
|
|
|
|
|
|
|
|
PREFIX="dist"
|
|
|
|
|
|
|
|
# Get absolute paths for everything since we're going to cd into the distribution directory
|
|
|
|
ROOT=$(pwd)
|
|
|
|
TEST_CASES="$ROOT/tests/dist"
|
|
|
|
|
|
|
|
RESULTS_DIR="$ROOT/tests/results/$PREFIX"
|
|
|
|
|
|
|
|
mkdir -p "$RESULTS_DIR"
|
|
|
|
|
|
|
|
# Move into distribution location
|
|
|
|
cd $1
|
|
|
|
|
2022-05-11 06:14:40 +00:00
|
|
|
# Verify that ./internal/temp/ is empty save for temp.bin
|
|
|
|
# xargs trims the front whitespace on OSX
|
|
|
|
tempCount=$(find ./internal/temp/ -type f | wc -l | xargs)
|
|
|
|
[ "$tempCount" == "1" ]
|
|
|
|
assert_success_named "./Internal/temp file count" echo "Temp has too many files: $tempCount"
|
|
|
|
|
2022-04-27 05:11:02 +00:00
|
|
|
# Specific steps for each platform
|
|
|
|
case "$2" in
|
|
|
|
win)
|
2022-05-01 03:03:22 +00:00
|
|
|
# Verify that the Resource information was correctly applied
|
|
|
|
# windres returns an error if the exe has no resource section
|
2022-08-11 16:07:57 +00:00
|
|
|
windresResult=$($ROOT/internal/c/c_compiler/bin/windres.exe -i ./qb64pe.exe)
|
2022-05-01 03:03:22 +00:00
|
|
|
assert_success_named "Windows Resource Section" printf "\n$windresResult\n"
|
2022-04-27 05:11:02 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
lnx)
|
2022-04-27 22:08:36 +00:00
|
|
|
./setup_lnx.sh "dont_run" 1>"$RESULTS_DIR/linux-setup.txt"
|
2022-04-27 05:11:02 +00:00
|
|
|
assert_success_named "Linux setup" cat "$RESULTS_DIR/linux-setup.txt"
|
|
|
|
;;
|
|
|
|
|
|
|
|
osx)
|
2022-04-27 22:08:36 +00:00
|
|
|
./setup_osx.command "." "dont_run" 1>"$RESULTS_DIR/osx-setup.txt"
|
2022-04-27 05:11:02 +00:00
|
|
|
assert_success_named "OSX setup" cat "$RESULTS_DIR/osx-setup.txt"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
show_failure()
|
|
|
|
{
|
|
|
|
cat "$RESULTS_DIR/$1-compile_result.txt"
|
|
|
|
cat "$RESULTS_DIR/$1-compilelog.txt"
|
|
|
|
}
|
|
|
|
|
|
|
|
for basFile in $TEST_CASES/*.bas
|
|
|
|
do
|
|
|
|
test=$(basename $basFile .bas)
|
2022-04-28 23:37:05 +00:00
|
|
|
outputExe="$RESULTS_DIR/$test-output"
|
2022-04-27 05:11:02 +00:00
|
|
|
|
|
|
|
TESTCASE=$test
|
|
|
|
|
2022-08-11 16:07:57 +00:00
|
|
|
./qb64pe -x "$TEST_CASES/$test.bas" -o "$outputExe" 1>$RESULTS_DIR/$test-compile_result.txt
|
2022-04-27 05:11:02 +00:00
|
|
|
ERR=$?
|
2022-05-11 00:11:26 +00:00
|
|
|
cp_if_exists ./internal/temp/compilelog.txt $RESULTS_DIR/$test-compilelog.txt
|
2022-04-27 05:11:02 +00:00
|
|
|
|
|
|
|
(exit $ERR)
|
|
|
|
assert_success_named "compile" "Compilation Error:" show_failure $test
|
|
|
|
|
|
|
|
test -f "$outputExe"
|
|
|
|
assert_success_named "exe exists" "output.exe does not exist!" show_failure $test
|
|
|
|
|
|
|
|
testResult=$("$outputExe" 2>&1)
|
|
|
|
assert_success_named "run" "Execution Error:" echo "$testResult"
|
|
|
|
|
|
|
|
[ "$testResult" == "$(cat $TEST_CASES/$test.result)" ]
|
|
|
|
assert_success_named "result" "Result is wrong:" echo "$testResult"
|
|
|
|
done
|