2022-02-06 23:23:02 +00:00
#!/bin/sh
# `run-gnu-test.bash [TEST]`
2022-02-03 19:42:13 +00:00
# run GNU test (or all tests if TEST is missing/null)
2022-02-06 23:23:02 +00:00
#
2022-02-12 17:47:55 +00:00
# UU_MAKE_PROFILE == 'debug' | 'release' ## build profile used for *uutils* build; may be supplied by caller, defaults to 'release'
2022-02-06 23:23:02 +00:00
# spell-checker:ignore (env/vars) GNULIB SRCDIR SUBDIRS ; (utils) shellcheck
2022-02-03 19:42:13 +00:00
2022-02-22 14:00:37 +00:00
# ref: [How the GNU coreutils are tested](https://www.pixelbeat.org/docs/coreutils-testing.html) @@ <https://archive.is/p2ITW>
# * note: to run a single test => `make check TESTS=PATH/TO/TEST/SCRIPT SUBDIRS=. VERBOSE=yes`
2022-02-03 19:42:13 +00:00
ME_dir = " $( dirname -- " $( readlink -fm -- " $0 " ) " ) "
REPO_main_dir = " $( dirname -- " ${ ME_dir } " ) "
2022-02-06 23:23:02 +00:00
echo " ME_dir=' ${ ME_dir } ' "
echo " REPO_main_dir=' ${ REPO_main_dir } ' "
2021-05-21 16:25:23 +00:00
set -e
2022-02-03 19:42:13 +00:00
2022-02-06 23:23:02 +00:00
### * config (from environment with fallback defaults); note: GNU and GNULIB are expected to be sibling repo directories
2022-02-03 19:42:13 +00:00
path_UUTILS = ${ path_UUTILS :- ${ REPO_main_dir } }
2022-02-06 23:23:02 +00:00
path_GNU = " $( readlink -fm -- " ${ path_GNU :- ${ path_UUTILS } /../gnu } " ) "
2022-02-03 19:42:13 +00:00
2022-02-06 23:23:02 +00:00
echo " path_UUTILS=' ${ path_UUTILS } ' "
echo " path_GNU=' ${ path_GNU } ' "
2022-02-03 19:42:13 +00:00
2022-02-06 23:23:02 +00:00
###
2022-02-03 19:42:13 +00:00
2022-02-06 23:23:02 +00:00
cd " ${ path_GNU } " && echo " [ pwd:' ${ PWD } ' ] "
2021-05-21 16:25:23 +00:00
2021-06-02 18:59:53 +00:00
export RUST_BACKTRACE = 1
2021-06-02 19:21:12 +00:00
if test -n " $1 " ; then
# if set, run only the test passed
export RUN_TEST = " TESTS= $1 "
fi
2022-02-06 23:23:02 +00:00
# * timeout used to kill occasionally errant/"stuck" processes (note: 'release' testing takes ~1 hour; 'debug' testing takes ~2.5 hours)
# * `gl_public_submodule_commit=` disables testing for use of a "public" gnulib commit (which will fail when using shallow gnulib checkouts)
# * `srcdir=..` specifies the GNU source directory for tests (fixing failing/confused 'tests/factor/tNN.sh' tests and causing no harm to other tests)
2022-02-01 06:55:11 +00:00
#shellcheck disable=SC2086
2022-02-12 17:48:38 +00:00
timeout -sKILL 4h make -j " $( nproc) " check ${ RUN_TEST } SUBDIRS = . RUN_EXPENSIVE_TESTS = yes RUN_VERY_EXPENSIVE_TESTS = yes VERBOSE = no gl_public_submodule_commit = "" srcdir = " ${ path_GNU } " || : # Kill after 4 hours in case something gets stuck in make
2022-02-20 10:29:18 +00:00
if test -z " $1 " && test -n " $CI " ; then
sudo make -j " $( nproc) " check-root SUBDIRS = . RUN_EXPENSIVE_TESTS = yes RUN_VERY_EXPENSIVE_TESTS = yes VERBOSE = no gl_public_submodule_commit = "" srcdir = " ${ path_GNU } " TEST_SUITE_LOG = "tests/test-suite-root.log" || :
fi