Merge branch 'jk/test-output'
When TEST_OUTPUT_DIRECTORY setting is used, it was handled somewhat inconsistently between the test framework and t/Makefile, and logic to summarize the results looked at a wrong place. * jk/test-output: t/Makefile: don't define TEST_RESULTS_DIRECTORY recursively test output: respect $TEST_OUTPUT_DIRECTORY t/Makefile: fix result handling with TEST_OUTPUT_DIRECTORY
This commit is contained in:
commit
31d176d083
3
Makefile
3
Makefile
@ -2159,6 +2159,9 @@ GIT-BUILD-OPTIONS: FORCE
|
||||
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
|
||||
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
|
||||
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
|
||||
ifdef TEST_OUTPUT_DIRECTORY
|
||||
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@
|
||||
endif
|
||||
ifdef GIT_TEST_OPTS
|
||||
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@
|
||||
endif
|
||||
|
13
t/Makefile
13
t/Makefile
@ -15,9 +15,16 @@ PROVE ?= prove
|
||||
DEFAULT_TEST_TARGET ?= test
|
||||
TEST_LINT ?= test-lint-duplicates test-lint-executable
|
||||
|
||||
ifdef TEST_OUTPUT_DIRECTORY
|
||||
TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results
|
||||
else
|
||||
TEST_RESULTS_DIRECTORY = test-results
|
||||
endif
|
||||
|
||||
# Shell quote;
|
||||
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
||||
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
|
||||
TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
|
||||
|
||||
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
||||
TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
|
||||
@ -36,10 +43,10 @@ $(T):
|
||||
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
||||
|
||||
pre-clean:
|
||||
$(RM) -r test-results
|
||||
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
||||
|
||||
clean-except-prove-cache:
|
||||
$(RM) -r 'trash directory'.* test-results
|
||||
$(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)'
|
||||
$(RM) -r valgrind/bin
|
||||
|
||||
clean: clean-except-prove-cache
|
||||
@ -65,7 +72,7 @@ aggregate-results-and-cleanup: $(T)
|
||||
$(MAKE) clean
|
||||
|
||||
aggregate-results:
|
||||
for f in test-results/t*-*.counts; do \
|
||||
for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
|
||||
echo "$$f"; \
|
||||
done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
|
||||
|
||||
|
@ -54,8 +54,8 @@ done,*)
|
||||
# do not redirect again
|
||||
;;
|
||||
*' --tee '*|*' --va'*)
|
||||
mkdir -p test-results
|
||||
BASE=test-results/$(basename "$0" .sh)
|
||||
mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results"
|
||||
BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)"
|
||||
(GIT_TEST_TEE_STARTED=done ${SHELL_PATH} "$0" "$@" 2>&1;
|
||||
echo $? > $BASE.exit) | tee $BASE.out
|
||||
test "$(cat $BASE.exit)" = 0
|
||||
|
@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
out_prefix=$(dirname "$0")/../test-results/valgrind.out
|
||||
# Get TEST_OUTPUT_DIRECTORY from GIT-BUILD-OPTIONS if it's there...
|
||||
. "$(dirname "$0")/../../GIT-BUILD-OPTIONS"
|
||||
# ... otherwise set it to the default value.
|
||||
: ${TEST_OUTPUT_DIRECTORY=$(dirname "$0")/..}
|
||||
|
||||
output=
|
||||
count=0
|
||||
total_count=0
|
||||
@ -115,7 +119,7 @@ handle_one () {
|
||||
finish_output
|
||||
}
|
||||
|
||||
for test_script in "$(dirname "$0")"/../test-results/*.out
|
||||
for test_script in "$TEST_OUTPUT_DIRECTORY"/test-results/*.out
|
||||
do
|
||||
handle_one $test_script
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user