All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Junio C Hamano <gitster@pobox.com>
Cc: Todd Zullinger <tmz@pobox.com>, git@vger.kernel.org
Subject: [PATCH] test-progress: fix test failures on big-endian systems
Date: Sun, 20 Oct 2019 01:37:06 +0200	[thread overview]
Message-ID: <20191019233706.GM29845@szeder.dev> (raw)
In-Reply-To: <f1ce445e-6954-8e7b-2dca-3a566ce689a5@physik.fu-berlin.de>

On Sat, Oct 19, 2019 at 11:38:40PM +0200, John Paul Adrian Glaubitz wrote:
> The testsuite is failing again on s390x and all other big-endian targets in
> Debian. For a full build log on s390x see [1].

Gah, my progress display fixes strike again...

I think the patch below should fix it, but I could only test it on
little-endian systems.  Could you please confirm that it indeed works
on big-endian as well?


  --- >8 ---

Subject: [PATCH] test-progress: fix test failures on big-endian systems

In 't0500-progress-display.sh' all tests running 'test-tool progress
--total=<N>' fail on big-endian systems, e.g. like this:

  + test-tool progress --total=3 Working hard
  [...]
  + test_i18ncmp expect out
  --- expect	2019-10-18 23:07:54.765523916 +0000
  +++ out	2019-10-18 23:07:54.773523916 +0000
  @@ -1,4 +1,2 @@
  -Working hard:  33% (1/3)<CR>
  -Working hard:  66% (2/3)<CR>
  -Working hard: 100% (3/3)<CR>
  -Working hard: 100% (3/3), done.
  +Working hard:   0% (1/12884901888)<CR>
  +Working hard:   0% (3/12884901888), done.

The reason for that bogus value is that '--total's parameter is parsed
via parse-options's OPT_INTEGER into a uint64_t variable [1], so the
two bits of 3 end up in the "wrong" bytes on big-endian systems
(12884901888 = 0x300000000).

Change the type of that variable from uint64_t to int, to match what
parse-options expects; in the tests of the progress output we won't
use values that don't fit into an int anyway.

[1] start_progress() expects the total number as an uint64_t, that's
    why I chose the same type when declaring the variable holding the
    value given on the command line.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/helper/test-progress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c
index 4e9f7fafdf..42b96cb103 100644
--- a/t/helper/test-progress.c
+++ b/t/helper/test-progress.c
@@ -29,7 +29,7 @@ void progress_test_force_update(void);
 
 int cmd__progress(int argc, const char **argv)
 {
-	uint64_t total = 0;
+	int total = 0;
 	const char *title;
 	struct strbuf line = STRBUF_INIT;
 	struct progress *progress;
-- 
2.24.0.rc0.472.ga6f06c86b4



  reply	other threads:[~2019-10-19 23:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31  6:37 [BUG]: Testsuite failures on big-endian targets John Paul Adrian Glaubitz
2019-07-31  7:17 ` Todd Zullinger
2019-10-19 21:38   ` John Paul Adrian Glaubitz
2019-10-19 23:37     ` SZEDER Gábor [this message]
2019-10-19 23:55       ` [PATCH] test-progress: fix test failures on big-endian systems John Paul Adrian Glaubitz
2019-10-20  0:19         ` Todd Zullinger
2019-10-21  0:52       ` Junio C Hamano
2019-10-21  3:21         ` Jeff King
2019-10-21  8:51           ` Junio C Hamano
2019-10-21 18:49             ` Jeff King
2019-10-23  1:58               ` Junio C Hamano
2019-10-24 17:24         ` SZEDER Gábor
2019-10-24 17:55           ` Jeff King
2019-10-20  0:26     ` [BUG]: Testsuite failures on big-endian targets Todd Zullinger

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=20191019233706.GM29845@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.