Locale when executing unit tests [edmonds@debian.org: Re: Bug#1042250: bup: FTBFS: dh_auto_test: ...]

13 views
Skip to first unread message

Robert Edmonds

unread,
Jul 30, 2023, 7:01:00 PM7/30/23
to bup-...@googlegroups.com
Hi,

bup 0.33.2 failed to build during a Debian archive rebuild; see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042250 for details.

It looks like the problem is that the rebuild occurred with a UTF-8
locale. This caused the manpage output being tested by the
test/ext/test-help unit test to use the U+2010 'HYPHEN' character rather
than the ASCII 0x2D "hyphen-minus" character that was expected by the
unit test. (The unit test requires that the string "bup-save(1)" be
present on the first line of the manpage.)

I guess the unit test environment could be explicitly set to a non-UTF-8
locale, or the unit test could be updated to accept either the U+002D or
U+2010 characters.

Thanks!

----- Forwarded message from Robert Edmonds <edm...@debian.org> -----

Date: Sun, 30 Jul 2023 18:48:38 -0400
From: Robert Edmonds <edm...@debian.org>
To: Lucas Nussbaum <lu...@debian.org>, 104...@bugs.debian.org
Subject: Re: Bug#1042250: bup: FTBFS: dh_auto_test: error: make -j8 test "TESTSUITEFLAGS=-j8 --verbose" VERBOSE=1 returned exit code 2

It looks like this is a brittle unit test.

Lucas Nussbaum wrote:
> > Failures:
> > ! /<<PKGBUILDDIR>>/test/ext/test-help:35 '1' = '0' FAILED

This line is:

WVPASSEQ 1 $(bup help save | head -1 | grep -cF 'bup-save(1)')

The hyphen in the grep expression "bup-save(1)" in the unit test is the
ordinary ASCII character 45:

ASCII 2/13 is decimal 045, hex 2d, octal 055, bits 00101101: prints as `-'
Official name: Hyphen
Other names: Dash, Minus, Worm

That matches the output of "bup help save | head -1" in the C locale:

root@8f8c3e4ea090:/# LC_ALL=C LANG=C bup help save | head -1 | hd
troff:<standard input>:5: warning: cannot select font 'CB'
troff:<standard input>:152: warning: cannot select font 'C'
vv
00000000 62 75 70 2d 73 61 76 65 28 31 29 20 20 20 20 20 |bup-save(1) |
^^
00000010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
*
00000070 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 | b|
00000080 75 70 2d 73 61 76 65 28 31 29 0a |up-save(1).|
0000008b
root@8f8c3e4ea090:/#

> The full build log is available from:
> http://qa-logs.debian.net/2023/07/26/bup_0.33.2-1_unstable.log

User Environment
----------------

[…]
LANG=C.UTF-8
LC_ALL=C.UTF-8
[…]

However, with a UTF-8 locale I see the hyphen being encoded as the byte
sequence 0xE2 0x80 0x90:

root@8f8c3e4ea090:/# LC_ALL=C.UTF-8 LANG=C.UTF-8 bup help save | head -1 | hd
troff:<standard input>:5: warning: cannot select font 'CB'
troff:<standard input>:152: warning: cannot select font 'C'
vvvvvvvv
00000000 62 75 70 e2 80 90 73 61 76 65 28 31 29 20 20 20 |bup...save(1) |
^^^^^^^^
00000010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
*
00000080 20 62 75 70 e2 80 90 73 61 76 65 28 31 29 0a | bup...save(1).|
0000008f
root@8f8c3e4ea090:/#

Which is the UTF-8 encoding of the Unicode character U+2010 'HYPHEN'.

So I guess the bup unit tests should probably set LANG/LC_ALL explicitly.

Thanks!

--
Robert Edmonds
edm...@debian.org

----- End forwarded message -----

--
Robert Edmonds
edm...@debian.org
Reply all
Reply to author
Forward
0 new messages