]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sg/show-failed-test-names'
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2019 19:34:11 +0000 (12:34 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2019 19:34:11 +0000 (12:34 -0700)
The first line of verbose output from each test piece now carries
the test name and number to help scanning with eyeballs.

* sg/show-failed-test-names:
  tests: show the test name and number at the start of verbose output
  t0000-basic: use realistic test script names in the verbose tests

t/t0000-basic.sh
t/test-lib-functions.sh
t/test-lib.sh

index 9ca0818cbe4c1fb7f7d4c4558f00c5dabc0ae778..4c01f60dd3ca0f2cab26298dbc795e08a61b819b 100755 (executable)
@@ -274,23 +274,23 @@ test_expect_success 'pretend we have a mix of all possible results' "
 
 test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
        test_must_fail run_sub_test_lib_test \
-               test-verbose "test verbose" --verbose <<-\EOF &&
+               t1234-verbose "test verbose" --verbose <<-\EOF &&
        test_expect_success "passing test" true
        test_expect_success "test with output" "echo foo"
        test_expect_success "failing test" false
        test_done
        EOF
-       mv test-verbose/out test-verbose/out+ &&
-       grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
-       check_sub_test_lib_test test-verbose <<-\EOF
-       > expecting success: true
+       mv t1234-verbose/out t1234-verbose/out+ &&
+       grep -v "^Initialized empty" t1234-verbose/out+ >t1234-verbose/out &&
+       check_sub_test_lib_test t1234-verbose <<-\EOF
+       > expecting success of 1234.1 '\''passing test'\'': true
        > ok 1 - passing test
        > Z
-       > expecting success: echo foo
+       > expecting success of 1234.2 '\''test with output'\'': echo foo
        > foo
        > ok 2 - test with output
        > Z
-       > expecting success: false
+       > expecting success of 1234.3 '\''failing test'\'': false
        > not ok 3 - failing test
        > #     false
        > Z
@@ -301,17 +301,17 @@ test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
 
 test_expect_success 'test --verbose-only' '
        test_must_fail run_sub_test_lib_test \
-               test-verbose-only-2 "test verbose-only=2" \
+               t2345-verbose-only-2 "test verbose-only=2" \
                --verbose-only=2 <<-\EOF &&
        test_expect_success "passing test" true
        test_expect_success "test with output" "echo foo"
        test_expect_success "failing test" false
        test_done
        EOF
-       check_sub_test_lib_test test-verbose-only-2 <<-\EOF
+       check_sub_test_lib_test t2345-verbose-only-2 <<-\EOF
        > ok 1 - passing test
        > Z
-       > expecting success: echo foo
+       > expecting success of 2345.2 '\''test with output'\'': echo foo
        > foo
        > ok 2 - test with output
        > Z
index e0b3f28d3a96e1b937f4c31e0a3d2e8fb3e6fed5..87bf3a2287381be4586eccd94cce35c0a3b3d60f 100644 (file)
@@ -580,7 +580,7 @@ test_expect_failure () {
        export test_prereq
        if ! test_skip "$@"
        then
-               say >&3 "checking known breakage: $2"
+               say >&3 "checking known breakage of $TEST_NUMBER.$test_count '$1': $2"
                if test_run_ "$2" expecting_failure
                then
                        test_known_broken_ok_ "$1"
@@ -600,7 +600,7 @@ test_expect_success () {
        export test_prereq
        if ! test_skip "$@"
        then
-               say >&3 "expecting success: $2"
+               say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $2"
                if test_run_ "$2"
                then
                        test_ok_ "$1"
index 30b07e310f59493616f766ea6cf7c45a335c9258..a9d45642a5b32328200b0eec93183279c00d9444 100644 (file)
@@ -212,6 +212,8 @@ fi
 
 TEST_STRESS_JOB_SFX="${GIT_TEST_STRESS_JOB_NR:+.stress-$GIT_TEST_STRESS_JOB_NR}"
 TEST_NAME="$(basename "$0" .sh)"
+TEST_NUMBER="${TEST_NAME%%-*}"
+TEST_NUMBER="${TEST_NUMBER#t}"
 TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results"
 TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME$TEST_STRESS_JOB_SFX"
 TRASH_DIRECTORY="trash directory.$TEST_NAME$TEST_STRESS_JOB_SFX"