1 # Makefile.sh - POSIX Makefile scripting adjunct for TopGit tests
2 # Copyright (C) 2017 Kyle J. McKay
6 # Set MAKEFILESH_DEBUG to get:
7 # 1. All defined environment variales saved to Makefile.var
9 # 3. set -v if MAKEFILESH_DEBUG contains "v"
12 .
"$MKTOP/Makefile.sh" # top-level defines
14 # prevent crazy "sh" implementations from exporting functions into environment
17 # wrap it up for safe returns
18 # "$@" is the current build target(s), if any
21 # config.sh is wrapped up for return safety
24 # config.sh may not unset these
25 : "${SHELL_PATH:=/bin/sh}" "${DIFF:=diff}" "${PROVE:=prove}"
26 : "${TEST_LINT=test-lint}"
27 TEST_RESULTS_DIRECTORY
="${TEST_OUTPUT_DIRECTORY:+$TEST_OUTPUT_DIRECTORY/}test-results"
29 quotevar SHELL_PATH SHELL_PATH_SQ
30 quotevar PERL_PATH PERL_PATH_SQ
31 quotevar GIT_PATH GIT_PATH_SQ
32 quotevar TEST_RESULTS_DIRECTORY TEST_RESULTS_DIRECTORY_SQ
34 # Default list of tests is all t????-*.sh files
36 v_wildcard ALLT
't[0-9][0-9][0-9][0-9]-*.sh'
38 [ -n "$T" ] || T
="$ALLT"
39 [ -n "$LITTESTS" ] || LINTTESTS
="$T"
41 # Extra shell scripts to run through check-non-portable-shell.pl
42 # These will ALWAYS be "checked" whenever the test-lint target is made
43 # By default all $(T) test files are checked so they don't need to be
46 v_wildcard LINTSCRIPTS
'*.sh'
47 v_filter_out LINTSCRIPTS
"$ALLT" $LINTSCRIPTS
48 v_sort LINTSCRIPTS
$LINTSCRIPTS
50 if [ -z "$TESTLIB_NO_CACHE" ]; then
51 CACHE_SETUP
='TESTLIB_CACHE="$$($(SHELL_PATH_SQ) ./test-lib.sh --cache $(TESTLIB_TEST_OPTS) 2>/dev/null || :)"'
52 CACHE_SETUP_TTY
='! test -t 1 || { TESTLIB_FORCETTY=1 && export TESTLIB_FORCETTY; }; $(CACHE_SETUP)'
55 if [ -n "$TESTLIB_NO_CLEAN" ]; then
59 [ -z "$MAKEFILESH_DEBUG" ] ||
{
60 printenv | LC_ALL
=C
grep '^[_A-Za-z][_A-Za-z0-9]*=' | LC_ALL
=C
sort
63 # Force TG-TEST-SETTINGS to be updated now if needed
64 ${MAKE:-make} ${GNO_PD_OPT} -e -f Makefile.mak FORCE_SETTINGS_BUILD
=FORCE TG-TEST-SETTINGS
69 .
"$MKTOP/gnomake.sh" &&