@matheusbsbs / matheus-bagliano / commits / d0736f7b81
Fork 0

git-notes: Run partial expensive test everywhere

The git-notes expensive timing test is only expensive because it either did 10,100,1k and 10k iterations or nothing. Change it to do 10 by default, with an option to run the expensive version with the old GIT_NOTES_TIMING_TESTS=ZomgYesPlease variable. Since nobody was ostensibly running this test under TAP the code had bitrotted so that it emitted invalid TAP. This change fixes that. The old version would also mysteriously fail on systems without /usr/bin/time, there's now a check for that using the multiple test prerequisite facility. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Aug 10, 2010 at 23:37 UTC d0736f7b81ac2fcb763279b3bf3e90faa3fb6609
1 file changed +20 -12
t/t3302-notes-index-expensive.sh
+20 -12
@@ -7,11 +7,9 @@ test_description='Test commit notes index (expensive!)'
7
8 . ./test-lib.sh
9
10 -test -z "$GIT_NOTES_TIMING_TESTS" && {
11 - skip_all="Skipping timing tests"
12 - test_done
13 - exit
14 -}
10 +test_set_prereq NOT_EXPENSIVE
11 +test -n "$GIT_NOTES_TIMING_TESTS" && test_set_prereq EXPENSIVE
12 +test -x /usr/bin/time && test_set_prereq USR_BIN_TIME
13
14 create_repo () {
15 number_of_commits=$1
@@ -102,17 +100,27 @@ time_notes () {
100 done
101 }
102
105 -for count in 10 100 1000 10000; do
103 +do_tests () {
104 + pr=$1
105 + count=$2
106 +
107 + test_expect_success $pr 'setup / mkdir' '
108 + mkdir $count &&
109 + cd $count
110 + '
111
107 - mkdir $count
108 - (cd $count;
112 + test_expect_success $pr "setup $count" "create_repo $count"
113
110 - test_expect_success "setup $count" "create_repo $count"
114 + test_expect_success $pr 'notes work' "test_notes $count"
115
112 - test_expect_success 'notes work' "test_notes $count"
116 + test_expect_success USR_BIN_TIME,$pr 'notes timing with /usr/bin/time' "time_notes 100"
117 +
118 + test_expect_success $pr 'teardown / cd ..' 'cd ..'
119 +}
120
114 - test_expect_success 'notes timing' "time_notes 100"
115 - )
121 +do_tests NOT_EXPENSIVE 10
122 +for count in 100 1000 10000; do
123 + do_tests EXPENSIVE $count
124 done
125
126 test_done