From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>,
"Eric Sunshine" <sunshine@sunshineco.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Torsten Bögershausen" <tboegi@web.de>,
"Derrick Stolee" <stolee@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH v5 00/12] Hash-independent tests (part 3)
Date: Thu, 13 Sep 2018 05:17:30 +0000 [thread overview]
Message-ID: <20180913051742.252276-1-sandals@crustytoothpaste.net> (raw)
This is the next in the series of improvements to make tests
hash-independent.
A range-diff is below.
Changes from v4:
* Add local statements to the &&-chain.
* Fix a typo in the local statement.
* Add a helpful comment about why test_detect_hash is hard-coded to
SHA-1.
Changes from v3:
* Update t/README to specify new helpers.
* Escape "$" in double quotes.
* Add documentation comments to test helpers.
* Use local instead of underscores in variable names.
* Use expr instead of egrep to match hash algorithm names.
* Improve clarity of unset variable check in test_oid.
* Wrap test_oid_init in a test_expect_success.
* Improved && chain handling in test functions.
* Add test_detect_hash in test_oid_init.
* Clean up extra blank line.
* Add patch from Derrick Stolee for t5318, modified slightly.
Changes from v2:
* Fix a typo in "zero_2".
* Provide better matching of expected output.
* Add and use test_oid_init instead of filename-based test_oid_cache.
* Add test_set_hash.
* Provide better error checking in newly added test functions.
* Move t0000 constants into the test, removing the separate file.
* Switch to using a differently named temporary file in t0027.
Changes from v1:
* Adopt pure shell approach for helper.
* Add tests for the helpers.
* Explicitly refer to SHA-256 now that we know it will be NewHash.
* Updated t0000 to remove SHA1 prerequisite.
* Change name of helper from test_translate to test_oid.
* Add helper to cache information in the shell.
* Simplified lookup of HEAD in t0002.
* Switched to using existing helper function in t0027.
* Simplified handling of IDs in t0064.
Derrick Stolee (1):
t5318: use test_oid for HASH_LEN
brian m. carlson (11):
t: add test functions to translate hash-related values
t0000: use hash translation table
t0000: update tests for SHA-256
t0002: abstract away SHA-1 specific constants
t0027: make hash size independent
t0064: make hash size independent
t1006: make hash size independent
t1400: switch hard-coded object ID to variable
t1405: make hash size independent
t1406: make hash-size independent
t1407: make hash size independent
t/README | 22 ++++
t/oid-info/README | 19 +++
t/oid-info/hash-info | 8 ++
t/oid-info/oid | 29 +++++
t/t0000-basic.sh | 213 ++++++++++++++++++++++-----------
t/t0002-gitfile.sh | 27 +++--
t/t0027-auto-crlf.sh | 3 +-
t/t0064-sha1-array.sh | 49 ++++----
t/t1006-cat-file.sh | 6 +-
t/t1400-update-ref.sh | 2 +-
t/t1405-main-ref-store.sh | 4 +-
t/t1406-submodule-ref-store.sh | 6 +-
t/t1407-worktree-ref-store.sh | 4 +-
t/t5318-commit-graph.sh | 5 +-
t/test-lib-functions.sh | 69 +++++++++++
15 files changed, 352 insertions(+), 114 deletions(-)
create mode 100644 t/oid-info/README
create mode 100644 t/oid-info/hash-info
create mode 100644 t/oid-info/oid
Range-diff against v4:
1: fd13b542e7 ! 1: 831a0df666 t: add test functions to translate hash-related values
@@ -222,6 +222,8 @@
+
+# Detect the hash algorithm in use.
+test_detect_hash () {
++ # Currently we only support SHA-1, but in the future this function will
++ # actually detect the algorithm in use.
+ test_hash_algo='sha1'
+}
+
@@ -241,9 +243,9 @@
+# rawsz sha1:20
+# rawsz sha256:32
+test_oid_cache () {
-+ local tag reset k v
++ local tag rest k v &&
+
-+ test -n "$test_hash_algo" || test_detect_hash &&
++ { test -n "$test_hash_algo" || test_detect_hash; } &&
+ while read tag rest
+ do
+ case $tag in
@@ -271,7 +273,7 @@
+# Look up a per-hash value based on a key ($1). The value must have been loaded
+# by test_oid_init or test_oid_cache.
+test_oid () {
-+ local var="test_oid_${test_hash_algo}_$1"
++ local var="test_oid_${test_hash_algo}_$1" &&
+
+ # If the variable is unset, we must be missing an entry for this
+ # key-hash pair, so exit with an error.
2: 335c75e1ec = 2: 75eb36456b t0000: use hash translation table
3: 257b458ad9 = 3: d1cebc5dba t0000: update tests for SHA-256
4: 69080d3bfc = 4: a75f4a049e t0002: abstract away SHA-1 specific constants
5: a4297d7ae8 = 5: ab8598048e t0027: make hash size independent
6: 7cf1221274 = 6: ed540a08e8 t0064: make hash size independent
7: 7e5c857c25 = 7: e221995a27 t1006: make hash size independent
8: 9271787d4b = 8: 3a168746ff t1400: switch hard-coded object ID to variable
9: 43bd41156a = 9: 3e55ccdd15 t1405: make hash size independent
10: 875bbd7fc5 = 10: df7d4eb112 t1406: make hash-size independent
11: a9c2d31089 = 11: b1a04c1986 t1407: make hash size independent
12: 10452cc352 = 12: 63d21a1eca t5318: use test_oid for HASH_LEN
next reply other threads:[~2018-09-13 5:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 5:17 brian m. carlson [this message]
2018-09-13 5:17 ` [PATCH v5 01/12] t: add test functions to translate hash-related values brian m. carlson
2018-09-13 5:17 ` [PATCH v5 02/12] t0000: use hash translation table brian m. carlson
2018-09-13 5:17 ` [PATCH v5 03/12] t0000: update tests for SHA-256 brian m. carlson
2018-09-13 5:17 ` [PATCH v5 04/12] t0002: abstract away SHA-1 specific constants brian m. carlson
2018-09-13 5:17 ` [PATCH v5 05/12] t0027: make hash size independent brian m. carlson
2018-09-13 5:17 ` [PATCH v5 06/12] t0064: " brian m. carlson
2018-09-13 5:17 ` [PATCH v5 07/12] t1006: " brian m. carlson
2018-09-13 5:17 ` [PATCH v5 08/12] t1400: switch hard-coded object ID to variable brian m. carlson
2018-09-13 5:17 ` [PATCH v5 09/12] t1405: make hash size independent brian m. carlson
2018-09-13 5:17 ` [PATCH v5 10/12] t1406: make hash-size independent brian m. carlson
2018-09-13 5:17 ` [PATCH v5 11/12] t1407: make hash size independent brian m. carlson
2018-09-13 19:06 ` Ævar Arnfjörð Bjarmason
2018-09-13 5:17 ` [PATCH v5 12/12] t5318: use test_oid for HASH_LEN brian m. carlson
2018-09-13 17:00 ` [PATCH v5 00/12] Hash-independent tests (part 3) Derrick Stolee
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=20180913051742.252276-1-sandals@crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=stolee@gmail.com \
--cc=sunshine@sunshineco.com \
--cc=tboegi@web.de \
/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).