From: Stefan Beller <sbeller@google.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Drastic jump in the time required for the test suite
Date: Thu, 20 Oct 2016 12:54:32 -0700 [thread overview]
Message-ID: <CAGZ79kZpj5xXHmnA+JfLKdGmgzp7Mut1OsKMOeowpw8m1+aKGA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1610201218060.3264@virtualbox>
On Thu, Oct 20, 2016 at 3:50 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi peff,
>
> On Wed, 19 Oct 2016, Jeff King wrote:
>
>> On Wed, Oct 19, 2016 at 10:32:12AM -0700, Junio C Hamano wrote:
>>
>> > > Maybe we should start optimizing the tests...
>> >
Maybe we should stop introducing un-optimized tests.
For other reasons I just stumbled upon t7064
(porcelain V2 output for git status)
This is how an arbitrary test looks like:
test_expect_success 'staged changes in added submodule (AM S.M.)' '
( cd super_repo &&
## stage the changes in the submodule.
( cd sub1 &&
git add file_in_sub
) &&
HMOD=$(git hash-object -t blob -- .gitmodules) &&
HSUP=$(git rev-parse HEAD) &&
HSUB=$HSUP &&
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $_z40 $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
test_cmp expect actual
)
'
Following "modern" Git tests I would have expected:
* heavy use of the "git -C <dir>" pattern. When applying that
thouroughly we'd save spanning the subshells.
* no `cd` on the same line as the opening paren.
(This is style and would derail the performance discussion)
test_expect_success 'staged changes in added submodule (AM S.M.)' '
git -C super_repo/sub1 add file_in_sub &&
HMOD=$(git -C super_repo hash-object -t blob -- .gitmodules) &&
HSUP=$(git -C super_repo rev-parse HEAD) &&
# as a comment: HSUB is equal to HSUP, because ...
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $_z40 $HSUP sub1
EOF
git -C super_repo status --porcelain=v2 --branch
--untracked-files=all >../actual &&
test_cmp expect actual
'
That said I really like the idea of having a helper that would eliminate the cat
for you, e.g. :
git_test_helper_equal_stdin_or_diff_and_die -C super_repo status
--porcelain=v2 --branch --untracked-files=all <<-EOF
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $_z40 $HSUP sub1
EOF
Thanks,
Stefan
next prev parent reply other threads:[~2016-10-20 19:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 9:18 Drastic jump in the time required for the test suite Johannes Schindelin
2016-10-19 17:32 ` Junio C Hamano
2016-10-19 20:56 ` Jeff King
2016-10-20 10:50 ` Johannes Schindelin
2016-10-20 11:39 ` Jeff King
2016-10-20 19:54 ` Stefan Beller [this message]
2016-10-20 21:38 ` Jeff King
2016-10-20 21:53 ` Stefan Beller
2016-10-20 21:57 ` Jeff King
2016-10-20 21:56 ` Jeff King
2016-10-21 5:27 ` Johannes Sixt
2016-10-21 8:24 ` Jeff King
2016-10-20 10:17 ` Johannes Schindelin
2016-10-20 12:31 ` Jeff King
2016-10-20 16:30 ` Stefan Beller
2016-10-20 21:00 ` Jeff King
2016-10-20 23:20 ` Jeff King
2016-10-20 20:38 ` Johannes Sixt
2016-10-20 21:03 ` Jeff King
2016-10-20 20:40 ` Dennis Kaarsemaker
2016-10-21 11:03 ` Duy Nguyen
2016-10-20 16:16 ` Junio C Hamano
2016-10-20 17:13 ` Matthieu Moy
2016-10-20 11:02 ` Duy Nguyen
2016-10-20 16:40 ` René Scharfe
2016-10-21 10:59 ` Duy Nguyen
2016-10-21 20:28 ` René Scharfe
2016-10-21 13:10 ` Matthieu Moy
2016-10-21 19:57 ` René Scharfe
2016-10-27 20:41 ` Eric Wong
2016-10-28 6:38 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGZ79kZpj5xXHmnA+JfLKdGmgzp7Mut1OsKMOeowpw8m1+aKGA@mail.gmail.com \
--to=sbeller@google.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).