test-lib: avoid full path to store test results
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 4 Nov 2012 02:13:33 +0000 (03:13 +0100)
committerJeff King <peff@peff.net>
Sun, 4 Nov 2012 13:35:20 +0000 (08:35 -0500)
No reason to use the full path in case this is used externally.

Otherwise we might get errors such as:

./test-lib.sh: line 394: /home/bob/dev/git/t/test-results//home/bob/dev/git/contrib/remote-hg/test-2894.counts: No such file or directory

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
t/test-lib.sh
index 489bc80fc1b1ba4066a1fd5ad6d2024d67160ba7..0f454818096f98aa36b49d74922a137fcff3a9ff 100644 (file)
@@ -389,7 +389,8 @@ test_done () {
        then
                test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
                mkdir -p "$test_results_dir"
-               test_results_path="$test_results_dir/${0%.sh}-$$.counts"
+               base=${0##*/}
+               test_results_path="$test_results_dir/${base%.sh}-$$.counts"
 
                cat >>"$test_results_path" <<-EOF
                total $test_count