mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Update help and error messages in run-tests.sh
This commit is contained in:
@@ -7,27 +7,27 @@ usage() {
|
|||||||
echo "Runs regression tests on RGBDS."
|
echo "Runs regression tests on RGBDS."
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h, --help show this help message"
|
echo " -h, --help show this help message"
|
||||||
|
echo " --only-internal only run tests that build local examples"
|
||||||
|
echo " --only-external only run tests that build external codebases"
|
||||||
echo " --only-free skip tests that build nonfree codebases"
|
echo " --only-free skip tests that build nonfree codebases"
|
||||||
echo " --only-internal skip tests that build external codebases"
|
echo " --installed-rgbds use the system installed RGBDS"
|
||||||
|
echo " (only compatible with external codebases)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse options in pure Bash because macOS `getopt` is stuck
|
# Parse options in pure Bash because macOS `getopt` is stuck
|
||||||
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
||||||
installedrgbds=false
|
|
||||||
nonfree=true
|
nonfree=true
|
||||||
internal=true
|
internal=true
|
||||||
external=true
|
external=true
|
||||||
|
installedrgbds=false
|
||||||
FETCH_TEST_DEPS="fetch-test-deps.sh"
|
FETCH_TEST_DEPS="fetch-test-deps.sh"
|
||||||
|
RGBDS_PATH="RGBDS=../../"
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--only-free)
|
|
||||||
nonfree=false
|
|
||||||
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-free"
|
|
||||||
;;
|
|
||||||
--only-internal)
|
--only-internal)
|
||||||
external=false
|
external=false
|
||||||
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-internal"
|
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-internal"
|
||||||
@@ -35,8 +35,13 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--only-external)
|
--only-external)
|
||||||
internal=false
|
internal=false
|
||||||
;;
|
;;
|
||||||
|
--only-free)
|
||||||
|
nonfree=false
|
||||||
|
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-free"
|
||||||
|
;;
|
||||||
--installed-rgbds)
|
--installed-rgbds)
|
||||||
installedrgbds=true
|
installedrgbds=true
|
||||||
|
RGBDS_PATH=
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
break
|
break
|
||||||
@@ -49,24 +54,27 @@ while [[ $# -gt 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! ("$external" || "$internal"); then
|
if ! ("$internal" || "$external"); then
|
||||||
echo "No tests to run."
|
echo "Specifying --only-internal with --only-external is a contradiction"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if "$internal" && "$installedrgbds"; then
|
if "$internal" && "$installedrgbds"; then
|
||||||
echo "Internal tests don't support running with the system-installed rgbds."
|
echo "Please specify --only-external with --installed-rgbds"
|
||||||
|
echo "(internal tests don't support running with system-installed RGBDS)"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Refuse to run if RGBDS isn't available
|
||||||
if "$installedrgbds"; then
|
if "$installedrgbds"; then
|
||||||
# Refuse to run if RGBDS isn't installed
|
is_installed() {
|
||||||
if ! (command -v rgbasm 2>&1 >/dev/null && command -v rgblink 2>&1 >/dev/null && command -v rgbfix 2>&1 >/dev/null && command -v rgbgfx 2>&1 >/dev/null); then
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
if ! (is_installed rgbasm && is_installed rgblink && is_installed rgbfix && is_installed rgbgfx); then
|
||||||
echo "Please install RGBDS before running the tests"
|
echo "Please install RGBDS before running the tests"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Refuse to run if RGBDS isn't present
|
|
||||||
if [[ ! ( -x ../rgbasm && -x ../rgblink && -x ../rgbfix && -x ../rgbgfx ) ]]; then
|
if [[ ! ( -x ../rgbasm && -x ../rgblink && -x ../rgbfix && -x ../rgbgfx ) ]]; then
|
||||||
echo "Please build RGBDS before running the tests"
|
echo "Please build RGBDS before running the tests"
|
||||||
false
|
false
|
||||||
@@ -96,13 +104,8 @@ test_downstream() { # owner repo make-target build-file build-hash
|
|||||||
echo >&2 'Please run `'"$FETCH_TEST_DEPS"'` before running the test suite'
|
echo >&2 'Please run `'"$FETCH_TEST_DEPS"'` before running the test suite'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if "$installedrgbds"; then
|
make clean $RGBDS_PATH
|
||||||
make clean
|
make -j4 "$3" $RGBDS_PATH
|
||||||
make -j4 "$3"
|
|
||||||
else
|
|
||||||
make clean RGBDS=../../
|
|
||||||
make -j4 "$3" RGBDS=../../
|
|
||||||
fi
|
|
||||||
hash="$(sha1sum -b "$4" | head -c 40)"
|
hash="$(sha1sum -b "$4" | head -c 40)"
|
||||||
if [ "$hash" != "$5" ]; then
|
if [ "$hash" != "$5" ]; then
|
||||||
echo >&2 'SHA-1 hash of '"$4"' did not match: '"$hash"
|
echo >&2 'SHA-1 hash of '"$4"' did not match: '"$hash"
|
||||||
|
|||||||
Reference in New Issue
Block a user