t3419: drop EXPENSIVE tests

When t3419 was originally written, it was designed to run a smaller test
for correctness, and then the same test with a larger number of patches
for performance. But it seems unlikely the latter was helping us:

 - it was marked with EXPENSIVE, so hardly anybody ran it anyway

 - there's no indication that it was more likely to find bugs than the
   smaller case (the commit message isn't very helpful, but the original
   cover letter describes it as: "The first patch adds correctness and
   (optional) performance tests".

 - the timing results are shown only via test_debug(). So also not run
   unless the user says "-d", and then not provided in any
   machine-readable form.

If we're interested in performance regressions, a script in t/perf would
be more appropriate. I didn't add one here, because it's not at all
clear to me that what the script is timing is even all that interesting.

Let's simplify the script by dropping the EXPENSIVE run. That in turn
lets us drop the do_tests() wrapper, which lets us consistently use
single-quotes for our test snippets. And we can drop the useless
test_debug() timings, as well as their run() helper. And finally, while
we're here, we can replace the count() helper with the standard
test_seq().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2020-03-22 03:51:40 -04:00 committed by Junio C Hamano
parent 2da1b05674
commit bb2dbe301b

View File

@ -4,15 +4,6 @@ test_description='git rebase - test patch id computation'
. ./test-lib.sh
count () {
i=0
while test $i -lt $1
do
echo "$i"
i=$(($i+1))
done
}
scramble () {
i=0
while read x
@ -26,75 +17,54 @@ scramble () {
mv -f "$1.new" "$1"
}
run () {
echo \$ "$@"
/usr/bin/time "$@" >/dev/null
}
test_expect_success 'setup' '
git commit --allow-empty -m initial &&
git tag root
'
do_tests () {
nlines=$1 pr=${2-}
test_expect_success 'setup: 500 lines' '
rm -f .gitattributes &&
git checkout -q -f master &&
git reset --hard root &&
test_seq 500 >file &&
git add file &&
git commit -q -m initial &&
git branch -f other &&
test_expect_success $pr "setup: $nlines lines" "
rm -f .gitattributes &&
git checkout -q -f master &&
git reset --hard root &&
count $nlines >file &&
git add file &&
git commit -q -m initial &&
git branch -f other &&
scramble file &&
git add file &&
git commit -q -m "change big file" &&
scramble file &&
git add file &&
git commit -q -m 'change big file' &&
git checkout -q other &&
: >newfile &&
git add newfile &&
git commit -q -m "add small file" &&
git checkout -q other &&
: >newfile &&
git add newfile &&
git commit -q -m 'add small file' &&
git cherry-pick master >/dev/null 2>&1
'
git cherry-pick master >/dev/null 2>&1
"
test_expect_success 'setup attributes' '
echo "file binary" >.gitattributes
'
test_debug "
run git diff master^\!
"
test_expect_success 'detect upstream patch' '
git checkout -q master &&
scramble file &&
git add file &&
git commit -q -m "change big file again" &&
git checkout -q other^{} &&
git rebase master &&
test_must_fail test -n "$(git rev-list master...HEAD~)"
'
test_expect_success $pr 'setup attributes' "
echo 'file binary' >.gitattributes
"
test_debug "
run git format-patch --stdout master &&
run git format-patch --stdout --ignore-if-in-upstream master
"
test_expect_success $pr 'detect upstream patch' '
git checkout -q master &&
scramble file &&
git add file &&
git commit -q -m "change big file again" &&
git checkout -q other^{} &&
git rebase master &&
test_must_fail test -n "$(git rev-list master...HEAD~)"
'
test_expect_success $pr 'do not drop patch' '
git branch -f squashed master &&
git checkout -q -f squashed &&
git reset -q --soft HEAD~2 &&
git commit -q -m squashed &&
git checkout -q other^{} &&
test_must_fail git rebase squashed &&
git rebase --quit
'
}
do_tests 500
do_tests 50000 EXPENSIVE
test_expect_success 'do not drop patch' '
git branch -f squashed master &&
git checkout -q -f squashed &&
git reset -q --soft HEAD~2 &&
git commit -q -m squashed &&
git checkout -q other^{} &&
test_must_fail git rebase squashed &&
git rebase --quit
'
test_done