mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-27 05:22:07 +00:00
Add --only-free and --help options to test scripts (#1161)
This commit is contained in:
@@ -1,11 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Return failure as soon as a command fails to execute
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
usage() {
|
||||
echo "Runs regression tests on RGBDS."
|
||||
echo "Options:"
|
||||
echo " -h, --help show this help message"
|
||||
echo " --only-free skip tests that build nonfree codebases"
|
||||
}
|
||||
|
||||
# Parse options in pure Bash because macOS `getopt` is stuck
|
||||
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
||||
nonfree=true
|
||||
FETCH_TEST_DEPS="fetch-test-deps.sh"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--only-free)
|
||||
nonfree=false
|
||||
FETCH_TEST_DEPS="fetch-test-deps.sh --only-free"
|
||||
;;
|
||||
--)
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "$(basename $0): internal error"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Refuse to run if RGBDS isn't present
|
||||
if [[ ! ( -x ../rgbasm && -x ../rgblink && -x ../rgbfix && -x ../rgbgfx ) ]]; then
|
||||
echo "Please build RGBDS before running the tests"
|
||||
@@ -27,7 +56,7 @@ done
|
||||
|
||||
test_downstream() { # owner/repo make-target
|
||||
if ! pushd ${1##*/}; then
|
||||
echo >&2 'Please run `fetch-test-deps.sh` before running the test suite'
|
||||
echo >&2 'Please run `'"$FETCH_TEST_DEPS"'` before running the test suite'
|
||||
return 1
|
||||
fi
|
||||
make clean
|
||||
@@ -35,6 +64,8 @@ test_downstream() { # owner/repo make-target
|
||||
popd
|
||||
}
|
||||
|
||||
test_downstream pret/pokecrystal compare
|
||||
test_downstream pret/pokered compare
|
||||
if "$nonfree"; then
|
||||
test_downstream pret/pokecrystal compare
|
||||
test_downstream pret/pokered compare
|
||||
fi
|
||||
test_downstream AntonioND/ucity ''
|
||||
|
||||
Reference in New Issue
Block a user