From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: <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 11:35:04 -0700 [thread overview]
Message-ID: <xmqq36intlpj.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <04a401d54702$05624290$1026c7b0$@nexbridge.com> (Randall S. Becker's message of "Tue, 30 Jul 2019 14:10:02 -0400")
"Randall S. Becker" <rsbecker@nexbridge.com> writes:
> On July 30, 2019 1:32 PM, Junio C Hamano wrote:
>>
>> I wonder if a tool like sparse can help us catch a pattern that feeds
> errno to
>> "%d" format.
>> ...
> Seems reasonable. Better than trying to use strerror(), which previously
> (I'm not sure whether it was this project or another) had a similar mapping
> issue because the error text does not match either.
Yup, that was also us X-<.
Here is what I queued for now.
-- >8 --
Subject: [PATCH] test-dir-iterator: do not assume errno values
A few tests printed 'errno' as an integer and compared with
hardcoded integers; this is obviously not portable.
A two things to note are:
- the string obtained by strerror() is not portable, and cannot be
used for the purpose of these tests.
- there unfortunately isn't a portable way to map error numbers to
error names.
As we only care about a few selected errors, just map the error
number to the name before emitting for comparison.
Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/helper/test-dir-iterator.c | 11 ++++++++++-
t/t0066-dir-iterator.sh | 4 ++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index a5b96cb0dc..c7c30664da 100644
--- a/t/helper/test-dir-iterator.c
+++ b/t/helper/test-dir-iterator.c
@@ -4,6 +4,15 @@
#include "iterator.h"
#include "dir-iterator.h"
+static const char *error_name(int error_number)
+{
+ switch (error_number) {
+ case ENOENT: return "ENOENT";
+ case ENOTDIR: return "ENOTDIR";
+ default: return "ESOMETHINGELSE";
+ }
+}
+
/*
* usage:
* tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
@@ -31,7 +40,7 @@ int cmd__dir_iterator(int argc, const char **argv)
diter = dir_iterator_begin(path.buf, flags);
if (!diter) {
- printf("dir_iterator_begin failure: %d\n", errno);
+ printf("dir_iterator_begin failure: %s\n", error_name(errno));
exit(EXIT_FAILURE);
}
diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh
index 9354d3f1ed..92910e4e6c 100755
--- a/t/t0066-dir-iterator.sh
+++ b/t/t0066-dir-iterator.sh
@@ -55,13 +55,13 @@ test_expect_success 'dir-iterator should list files in the correct order' '
test_expect_success 'begin should fail upon inexistent paths' '
test_must_fail test-tool dir-iterator ./inexistent-path \
>actual-inexistent-path-output &&
- echo "dir_iterator_begin failure: 2" >expected-inexistent-path-output &&
+ echo "dir_iterator_begin failure: ENOENT" >expected-inexistent-path-output &&
test_cmp expected-inexistent-path-output actual-inexistent-path-output
'
test_expect_success 'begin should fail upon non directory paths' '
test_must_fail test-tool dir-iterator ./dir/b >actual-non-dir-output &&
- echo "dir_iterator_begin failure: 20" >expected-non-dir-output &&
+ echo "dir_iterator_begin failure: ENOTDIR" >expected-non-dir-output &&
test_cmp expected-non-dir-output actual-non-dir-output
'
--
2.23.0-rc0-134-gc2d418fd54
next prev parent reply other threads:[~2019-07-30 18:35 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 [this message]
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
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
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=xmqq36intlpj.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git-packagers@googlegroups.com \
--cc=git@vger.kernel.org \
--cc=rsbecker@nexbridge.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).