about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-02-06 22:35:54 -0800
committerEric Wong <normalperson@yhbt.net>2009-02-09 19:52:19 -0800
commit0b9dac5de7ecf8111dd3d9fa621edc759c9c47e3 (patch)
tree9d68b83029ef73eb81a2c67651e80329ed314187
parentafdae82eb156320cbee0fbd88800a9f56f78b645 (diff)
downloadunicorn-0b9dac5de7ecf8111dd3d9fa621edc759c9c47e3.tar.gz
Makes it much easier to track down failures if you know
something failed in the first place.  A failed test early on
could be hidden because noise from successful tests drowned it
out.
-rw-r--r--GNUmakefile12
-rwxr-xr-xtest/aggregate.rb13
2 files changed, 23 insertions, 2 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 79ed355..8ee81c2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -9,16 +9,24 @@ slow_tests := test/unit/test_server.rb
 awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}'
 T := $(filter-out $(slow_tests),$(wildcard test/unit/test*.rb))
 T_n := $(shell $(awk_slow) $(slow_tests))
+t_log := $(subst .rb,.log,$(T)) $(subst .n,.log,$(T_n))
 test: $(T) $(T_n)
+        @cat $(t_log) | ruby test/aggregate.rb
+        @$(RM) $(t_log)
 
 $(slow_tests):
         @$(MAKE) $(shell $(awk_slow) $@)
 %.n: arg = $(subst .n,,$(subst --, -n ,$@))
 %.n: name = $(subst .n,,$(subst --, ,$@))
+%.n: t = $(subst .n,.log,$@)
 %.n: lib/http11.$(DLEXT)
-        @echo '**** $(name) ****'; ruby -I lib $(arg) $(TEST_OPTS)
+        @echo '**** $(name) ****'; ruby -I lib $(arg) $(TEST_OPTS) >$(t)+ 2>&1
+        @mv $(t)+ $(t)
+
+$(T): t = $(subst .rb,.log,$@)
 $(T): lib/http11.$(DLEXT)
-        @echo '**** $@ ****'; ruby -I lib $@ $(TEST_OPTS)
+        @echo '**** $@ ****'; ruby -I lib $@ $(TEST_OPTS) > $(t)+ 2>&1
+        @mv $(t)+ $(t)
 
 http11_deps := $(addprefix ext/http11/, \
                  ext_help.h http11.c http11_parser.c http11_parser.h \
diff --git a/test/aggregate.rb b/test/aggregate.rb
new file mode 100755
index 0000000..1c2cc5c
--- /dev/null
+++ b/test/aggregate.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/ruby -n
+BEGIN { $tests = $assertions = $failures = $errors = 0 }
+
+$_ =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/ or next
+$tests += $1.to_i
+$assertions += $2.to_i
+$failures += $3.to_i
+$errors += $4.to_i
+
+END {
+  printf("\n%d tests, %d assertions, %d failures, %d errors\n",
+         $tests, $assertions, $failures, $errors)
+}