Skip to content

Commit 8ae7a46

Browse files
committed
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
2 parents 6ba06b5 + ffe1afe commit 8ae7a46

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

t/t0000-basic.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,23 +274,23 @@ test_expect_success 'pretend we have a mix of all possible results' "
274274

275275
test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
276276
test_must_fail run_sub_test_lib_test \
277-
test-verbose "test verbose" --verbose <<-\EOF &&
277+
t1234-verbose "test verbose" --verbose <<-\EOF &&
278278
test_expect_success "passing test" true
279279
test_expect_success "test with output" "echo foo"
280280
test_expect_success "failing test" false
281281
test_done
282282
EOF
283-
mv test-verbose/out test-verbose/out+ &&
284-
grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
285-
check_sub_test_lib_test test-verbose <<-\EOF
286-
> expecting success: true
283+
mv t1234-verbose/out t1234-verbose/out+ &&
284+
grep -v "^Initialized empty" t1234-verbose/out+ >t1234-verbose/out &&
285+
check_sub_test_lib_test t1234-verbose <<-\EOF
286+
> expecting success of 1234.1 '\''passing test'\'': true
287287
> ok 1 - passing test
288288
> Z
289-
> expecting success: echo foo
289+
> expecting success of 1234.2 '\''test with output'\'': echo foo
290290
> foo
291291
> ok 2 - test with output
292292
> Z
293-
> expecting success: false
293+
> expecting success of 1234.3 '\''failing test'\'': false
294294
> not ok 3 - failing test
295295
> # false
296296
> Z
@@ -301,17 +301,17 @@ test_expect_success C_LOCALE_OUTPUT 'test --verbose' '
301301

302302
test_expect_success 'test --verbose-only' '
303303
test_must_fail run_sub_test_lib_test \
304-
test-verbose-only-2 "test verbose-only=2" \
304+
t2345-verbose-only-2 "test verbose-only=2" \
305305
--verbose-only=2 <<-\EOF &&
306306
test_expect_success "passing test" true
307307
test_expect_success "test with output" "echo foo"
308308
test_expect_success "failing test" false
309309
test_done
310310
EOF
311-
check_sub_test_lib_test test-verbose-only-2 <<-\EOF
311+
check_sub_test_lib_test t2345-verbose-only-2 <<-\EOF
312312
> ok 1 - passing test
313313
> Z
314-
> expecting success: echo foo
314+
> expecting success of 2345.2 '\''test with output'\'': echo foo
315315
> foo
316316
> ok 2 - test with output
317317
> Z

t/test-lib-functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ test_expect_failure () {
580580
export test_prereq
581581
if ! test_skip "$@"
582582
then
583-
say >&3 "checking known breakage: $2"
583+
say >&3 "checking known breakage of $TEST_NUMBER.$test_count '$1': $2"
584584
if test_run_ "$2" expecting_failure
585585
then
586586
test_known_broken_ok_ "$1"
@@ -600,7 +600,7 @@ test_expect_success () {
600600
export test_prereq
601601
if ! test_skip "$@"
602602
then
603-
say >&3 "expecting success: $2"
603+
say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $2"
604604
if test_run_ "$2"
605605
then
606606
test_ok_ "$1"

t/test-lib.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ fi
212212

213213
TEST_STRESS_JOB_SFX="${GIT_TEST_STRESS_JOB_NR:+.stress-$GIT_TEST_STRESS_JOB_NR}"
214214
TEST_NAME="$(basename "$0" .sh)"
215+
TEST_NUMBER="${TEST_NAME%%-*}"
216+
TEST_NUMBER="${TEST_NUMBER#t}"
215217
TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results"
216218
TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME$TEST_STRESS_JOB_SFX"
217219
TRASH_DIRECTORY="trash directory.$TEST_NAME$TEST_STRESS_JOB_SFX"

0 commit comments

Comments
 (0)