{"thread":{"id":"17543","subject":"[PATCH 1/8] Add valgrind support in test scripts","startedAt":"2009-02-03T23:25:59Z","lastAt":"2009-02-06T20:24:26Z","messageCount":11,"participants":["Johannes Schindelin","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"103040","messageId":"alpine.DEB.1.00.0902040025580.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/8] Add valgrind support in test scripts","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:25:59Z","receivedAt":"2009-02-03T23:25:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This patch adds the ability to use valgrind's memcheck tool to\ndiagnose memory problems in Git while running the test scripts.\n\nIt requires valgrind 3.4.0 or newer.\n\nIt works by creating symlinks to a valgrind script, which have the same\nname as our Git binaries, and then putting that directory in front of\nthe test script's PATH as well as set GIT_EXEC_PATH to that directory.\nGit scripts are symlinked from that directory directly.\n\nThat way, Git binaries called by Git scripts are valgrinded, too.\n\nValgrind can be used by specifying \"GIT_TEST_OPTS=--valgrind\" in the\nmake invocation. Any invocation of git that finds any errors under\nvalgrind will exit with failure code 126. Any valgrind output will go\nto the usual stderr channel for tests (i.e., /dev/null, unless -v has\nbeen specified).\n\nIf you need to pass options to valgrind -- you might want to run\nanother tool than memcheck, for example -- you can set the environment\nvariable GIT_VALGRIND_OPTIONS.\n\nA few default suppressions are included, since libz seems to trigger\nquite a few false positives. We'll assume that libz works and that we\ncan ignore any errors which are reported there.\n\nNote: it is safe to run the valgrind tests in parallel, as the links in\nt/valgrind/bin/ are created using proper locking.\n\nInitial patch and all the hard work by Jeff King.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/README                |    8 +++++-\n t/test-lib.sh           |   58 +++++++++++++++++++++++++++++++++++++++++++++-\n t/valgrind/.gitignore   |    2 +\n t/valgrind/default.supp |   21 +++++++++++++++++\n t/valgrind/valgrind.sh  |   13 ++++++++++\n 5 files changed, 99 insertions(+), 3 deletions(-)\n create mode 100644 t/valgrind/.gitignore\n create mode 100644 t/valgrind/default.supp\n create mode 100755 t/valgrind/valgrind.sh\n\ndiff --git a/t/README b/t/README\nindex f208cf1..7560db5 100644\n--- a/t/README\n+++ b/t/README\n@@ -39,7 +39,8 @@ this:\n     * passed all 3 test(s)\n \n You can pass --verbose (or -v), --debug (or -d), and --immediate\n-(or -i) command line argument to the test.\n+(or -i) command line argument to the test, or by setting GIT_TEST_OPTS\n+appropriately before running \"make\".\n \n --verbose::\n \tThis makes the test more verbose.  Specifically, the\n@@ -58,6 +59,11 @@ You can pass --verbose (or -v), --debug (or -d), and --immediate\n \tThis causes additional long-running tests to be run (where\n \tavailable), for more exhaustive testing.\n \n+--valgrind::\n+\tExecute all Git binaries with valgrind and exit with status\n+\t126 on errors (just like regular tests, this will only stop\n+\tthe test script when running under -i).  Valgrind errors\n+\tgo to stderr, so you might want to pass the -v option, too.\n \n Skipping Tests\n --------------\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex c1839f7..aa9f938 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -94,6 +94,8 @@ do\n \t--no-python)\n \t\t# noop now...\n \t\tshift ;;\n+\t--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)\n+\t\tvalgrind=t; shift ;;\n \t*)\n \t\tbreak ;;\n \tesac\n@@ -492,8 +494,60 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n-PATH=$TEST_DIRECTORY/..:$PATH\n-GIT_EXEC_PATH=$(pwd)/..\n+if test -z \"$valgrind\"\n+then\n+\tPATH=$TEST_DIRECTORY/..:$PATH\n+\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n+else\n+\tmake_symlink () {\n+\t\ttest -h \"$2\" &&\n+\t\ttest \"$1\" = \"$(readlink \"$2\")\" || {\n+\t\t\t# be super paranoid\n+\t\t\tif mkdir \"$2\".lock\n+\t\t\tthen\n+\t\t\t\trm -f \"$2\" &&\n+\t\t\t\tln -s \"$1\" \"$2\" &&\n+\t\t\t\trm -r \"$2\".lock\n+\t\t\telse\n+\t\t\t\twhile test -d \"$2\".lock\n+\t\t\t\tdo\n+\t\t\t\t\tsay \"Waiting for lock on $2.\"\n+\t\t\t\t\tsleep 1\n+\t\t\t\tdone\n+\t\t\tfi\n+\t\t}\n+\t}\n+\n+\tmake_valgrind_symlink () {\n+\t\t# handle only executables\n+\t\ttest -x \"$1\" || return\n+\n+\t\tbase=$(basename \"$1\")\n+\t\tsymlink_target=$TEST_DIRECTORY/../$base\n+\t\t# do not override scripts\n+\t\tif test -x \"$symlink_target\" &&\n+\t\t    test ! -d \"$symlink_target\" &&\n+\t\t    test \"#!\" != \"$(head -c 2 < \"$symlink_target\")\"\n+\t\tthen\n+\t\t\tsymlink_target=../valgrind.sh\n+\t\tfi\n+\t\t# create the link, or replace it if it is out of date\n+\t\tmake_symlink \"$symlink_target\" \"$GIT_VALGRIND/bin/$base\" || exit\n+\t}\n+\n+\t# override all git executables in TEST_DIRECTORY/..\n+\tGIT_VALGRIND=$TEST_DIRECTORY/valgrind\n+\tmkdir -p \"$GIT_VALGRIND\"/bin\n+\tfor file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*\n+\tdo\n+\t\tmake_valgrind_symlink $file\n+\tdone\n+\tPATH=$GIT_VALGRIND/bin:$PATH\n+\tGIT_EXEC_PATH=$GIT_VALGRIND/bin\n+\texport GIT_VALGRIND\n+\n+\tmake_symlink ../../../templates \"$GIT_VALGRIND\"/bin/templates || exit\n+fi\n GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\ndiff --git a/t/valgrind/.gitignore b/t/valgrind/.gitignore\nnew file mode 100644\nindex 0000000..d4ae667\n--- /dev/null\n+++ b/t/valgrind/.gitignore\n@@ -0,0 +1,2 @@\n+/bin/\n+/templates\ndiff --git a/t/valgrind/default.supp b/t/valgrind/default.supp\nnew file mode 100644\nindex 0000000..2482b3b\n--- /dev/null\n+++ b/t/valgrind/default.supp\n@@ -0,0 +1,21 @@\n+{\n+\tignore-zlib-errors-cond\n+\tMemcheck:Cond\n+\tobj:*libz.so*\n+}\n+\n+{\n+\tignore-zlib-errors-value4\n+\tMemcheck:Value4\n+\tobj:*libz.so*\n+}\n+\n+{\n+\twriting-data-from-zlib-triggers-errors\n+\tMemcheck:Param\n+\twrite(buf)\n+\tobj:/lib/ld-*.so\n+\tfun:write_in_full\n+\tfun:write_buffer\n+\tfun:write_loose_object\n+}\ndiff --git a/t/valgrind/valgrind.sh b/t/valgrind/valgrind.sh\nnew file mode 100755\nindex 0000000..dc92612\n--- /dev/null\n+++ b/t/valgrind/valgrind.sh\n@@ -0,0 +1,13 @@\n+#!/bin/sh\n+\n+base=$(basename \"$0\")\n+\n+exec valgrind -q --error-exitcode=126 \\\n+\t--leak-check=no \\\n+\t--suppressions=\"$GIT_VALGRIND/default.supp\" \\\n+\t--gen-suppressions=all \\\n+\t--track-origins=yes \\\n+\t--log-fd=4 \\\n+\t--input-fd=4 \\\n+\t$GIT_VALGRIND_OPTIONS \\\n+\t\"$GIT_VALGRIND\"/../../\"$base\" \"$@\"\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103043","messageId":"alpine.DEB.1.00.0902040024490.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/8] valgrind: ignore ldso and more libz errors","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:03Z","receivedAt":"2009-02-03T23:26:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nOn some Linux systems, we get a host of Cond and Addr errors\nfrom calls to dlopen that are caused by nss modules. We\nshould be able to safely ignore anything happening in\nld-*.so as \"not our problem.\"\n\n[Johannes: I added some more... unfortunately using valgrind 3.4.0 syntax]\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/valgrind/default.supp |   30 ++++++++++++++++++++++++++----\n 1 files changed, 26 insertions(+), 4 deletions(-)\n\ndiff --git a/t/valgrind/default.supp b/t/valgrind/default.supp\nindex 2482b3b..5f341b8 100644\n--- a/t/valgrind/default.supp\n+++ b/t/valgrind/default.supp\n@@ -5,17 +5,39 @@\n }\n \n {\n+\tignore-zlib-errors-value8\n+\tMemcheck:Value8\n+\tobj:*libz.so*\n+}\n+\n+{\n \tignore-zlib-errors-value4\n \tMemcheck:Value4\n \tobj:*libz.so*\n }\n \n {\n-\twriting-data-from-zlib-triggers-errors\n+\tignore-ldso-cond\n+\tMemcheck:Cond\n+\tobj:*ld-*.so\n+}\n+\n+{\n+\tignore-ldso-addr8\n+\tMemcheck:Addr8\n+\tobj:*ld-*.so\n+}\n+\n+{\n+\tignore-ldso-addr4\n+\tMemcheck:Addr4\n+\tobj:*ld-*.so\n+}\n+\n+{\n+\twriting-data-from-zlib-triggers-even-more-errors\n \tMemcheck:Param\n \twrite(buf)\n-\tobj:/lib/ld-*.so\n-\tfun:write_in_full\n-\tfun:write_buffer\n+\t...\n \tfun:write_loose_object\n }\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103042","messageId":"alpine.DEB.1.00.0902040026080.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 3/8] Valgrind support: check for more than just programming errors","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:08Z","receivedAt":"2009-02-03T23:26:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This patch makes --valgrind try to override _all_ Git binaries in the\nPATH, and it makes it an error to call *.sh and *.perl scripts directly.\n\nWhile it is not strictly necessary to look through the whole PATH to\nfind git binaries to override, it is in line with running an expensive\ntest (which valgrind is) to make extra sure that only binaries are\ntested that actually come from the git.git checkout.\n\nIn the same spirit, we can test that neither our test suite nor our\nscripts try to run the *.sh or *.perl scripts directly.\n\nIt's more like a \"because we can\" than a \"this is tightly connected\nto valgrind\", but in the author's opinion \"because we can\" is \"so we\nshould\" in this case.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/test-lib.sh |   15 +++++++++++++++\n 1 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex aa9f938..2567c74 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -531,6 +531,10 @@ else\n \t\tthen\n \t\t\tsymlink_target=../valgrind.sh\n \t\tfi\n+\t\tcase \"$base\" in\n+\t\t*.sh|*.perl)\n+\t\t\tsymlink_target=../unprocessed-script\n+\t\tesac\n \t\t# create the link, or replace it if it is out of date\n \t\tmake_symlink \"$symlink_target\" \"$GIT_VALGRIND/bin/$base\" || exit\n \t}\n@@ -542,6 +546,17 @@ else\n \tdo\n \t\tmake_valgrind_symlink $file\n \tdone\n+\tOLDIFS=$IFS\n+\tIFS=:\n+\tfor path in $PATH\n+\tdo\n+\t\tls \"$path\"/git-* 2> /dev/null |\n+\t\twhile read file\n+\t\tdo\n+\t\t\tmake_valgrind_symlink \"$file\"\n+\t\tdone\n+\tdone\n+\tIFS=$OLDIFS\n \tPATH=$GIT_VALGRIND/bin:$PATH\n \tGIT_EXEC_PATH=$GIT_VALGRIND/bin\n \texport GIT_VALGRIND\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103047","messageId":"alpine.DEB.1.00.0902040026120.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 4/8] test-lib.sh: optionally output to test-results/$TEST.out, too","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:12Z","receivedAt":"2009-02-03T23:26:12Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When tests are run in parallel and a few tests fail, it does not help\nthat the output of the terminal is totally confusing, as you rarely know\nwhich test which line came from.\n\nSo introduce the option '--tee' which triggers that the output of the\ntests will be written to t/test-results/$TEST.out in addition to the\nterminal, where $TEST is the basename of the script.\n\nUnfortunately, there seems to be no way to redirect a given file\ndescriptor to a specified subprocess in POSIX shell, only redirection\nto a file is supported via 'exec > $FILE'.\n\nAt least with bash, one might think that 'exec >($COMMAND)' would work\nas intended, but it does not.\n\nThe common way to work around the lack of proper tools support is to\nwork with named pipes, alas, one of our most beloved platforms does not\nreally support named pipes.  Besides, we would need a pipe for every\nscript, as the whole point of this patch is to allow parallel execution.\n\nTherefore, we handle the redirection in the following way: when '--tee'\nwas passed to the test script, the variable GIT_TEST_TEE_STARTED is set\n(to avoid triggering that code path again) and the script is started\n_again_, in a subshell, redirected to the command \"tee\".\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/README      |    6 ++++++\n t/test-lib.sh |   18 ++++++++++++++++++\n 2 files changed, 24 insertions(+), 0 deletions(-)\n\ndiff --git a/t/README b/t/README\nindex 7560db5..ed1ebb6 100644\n--- a/t/README\n+++ b/t/README\n@@ -65,6 +65,12 @@ appropriately before running \"make\".\n \tthe test script when running under -i).  Valgrind errors\n \tgo to stderr, so you might want to pass the -v option, too.\n \n+--tee::\n+\tIn addition to printing the test output to the terminal,\n+\twrite it to files named 't/test-results/$TEST_NAME.out'.\n+\tAs the names depend on the tests' file names, it is safe to\n+\trun the tests with this option in parallel.\n+\n Skipping Tests\n --------------\n \ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 2567c74..2fb2274 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -3,6 +3,22 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n+# if --tee was passed, write the output not only to the terminal, but\n+# additionally to the file test-results/$BASENAME.out, too.\n+case \"$GIT_TEST_TEE_STARTED, $* \" in\n+done,*)\n+\t# do not redirect again\n+\t;;\n+*' --tee '*)\n+\tmkdir -p test-results\n+\tBASE=test-results/$(basename \"$0\" .sh)\n+\t(GIT_TEST_TEE_STARTED=done ${SHELL-sh} \"$0\" \"$@\" 2>&1;\n+\t echo $? > $BASE.exit) | tee $BASE.out\n+\ttest \"$(cat $BASE.exit)\" = 0\n+\texit\n+\t;;\n+esac\n+\n # Keep the original TERM for say_color\n ORIGINAL_TERM=$TERM\n \n@@ -96,6 +112,8 @@ do\n \t\tshift ;;\n \t--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)\n \t\tvalgrind=t; shift ;;\n+\t--tee)\n+\t\tshift ;; # was handled already\n \t*)\n \t\tbreak ;;\n \tesac\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103046","messageId":"alpine.DEB.1.00.0902040026170.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 5/8] t/Makefile: provide a 'valgrind' target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:18Z","receivedAt":"2009-02-03T23:26:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is easy to forget running valgrinded tests without -v, and it is\nalso easy to forget to redirect the output to \"tee\" (lest the output\nscroll out of the terminal's buffer).  Running \"make valgrind\" will\ntake care of all that.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/Makefile |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/t/Makefile b/t/Makefile\nindex ed49c20..e544493 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -38,4 +38,7 @@ full-svn-test:\n \t$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C\n \t$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8\n \n-.PHONY: pre-clean $(T) aggregate-results clean\n+valgrind:\n+\tGIT_TEST_OPTS='--valgrind -v --tee' $(MAKE) -k\n+\n+.PHONY: pre-clean $(T) aggregate-results clean valgrind\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103048","messageId":"alpine.DEB.1.00.0902040026220.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 6/8] Add a script to coalesce the valgrind outputs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:22Z","receivedAt":"2009-02-03T23:26:22Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"After running the valgrind tests with GIT_TEST_TREE=t, the test output\nis in the test-results/$TEST.out files.\n\nCall ./valgrind/analyze.sh in $GIT_ROOT/t/ to group the valgrind errors\nby backtrace.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/valgrind/analyze.sh |  123 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 123 insertions(+), 0 deletions(-)\n create mode 100755 t/valgrind/analyze.sh\n\ndiff --git a/t/valgrind/analyze.sh b/t/valgrind/analyze.sh\nnew file mode 100755\nindex 0000000..d8105d9\n--- /dev/null\n+++ b/t/valgrind/analyze.sh\n@@ -0,0 +1,123 @@\n+#!/bin/sh\n+\n+out_prefix=$(dirname \"$0\")/../test-results/valgrind.out\n+output=\n+count=0\n+total_count=0\n+missing_message=\n+new_line='\n+'\n+\n+# start outputting the current valgrind error in $out_prefix.++$count,\n+# and the test case which failed in the corresponding .message file\n+start_output () {\n+\ttest -z \"$output\" || return\n+\n+\t# progress\n+\ttotal_count=$(($total_count+1))\n+\ttest -t 2 && printf \"\\rFound %d errors\" $total_count >&2\n+\n+\tcount=$(($count+1))\n+\toutput=$out_prefix.$count\n+\t: > $output\n+\n+\techo \"*** $1 ***\" > $output.message\n+}\n+\n+finish_output () {\n+\ttest ! -z \"$output\" || return\n+\toutput=\n+\n+\t# if a test case has more than one valgrind error, we need to\n+\t# copy the last .message file to the previous errors\n+\ttest -z \"$missing_message\" || {\n+\t\twhile test $missing_message -lt $count\n+\t\tdo\n+\t\t\tcp $out_prefix.$count.message \\\n+\t\t\t\t$out_prefix.$missing_message.message\n+\t\t\tmissing_message=$(($missing_message+1))\n+\t\tdone\n+\t\tmissing_message=\n+\t}\n+}\n+\n+# group the valgrind errors by backtrace\n+output_all () {\n+\tlast_line=\n+\tj=0\n+\ti=1\n+\twhile test $i -le $count\n+\tdo\n+\t\t# output <number> <backtrace-in-one-line>\n+\t\techo \"$i $(tr '\\n' ' ' < $out_prefix.$i)\"\n+\t\ti=$(($i+1))\n+\tdone |\n+\tsort -t ' ' -k 2 | # order by <backtrace-in-one-line>\n+\twhile read number line\n+\tdo\n+\t\t# find duplicates, do not output backtrace twice\n+\t\tif test \"$line\" != \"$last_line\"\n+\t\tthen\n+\t\t\tlast_line=$line\n+\t\t\tj=$(($j+1))\n+\t\t\tprintf \"\\nValgrind error $j:\\n\\n\"\n+\t\t\tcat $out_prefix.$number\n+\t\t\tprintf \"\\nfound in:\\n\"\n+\t\tfi\n+\t\t# print the test case where this came from\n+\t\tprintf \"\\n\"\n+\t\tcat $out_prefix.$number.message\n+\tdone\n+}\n+\n+handle_one () {\n+\tOLDIFS=$IFS\n+\tIFS=\"$new_line\"\n+\twhile read line\n+\tdo\n+\t\tcase \"$line\" in\n+\t\t# backtrace, possibly a new one\n+\t\t==[0-9]*)\n+\n+\t\t\t# Does the current valgrind error have a message yet?\n+\t\t\tcase \"$output\" in\n+\t\t\t*.message)\n+\t\t\t\ttest -z \"$missing_message\" &&\n+\t\t\t\tmissing_message=$count\n+\t\t\t\toutput=\n+\t\t\tesac\n+\n+\t\t\tstart_output $(basename $1)\n+\t\t\techo \"$line\" |\n+\t\t\tsed 's/==[0-9]*==/==valgrind==/' >> $output\n+\t\t\t;;\n+\t\t# end of backtrace\n+\t\t'}')\n+\t\t\ttest -z \"$output\" || {\n+\t\t\t\techo \"$line\" >> $output\n+\t\t\t\ttest $output = ${output%.message} &&\n+\t\t\t\toutput=$output.message\n+\t\t\t}\n+\t\t\t;;\n+\t\t# end of test case\n+\t\t'')\n+\t\t\tfinish_output\n+\t\t\t;;\n+\t\t# normal line; if $output is set, print the line\n+\t\t*)\n+\t\t\ttest -z \"$output\" || echo \"$line\" >> $output\n+\t\t\t;;\n+\t\tesac\n+\tdone < $1\n+\tIFS=$OLDIFS\n+\n+\t# just to be safe\n+\tfinish_output\n+}\n+\n+for test_script in \"$(dirname \"$0\")\"/../test-results/*.out\n+do\n+\thandle_one $test_script\n+done\n+\n+output_all\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103044","messageId":"alpine.DEB.1.00.0902040026250.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 7/8] Tests: let --valgrind imply --verbose and --tee","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:26Z","receivedAt":"2009-02-03T23:26:26Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It does not make much sense to run the (expensive) valgrind tests and\nnot look at the output.\n\nTo prevent output from scrolling out of reach, the parameter --tee is\nimplied, too.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/Makefile    |    2 +-\n t/README      |    4 ++++\n t/test-lib.sh |    4 ++--\n 3 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/t/Makefile b/t/Makefile\nindex e544493..0962341 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -39,6 +39,6 @@ full-svn-test:\n \t$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8\n \n valgrind:\n-\tGIT_TEST_OPTS='--valgrind -v --tee' $(MAKE) -k\n+\tGIT_TEST_OPTS=--valgrind $(MAKE)\n \n .PHONY: pre-clean $(T) aggregate-results clean valgrind\ndiff --git a/t/README b/t/README\nindex ed1ebb6..d8f6c7d 100644\n--- a/t/README\n+++ b/t/README\n@@ -65,6 +65,10 @@ appropriately before running \"make\".\n \tthe test script when running under -i).  Valgrind errors\n \tgo to stderr, so you might want to pass the -v option, too.\n \n+\tSince it makes no sense to run the tests with --valgrind and\n+\tnot see any output, this option implies --verbose.  For\n+\tconvenience, it also implies --tee.\n+\n --tee::\n \tIn addition to printing the test output to the terminal,\n \twrite it to files named 't/test-results/$TEST_NAME.out'.\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 2fb2274..495d55d 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -9,7 +9,7 @@ case \"$GIT_TEST_TEE_STARTED, $* \" in\n done,*)\n \t# do not redirect again\n \t;;\n-*' --tee '*)\n+*' --tee '*|*' --va'*)\n \tmkdir -p test-results\n \tBASE=test-results/$(basename \"$0\" .sh)\n \t(GIT_TEST_TEE_STARTED=done ${SHELL-sh} \"$0\" \"$@\" 2>&1;\n@@ -111,7 +111,7 @@ do\n \t\t# noop now...\n \t\tshift ;;\n \t--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)\n-\t\tvalgrind=t; shift ;;\n+\t\tvalgrind=t; verbose=t; shift ;;\n \t--tee)\n \t\tshift ;; # was handled already\n \t*)\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103045","messageId":"alpine.DEB.1.00.0902040026290.9822@pacific.mpi-cbg.de","threadId":"17543","inReplyTo":"cover.1233702893u.git.johannes.schindelin@gmx.de","subject":"[PATCH 8/8] test-lib: avoid assuming that templates/ are in the GIT_EXEC_PATH","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-03T23:26:31Z","receivedAt":"2009-02-03T23:26:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/test-lib.sh |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 495d55d..54bbb97 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -454,7 +454,7 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir -p \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\t\"$GIT_EXEC_PATH/git\" init \"--template=$GIT_EXEC_PATH/templates/blt/\" >&3 2>&4 ||\n+\t\"$GIT_EXEC_PATH/git\" init \"--template=$owd/../templates/blt/\" >&3 2>&4 ||\n \terror \"cannot run git init -- have you built things yet?\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n@@ -578,8 +578,6 @@ else\n \tPATH=$GIT_VALGRIND/bin:$PATH\n \tGIT_EXEC_PATH=$GIT_VALGRIND/bin\n \texport GIT_VALGRIND\n-\n-\tmake_symlink ../../../templates \"$GIT_VALGRIND\"/bin/templates || exit\n fi\n GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n unset GIT_CONFIG\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103541","messageId":"20090206190815.GB19494@coredump.intra.peff.net","threadId":"17543","inReplyTo":"alpine.DEB.1.00.0902040026250.9822@pacific.mpi-cbg.de","subject":"Re: [PATCH 7/8] Tests: let --valgrind imply --verbose and --tee","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-06T19:08:15Z","receivedAt":"2009-02-06T19:08:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 04, 2009 at 12:26:26AM +0100, Johannes Schindelin wrote:\n\n> It does not make much sense to run the (expensive) valgrind tests and\n> not look at the output.\n> \n> To prevent output from scrolling out of reach, the parameter --tee is\n> implied, too.\n\nMight it not make sense to want to send the output to a file, but _not_\nshow it on the terminal (e.g., running from a cron job)? But if I\nunderstand correctly, that is not actually possible with any combination\nof \"--verbose\" and \"--tee\".\n\nSo perhaps it would make more sense to have, rather than \"--tee\", simply\n\"--verbose\" to output to the terminal and \"--save-output\" (or similar)\nto save the output. If both are requested, it is equivalent to what\n\"--tee\" does now.\n\nOn the other hand, I think \"--verbose --tee >/dev/null\" would probably\naccomplish the same thing, so it probably isn't worth too much effort.\n\nOther than that, this series looks pretty reasonable. I am a bit late to\nack, but thank you for following through on it. It looks like it has\ncaught some bugs already, which is always a good sign. :)\n\nI have access to a decent quad-core box, so I'll try to periodically run\nthe test suite with valgrind on it. Daily is probably too much, but\nmaybe whenever we go into rc-freeze is a good time.\n\n-Peff\n"},{"id":"103549","messageId":"alpine.DEB.1.00.0902062038420.7377@intel-tinevez-2-302","threadId":"17543","inReplyTo":"20090206190815.GB19494@coredump.intra.peff.net","subject":"Re: [PATCH 7/8] Tests: let --valgrind imply --verbose and --tee","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-06T19:40:59Z","receivedAt":"2009-02-06T19:40:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 6 Feb 2009, Jeff King wrote:\n\n> On Wed, Feb 04, 2009 at 12:26:26AM +0100, Johannes Schindelin wrote:\n> \n> > It does not make much sense to run the (expensive) valgrind tests and\n> > not look at the output.\n> > \n> > To prevent output from scrolling out of reach, the parameter --tee is\n> > implied, too.\n> \n> Might it not make sense to want to send the output to a file, but _not_\n> show it on the terminal (e.g., running from a cron job)?\n\nThat is sh ... > file 2>&1\n\n> But if I understand correctly, that is not actually possible with any \n> combination of \"--verbose\" and \"--tee\".\n\nNo, it is not, indeed.\n\n> So perhaps it would make more sense to have, rather than \"--tee\", simply \n> \"--verbose\" to output to the terminal and \"--save-output\" (or similar) \n> to save the output. If both are requested, it is equivalent to what \n> \"--tee\" does now.\n\nI do not see the point in that.\n\n> On the other hand, I think \"--verbose --tee >/dev/null\" would probably \n> accomplish the same thing, so it probably isn't worth too much effort.\n\nNo.  Why would I want 'make test' to hide the fact from me that something \ndid not work, and how it happened to fail?\n\nCiao,\nDscho\n"},{"id":"103551","messageId":"20090206202425.GA19959@coredump.intra.peff.net","threadId":"17543","inReplyTo":"alpine.DEB.1.00.0902062038420.7377@intel-tinevez-2-302","subject":"Re: [PATCH 7/8] Tests: let --valgrind imply --verbose and --tee","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-06T20:24:26Z","receivedAt":"2009-02-06T20:24:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 06, 2009 at 08:40:59PM +0100, Johannes Schindelin wrote:\n\n> > On the other hand, I think \"--verbose --tee >/dev/null\" would probably \n> > accomplish the same thing, so it probably isn't worth too much effort.\n> \n> No.  Why would I want 'make test' to hide the fact from me that something \n> did not work, and how it happened to fail?\n\nBecause \"make test\" with \"--verbose\" generates megabytes of output which\nyou don't want mailed to you by cron, and that information is already\nbeing saved in a file by \"--tee\"?\n\n-Peff\n"}]}