Modify test-lib.sh to output stats to t/test-results/*
This change is needed order to aggregate data on the test run later on. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sverre Rabbelier committed
Jun 8, 2008 at 16:04 UTC
2d84e9fb6d281ed039bd67aafcdd8516a2b5226e
2 files changed
+15
-2
t/Makefile
+1
-1
@@ -20,7 +20,7 @@ $(T):
20
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
21
22
clean:
23
- $(RM) -r 'trash directory'
23
+ $(RM) -r 'trash directory' test-results
24
25
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
26
full-svn-test:
t/test-lib.sh
+14
-1
@@ -152,6 +152,7 @@ test_failure=0
152
test_count=0
153
test_fixed=0
154
test_broken=0
155
+test_success=0
156
157
die () {
158
echo >&5 "FATAL: Unexpected exit with code $?"
@@ -193,6 +194,7 @@ test_tick () {
194
195
test_ok_ () {
196
test_count=$(expr "$test_count" + 1)
197
+ test_success=$(expr "$test_success" + 1)
198
say_color "" " ok $test_count: $@"
199
}
200
@@ -353,6 +355,16 @@ test_create_repo () {
355
356
test_done () {
357
trap - exit
358
+ test_results_dir="$TEST_DIRECTORY/test-results"
359
+ mkdir -p "$test_results_dir"
360
+ test_results_path="$test_results_dir/${0%-*}-$$"
361
+
362
+ echo "total $test_count" >> $test_results_path
363
+ echo "success $test_success" >> $test_results_path
364
+ echo "fixed $test_fixed" >> $test_results_path
365
+ echo "broken $test_broken" >> $test_results_path
366
+ echo "failed $test_failure" >> $test_results_path
367
+ echo "" >> $test_results_path
368
369
if test "$test_fixed" != 0
370
then
@@ -387,7 +399,8 @@ test_done () {
399
400
# Test the binaries we have just built. The tests are kept in
401
# t/ subdirectory and are run in trash subdirectory.
390
-PATH=$(pwd)/..:$PATH
402
+TEST_DIRECTORY=$(pwd)
403
+PATH=$TEST_DIRECTORY/..:$PATH
404
GIT_EXEC_PATH=$(pwd)/..
405
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
406
unset GIT_CONFIG