On 2025-04-23 14:08, Philippe Baril Lecavalier via Cygwin-apps wrote:
Thanks for pointing to good examples of custom src_test().
The package is not without some checks.
>>> Testing iso-codes-4.18.0-1.noarch
Making check in iso_639-2
make[1]: Entering directory
'/tmp/ramfs/iso-codes-4.18.0-1.noarch/build/iso_639-2'
make check-local
make[2]: Entering directory
'/tmp/ramfs/iso-codes-4.18.0-1.noarch/build/iso_639-2'
python3
/tmp/ramfs/iso-codes-4.18.0-1.noarch/src/iso-codes-v4.18.0/bin/check_valid_utf8.py
...
It prints a lot of things! We are done here, right?
Hold on a minute, what does that check_valid_utf8.py do? Let me
inspect it... Answer: Just what the name implies, with also a check
for header expected in one such file. And it only checks src, not what
was built (which is not a UTF text file, duh). Reasonable step for
upstream prior to packaging and releasing source, but here, it is of
little interest.
I don't know how best to check whether a *.mo file is "ok", but
there's this `msgunfmt` tool. Idea: Apply msgunfmt to each *.mo file
and then apply this check_valid_utf8.py on each such file. That is
what they should have done with their tests.
Was it a silly waste of time? No! Discovered something interesting.
There are some *.po files without any valid translation message (all
"" or fuzzy). We end up with useless *.mo files, and that
check_valid_utf8.py crashes on those after msgunfmt, because after MO
-> PO, those are empty files. And then there are a bunch of
symlinks... pointing to these empty files! Question: Why build empty
files and dump that on the system? Valid QA issue to share with
upstream.
A second set of tests I made involves a small program in C (no
bindings, we are going bare metal) that calls dgettext on selected
entries msg/domain/locale (against prefix ${D}). This checks whether
the returned value is as expected. The saved expected results may need
minor updates in the future. It also confirms at once that a bunch of
bundled locales just work. Sure, it could be done in python with
unittest wrapping it, but I like the idea that this thing will likely
work as is in 10+ years from now.
Log:
https://github.com/cygwin/scallywag/actions/runs/14623256814
Commit:
https://cygwin.com/cgit/cygwin-packages/iso-codes/commit/?id=eaab12dd973e77839b84e92577e40941e6f51799
Thanks Philippe, Amazing what you find, and what you added is nice and obvious!
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut
-- Antoine de Saint-Exupéry