1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 14:30:34 +02:00
guile/check-guile.in
Rob Browning c858253288 test-suite: support SRFI-64 based tests
Add support for SRFI-64 based test-suite tests. When a SCM_TESTS test
ends in .sr64, run it using a new automake "Parallel Test Harness"
compatible driver (see the automake info pages) provided by (srfi
srfi-64 automake). For now, provide .trs file and standard output
results like guile-test's, but write SRFI-64's default test runner
output to the log file.

./check-guile, which the existing automake test-suite/driver relies on,
can now handle .sr64 files, though for the time being, it does not allow
mixing (test-suite lib) and SRFI-64 tests in the same invocation since
doing so correctly would require some way of merging the trs (and log)
output from the currently separate domains. This restriction does not
affect automake (make check) because it runs each test separately with
its own ouput files (e.g. test-suite/tests/numbers.{log,trs}) and
compiles the results.

Don't export anything from (srfi srfi-64 automake) until/unless we're
ready to commit to the API(s). For now, just provide support for
check-guile via (private) main.

* check-guile.in: Process *all* options; handle SRFI-64 tests.
* module/srfi/srfi-64/automake.scm: Add automake SRFI-64 test support.
* test-suite/Makefile.am: Add SRFI-64 test support.
2025-06-14 14:52:08 -05:00

97 lines
2.3 KiB
Bash
Executable file

#! /bin/sh
# Usage: check-guile [-i GUILE-INTERPRETER] [GUILE-TEST-ARGS]
# If `-i GUILE-INTERPRETER' is omitted, use ${top_builddir}/meta/guile.
# See ${top_srcdir}/test-suite/guile-test for documentation on GUILE-TEST-ARGS.
#
# Example invocations:
# ./check-guile
# ./check-guile numbers.test
# ./check-guile -i /usr/local/bin/guile
# ./check-guile -i /usr/local/bin/guile numbers.test
# ./check-guile -i meta/gdb-uninstalled-guile numbers.test
set -eu
misuse()
{
echo 'Usage: check-guile [-i GUILE] [--] [TEST...]' 1>&2
exit 2
}
top_builddir=@top_builddir_absolute@
top_srcdir=@top_srcdir_absolute@
test_suite_dir="${top_srcdir}/test-suite"
guile="${top_builddir}/meta/guile"
log_file=check-guile.log
trs_file=''
while test $# -gt 0; do
case "$1" in
-i) test $# -gt 1 || misuse; guile="$2"; shift 2 ;;
--log-file) test $# -gt 1 || misuse; log_file="$2"; shift 2 ;;
--trs-file) test $# -gt 1 || misuse; trs_file="$2"; shift 2 ;;
--) break ;;
-*) misuse ;;
*) break ;;
esac
done
if ! [ -f "$guile" -a -x "$guile" ] ; then
echo "ERROR: Cannot execute $guile" 1>&2
exit 2
fi
# Disallow mixed suites until/unless we can unify the log/trs files
have_sr64=''
have_test_lib=''
for test_file in "$@"; do
case "$test_file" in
*.sr64) have_sr64=true ;;
*) have_test_lib=true ;;
esac
done
if test "$have_sr64" -a "$have_test_lib"; then
echo 'Cannot currently mix (test-suite lib) and SRFI-64 tests' 1>&2
exit 2
fi
exec_srfi_64()
{
exec "$guile" \
--debug \
--no-auto-compile \
-e '(@@ (srfi srfi-64 automake) main)' \
-- \
--test-suite "$test_suite_dir/tests" \
--log-file "$log_file" \
"$@"
}
if test "$have_sr64"; then
if test "$trs_file"; then
exec_srfi_64 --trs-file "$trs_file" "$@"
else
exec_srfi_64 "$@"
fi
fi
exec_test_lib()
{
export TEST_SUITE_DIR="$test_suite_dir"
export GUILE_LOAD_PATH="$test_suite_dir"
exec "$guile" \
--debug \
-L "$test_suite_dir" \
--no-auto-compile -e main -s "$test_suite_dir/guile-test" \
--test-suite "$test_suite_dir/tests" \
--log-file "$log_file" \
"$@"
}
if test "$trs_file"; then
exec_test_lib --trs-file "$trs_file" "$@"
else
exec_test_lib "$@"
fi