From 2d84e9fb6d281ed039bd67aafcdd8516a2b5226e Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sun, 8 Jun 2008 16:04:33 +0200 Subject: [PATCH 1/3] 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 Signed-off-by: Junio C Hamano --- t/Makefile | 2 +- t/test-lib.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/t/Makefile b/t/Makefile index c6a60ab165..dfa90ace1a 100644 --- a/t/Makefile +++ b/t/Makefile @@ -20,7 +20,7 @@ $(T): @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) clean: - $(RM) -r 'trash directory' + $(RM) -r 'trash directory' test-results # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL full-svn-test: diff --git a/t/test-lib.sh b/t/test-lib.sh index 7a8bd27abc..2ad3f4a126 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -152,6 +152,7 @@ test_failure=0 test_count=0 test_fixed=0 test_broken=0 +test_success=0 die () { echo >&5 "FATAL: Unexpected exit with code $?" @@ -193,6 +194,7 @@ test_tick () { test_ok_ () { test_count=$(expr "$test_count" + 1) + test_success=$(expr "$test_success" + 1) say_color "" " ok $test_count: $@" } @@ -353,6 +355,16 @@ test_create_repo () { test_done () { trap - exit + test_results_dir="$TEST_DIRECTORY/test-results" + mkdir -p "$test_results_dir" + test_results_path="$test_results_dir/${0%-*}-$$" + + echo "total $test_count" >> $test_results_path + echo "success $test_success" >> $test_results_path + echo "fixed $test_fixed" >> $test_results_path + echo "broken $test_broken" >> $test_results_path + echo "failed $test_failure" >> $test_results_path + echo "" >> $test_results_path if test "$test_fixed" != 0 then @@ -387,7 +399,8 @@ test_done () { # Test the binaries we have just built. The tests are kept in # t/ subdirectory and are run in trash subdirectory. -PATH=$(pwd)/..:$PATH +TEST_DIRECTORY=$(pwd) +PATH=$TEST_DIRECTORY/..:$PATH GIT_EXEC_PATH=$(pwd)/.. GIT_TEMPLATE_DIR=$(pwd)/../templates/blt unset GIT_CONFIG From 0a392cb8cb4df41a82ac75e1052587b9a2c6f393 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 8 Jun 2008 16:04:34 +0200 Subject: [PATCH 2/3] A simple script to parse the results from the testcases This is a simple script that aggregates key:value pairs in a file. Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- t/aggregate-results.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 t/aggregate-results.sh diff --git a/t/aggregate-results.sh b/t/aggregate-results.sh new file mode 100755 index 0000000000..52e88e3046 --- /dev/null +++ b/t/aggregate-results.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +fixed=0 +success=0 +failed=0 +broken=0 +total=0 + +for file +do + while read type value + do + case $type in + '') + continue ;; + fixed) + fixed=$(($fixed + $value)) ;; + success) + success=$(($success + $value)) ;; + failed) + failed=$(($failed + $value)) ;; + broken) + broken=$(( $broken + $value)) ;; + total) + total=$(( $total + $value)) ;; + esac + done <"$file" +done + +printf "%-8s%d\n" fixed $fixed +printf "%-8s%d\n" success $success +printf "%-8s%d\n" failed $failed +printf "%-8s%d\n" broken $broken +printf "%-8s%d\n" total $total From f8d5ffc2c7c002cebb8842afcf58cbd4cea481b8 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sun, 8 Jun 2008 16:04:35 +0200 Subject: [PATCH 3/3] Hook up the result aggregation in the test makefile. This patch makes 'make' output the aggregated results at the end of each build. The 'git-test-result' file is removed both before and after each build. Signed-off-by: Sverre Rabbelier Signed-off-by: Junio C Hamano --- t/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/Makefile b/t/Makefile index dfa90ace1a..a778865ae7 100644 --- a/t/Makefile +++ b/t/Makefile @@ -14,18 +14,24 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) TSVN = $(wildcard t91[0-9][0-9]-*.sh) -all: $(T) clean +all: pre-clean $(T) aggregate-results clean $(T): @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) +pre-clean: + $(RM) -r test-results + clean: $(RM) -r 'trash directory' test-results +aggregate-results: + ./aggregate-results.sh test-results/t*-* + # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL full-svn-test: $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8 -.PHONY: $(T) clean +.PHONY: pre-clean $(T) aggregate-results clean .NOTPARALLEL: