You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
I've uploaded 2.2.4-62-g4f272af7b to Debian and the testlang test broke all builds (e.g. amd64 ) with the following confusing error:
Running language API tests...
./testlang
Language = "C"
Encoding = "utf-8"
No = "No" (FAIL)
Yes = "Yes" (FAIL)
_cupsStrScand("1") number=1.000000
_cupsStrFormatd(1.000000) buffer="1"
_cupsStrScand("-1") number=-1.000000
_cupsStrFormatd(-1.000000) buffer="-1"
_cupsStrScand("3") number=3.000000
_cupsStrFormatd(3.000000) buffer="3"
_cupsStrScand("5.125") number=5.125000
_cupsStrFormatd(5.125000) buffer="5.125"
Makefile:517: recipe for target 'testlang' failed
It seems that the test expects a different result between the original locale and the build locale. Above, when built with C.UTF-8 it breaks although with my fr_CH.utf-8 it succeeds:
./testlang
Language = "fr_CH"
Encoding = "utf-8"
No = "Non" (PASS)
Yes = "Oui" (PASS)
a) this is a unit test, and b) the code is testing whether it gets a different pointer (i.e. it has a localization) for each of the strings, showing that the underlying localization code is working (i.e. this is a unit test).
If you don't use a locale with a localization, this unit test will fail. Using even "en" will make it work.
I will look at updating the unit test program to override the default locale if it is any variant of "C".
When the unit test is explicitly testing the environment (i.e. test language localization using the current locale), it ABSOLUTELY MUST DO ITS JOB AND FAIL IF NO LOCALIZATION IS FOUND.
Again, this unit test is working exactly as it is supposed to. The failure (even for "en" in this case, since on Linux different localization files are involved) is 100% valid and points to an implementation bug.
Debian buildds have restricted environments with only C.utf-8 available and I make a point to run all available tests. How would you proceed there? Comment the test out?
First, testlang uses the message catalogs in the locale directory so it doesn't matter what the host OS has available/installed - we are testing the internal localization features of libcups.
Second, once I fix the bug in this unit test (and make sure there is a cups_en.po file), the test will work for both the POSIX ("C" locale) and other locales... The goal here is to catch localization bugs as soon as possible, and this unit test was updated for 2.2.4 to address a macOS localization bug that wasn't caught.
I debugged this further and found out why it worked locally but not during a build: it seems testlang uses the configured LOCALEDIR aka /usr/share/cups/locale. So ./testlang succeeds on a system with CUPS installed, but not during a clean build.
It seems a mechanism like the one in testppd (creating a fake symlink tree of the locale files to test) would be needed here, such as OdyX/cups@e3136bc .
Activity
michaelrsweet commentedon Aug 27, 2017
a) this is a unit test, and b) the code is testing whether it gets a different pointer (i.e. it has a localization) for each of the strings, showing that the underlying localization code is working (i.e. this is a unit test).
If you don't use a locale with a localization, this unit test will fail. Using even "en" will make it work.
I will look at updating the unit test program to override the default locale if it is any variant of "C".
OdyX commentedon Aug 27, 2017
That's not what I see here:
… where …
I stand to saying that this is fragile: a unit-test should not depend on the environment.
michaelrsweet commentedon Aug 27, 2017
When the unit test is explicitly testing the environment (i.e. test language localization using the current locale), it ABSOLUTELY MUST DO ITS JOB AND FAIL IF NO LOCALIZATION IS FOUND.
Again, this unit test is working exactly as it is supposed to. The failure (even for "en" in this case, since on Linux different localization files are involved) is 100% valid and points to an implementation bug.
OdyX commentedon Aug 27, 2017
Fair enough.
Debian buildds have restricted environments with only C.utf-8 available and I make a point to run all available tests. How would you proceed there? Comment the test out?
michaelrsweet commentedon Aug 27, 2017
First, testlang uses the message catalogs in the locale directory so it doesn't matter what the host OS has available/installed - we are testing the internal localization features of libcups.
Second, once I fix the bug in this unit test (and make sure there is a cups_en.po file), the test will work for both the POSIX ("C" locale) and other locales... The goal here is to catch localization bugs as soon as possible, and this unit test was updated for 2.2.4 to address a macOS localization bug that wasn't caught.
OdyX commentedon Aug 28, 2017
I debugged this further and found out why it worked locally but not during a build: it seems
testlanguses the configuredLOCALEDIRaka/usr/share/cups/locale. So./testlangsucceeds on a system with CUPS installed, but not during a clean build.It seems a mechanism like the one in
testppd(creating a fake symlink tree of the locale files to test) would be needed here, such as OdyX/cups@e3136bc .Through doing that patch, I also noticed that the translation code defaults to using
…/C/cups_C.pofor ten+years https://github.com/apple/cups/blob/master/cups/language.c#L1659 where that file was never provided:Fix the localization unit test on Linux (Issue #5097)
michaelrsweet commentedon Aug 28, 2017
[master 9964a31] Fix the localization unit test on Linux (Issue #5097)
More changes for localization unit test (Issue #5097)
michaelrsweet commentedon Aug 28, 2017
OK, this appears to be fixed now.