From: Jeff King <peff@peff.net>
To: Todd Zullinger <tmz@pobox.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"René Scharfe" <l.s.r@web.de>,
"Randall S. Becker" <rsbecker@nexbridge.com>,
"'Junio C Hamano'" <gitster@pobox.com>,
"Christian Couder" <chriscool@tuxfamily.org>,
git@vger.kernel.org, git-packagers@googlegroups.com
Subject: Re: [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop
Date: Tue, 30 Jul 2019 23:53:44 -0400 [thread overview]
Message-ID: <20190731035344.GA26019@sigill.intra.peff.net> (raw)
In-Reply-To: <20190731032735.GA14684@sigill.intra.peff.net>
On Tue, Jul 30, 2019 at 11:27:35PM -0400, Jeff King wrote:
> That would perhaps be clearer if the "hashmap" tool actually did the
> sorting itself (so we'd sort _just_ the iteration, not the whole
> output). Something like this, though I'm on the fence about whether it
> is worth it:
> [...]
And here it is for reference with the matching change in test-oidmap,
and the adjustments necessary for the test scripts (from master, not
from my earlier patch). I think I prefer the simpler "just sort it all"
version I posted with the commit message.
The post-image in t0016 may be a new low: a command substitution in a DQ
string fed to echo, itself inside a command substitution in a here-doc.
Yuck. :)
---
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index aaf17b0ddf..9f6901666e 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "hashmap.h"
#include "strbuf.h"
+#include "string-list.h"
struct test_entry
{
@@ -221,10 +222,18 @@ int cmd__hashmap(int argc, const char **argv)
} else if (!strcmp("iterate", cmd)) {
+ struct string_list sorted = STRING_LIST_INIT_NODUP;
+ struct string_list_item *item;
struct hashmap_iter iter;
hashmap_iter_init(&map, &iter);
- while ((entry = hashmap_iter_next(&iter)))
- printf("%s %s\n", entry->key, get_value(entry));
+ while ((entry = hashmap_iter_next(&iter))) {
+ item = string_list_append(&sorted, entry->key);
+ item->util = (void *)get_value(entry);
+ }
+ string_list_sort(&sorted);
+ for_each_string_list_item(item, &sorted)
+ printf("%s %s\n", item->string, (const char *)item->util);
+ string_list_clear(&sorted, 0);
} else if (!strcmp("size", cmd)) {
diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c
index 0acf99931e..5fd059fe90 100644
--- a/t/helper/test-oidmap.c
+++ b/t/helper/test-oidmap.c
@@ -94,10 +94,19 @@ int cmd__oidmap(int argc, const char **argv)
} else if (!strcmp("iterate", cmd)) {
+ struct string_list sorted = STRING_LIST_INIT_DUP;
+ struct string_list_item *item;
struct oidmap_iter iter;
oidmap_iter_init(&map, &iter);
- while ((entry = oidmap_iter_next(&iter)))
- printf("%s %s\n", oid_to_hex(&entry->entry.oid), entry->name);
+ while ((entry = oidmap_iter_next(&iter))) {
+ item = string_list_append(&sorted,
+ oid_to_hex(&entry->entry.oid));
+ item->util = entry->name;
+ }
+ string_list_sort(&sorted);
+ for_each_string_list_item(item, &sorted)
+ printf("%s %s\n", item->string, (const char *)item->util);
+ string_list_clear(&sorted, 0);
} else {
diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index 9c96b3e3b1..1adcd7762d 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -177,9 +177,9 @@ put fooBarFrotz value3
iterate" "NULL
NULL
NULL
-key2 value2
+fooBarFrotz value3
key1 value1
-fooBarFrotz value3"
+key2 value2"
'
@@ -192,8 +192,8 @@ iterate" "NULL
NULL
NULL
fooBarFrotz value3
-key2 value2
-key1 value1" ignorecase
+key1 value1
+key2 value2" ignorecase
'
diff --git a/t/t0016-oidmap.sh b/t/t0016-oidmap.sh
index bbe719e950..abeaa64159 100755
--- a/t/t0016-oidmap.sh
+++ b/t/t0016-oidmap.sh
@@ -93,9 +93,14 @@ put three 3
iterate" "NULL
NULL
NULL
-$(git rev-parse two) 2
-$(git rev-parse one) 1
-$(git rev-parse three) 3"
+$(
+ # sort to avoid relying on exact oids
+ {
+ echo "$(git rev-parse one) 1"
+ echo "$(git rev-parse two) 2"
+ echo "$(git rev-parse three) 3"
+ } | sort
+)"
'
next prev parent reply other threads:[~2019-07-31 3:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 17:08 [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop Randall S. Becker
2019-07-30 17:31 ` Junio C Hamano
2019-07-30 18:09 ` Matheus Tavares Bernardino
2019-07-30 18:10 ` Randall S. Becker
2019-07-30 18:35 ` Junio C Hamano
2019-07-30 19:45 ` Jeff King
2019-07-30 20:25 ` Randall S. Becker
2019-07-30 19:49 ` Todd Zullinger
2019-07-30 20:02 ` Jeff King
2019-07-30 20:39 ` Junio C Hamano
2019-07-30 20:56 ` SZEDER Gábor
2019-07-31 0:59 ` Jeff King
2019-07-31 1:23 ` Jeff King
2019-07-31 1:27 ` Jeff King
2019-07-31 1:59 ` Todd Zullinger
2019-07-31 3:27 ` Jeff King
2019-07-31 3:53 ` Jeff King [this message]
2019-07-31 17:17 ` Junio C Hamano
2019-07-31 21:22 ` non-cryptographic hash algorithms in git Jeff King
2019-07-31 4:06 ` [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop René Scharfe
2019-07-31 4:30 ` Jeff King
2019-07-31 6:04 ` Todd Zullinger
2019-07-31 16:57 ` Junio C Hamano
2019-07-30 20:27 ` Randall S. Becker
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190731035344.GA26019@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=chriscool@tuxfamily.org \
--cc=git-packagers@googlegroups.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=rsbecker@nexbridge.com \
--cc=szeder.dev@gmail.com \
--cc=tmz@pobox.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.
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 NNTP newsgroup(s).