]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7900: speed up expensive test
authorJeff King <peff@peff.net>
Wed, 2 Dec 2020 02:47:56 +0000 (21:47 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Dec 2020 22:27:08 +0000 (14:27 -0800)
A test marked with EXPENSIVE creates two 2.5GB files and adds them to
the repository. This takes 194s to run on my machine, versus 2s when the
EXPENSIVE prereq isn't set. We can trim this down a bit by doing two
things:

  - use "git commit --quiet" to avoid spending time generating a diff
    summary (this actually only helps for the second commit, but I've
    added it here to both for consistency). This shaves off 8s.

  - set core.compression to 0. We know these files are full of random
    bytes, and so won't compress (that's the point of the test!).
    Spending cycles on zlib is pointless. This shaves off 122s.

After this, my total time to run the script is 64s. That won't help
normal runs without GIT_TEST_LONG set, of course, but it's easy enough
to do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7900-maintenance.sh

index 55116c2f041e31a8d8e219ab9a81cb2b0d44cea7..d1523572e89eacf857c48252a2ecf8a4b7f07d73 100755 (executable)
@@ -189,13 +189,15 @@ test_expect_success 'incremental-repack task' '
 '
 
 test_expect_success EXPENSIVE 'incremental-repack 2g limit' '
+       test_config core.compression 0 &&
+
        for i in $(test_seq 1 5)
        do
                test-tool genrandom foo$i $((512 * 1024 * 1024 + 1)) >>big ||
                return 1
        done &&
        git add big &&
-       git commit -m "Add big file (1)" &&
+       git commit -qm "Add big file (1)" &&
 
        # ensure any possible loose objects are in a pack-file
        git maintenance run --task=loose-objects &&
@@ -207,7 +209,7 @@ test_expect_success EXPENSIVE 'incremental-repack 2g limit' '
                return 1
        done &&
        git add big &&
-       git commit -m "Add big file (2)" &&
+       git commit -qm "Add big file (2)" &&
 
        # ensure any possible loose objects are in a pack-file
        git maintenance run --task=loose-objects &&