git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] t6500: mark tests as SHA1 reliant
Date: Fri, 28 Jul 2017 15:14:49 -0700	[thread overview]
Message-ID: <xmqq379gmco6.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170728171817.21458-3-sbeller@google.com> (Stefan Beller's message of "Fri, 28 Jul 2017 10:18:17 -0700")

Stefan Beller <sbeller@google.com> writes:

> The first test marked relies on hard coded sha1:
>
> 	# We need to create two object whose sha1s start with 17
> 	# since this is what git gc counts.  As it happens, these
> 	# two blobs will do so.
> 	test_commit 263 &&
> 	test_commit 410 &&
>
> The next two seem to rely on state from the first one, I did not
> investigate.

I am moderately negative on this approach, if it is meant to suggest
the final shape of our test suite patch 1/2 started.

This script may be a good example you can use to demonstrate a much
better approach.  As the above comment in the test shows, we want to
create two objects whose object names begin with "17", and running
test_commit with 263 and 410 at this point in the test was a way to
achieve that when Git uses SHA-1 as its hash.

When we use a hash different from SHA-1, the exact strings 263 and
410 may change, but we should be able to find two other strings that
has the same property (i.e. they results in objects that share the
prefix "17").  Perhaps a better way forward for this kind of test is
to parameterize these hardcoded constants and make it easier to use
different values without having to change the rest of the script
when we switch the hash function?  So perhaps have something like

	case "$GIT_HASH_FUNCTION" in
	SHA-1)	
		TEST_17_1="263 410" ;;
	CORRUPT-SHA-1)	
		TEST_17_1="something else" ;;
        esac

near the top of the script and update the above two with:

	for token in $TEST_17_1
	do
		test_commit "$token" || return 1
	done &&

would prepare us to switch to SHA-256 or whatever hash function we
choose to use in the future?

t1512 is another example with full of such tests that we would want
to keep moral equivalents in the world with a different hash,
instead of reducing the test coverage.

  parent reply	other threads:[~2017-07-28 22:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 17:18 [RFD PATCH 0/2] How to migrate our test infrastructure away from sha1 Stefan Beller
2017-07-28 17:18 ` [PATCH 1/2] alter hash function: expose test dependencies on sha1 Stefan Beller
2017-07-28 21:52   ` Junio C Hamano
2017-07-28 17:18 ` [PATCH 2/2] t6500: mark tests as SHA1 reliant Stefan Beller
2017-07-28 17:59   ` Junio C Hamano
2017-07-28 21:43     ` Stefan Beller
2017-07-28 22:14   ` Junio C Hamano [this message]
2017-07-29 17:58     ` brian m. carlson
2017-07-30 21:21       ` Junio C Hamano
2017-07-30 23:00         ` brian m. carlson
2017-07-30 23:24           ` brian m. carlson
2017-07-31 20:17             ` Ævar Arnfjörð Bjarmason
2017-07-31 20:30               ` Stefan Beller
2017-07-31 20:26             ` Stefan Beller
2017-07-31 23:54               ` brian m. carlson

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=xmqq379gmco6.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    /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).