Merge branch 'sg/show-failed-test-names'

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
This commit is contained in:
Junio C Hamano 2019-08-22 12:34:11 -07:00
commit 8ae7a46c4d
3 changed files with 14 additions and 12 deletions

View File

@ -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

View 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"

View 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"