Re: [PATCH] test_enosys: Handle musl libc error strings
Karel Zak <[email protected]> Mon, 23 Mar 2026 14:32:41 +0100
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <uzzujmmlyzncqwxlklu7ltnavmvcdlrbq43r5shz6pu2sjuirx@l3iwcbmfmj2g> |
On Sun, Mar 22, 2026 at 10:03:52PM -0500, Anna Wilcox wrote: > strerror(3) on musl gives different strings for some of the errnos we > test for, so the tests incorrectly fail on musl. Change the strings > back into the glibc ones so they match the expected values properly. > > Signed-off-by: Anna Wilcox <[email protected]> > Suggested-by: Sam James <[email protected]> > --- > tests/ts/enosys/enosys | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/tests/ts/enosys/enosys b/tests/ts/enosys/enosys > index 591b292a8..698283056 100755 > --- a/tests/ts/enosys/enosys > +++ b/tests/ts/enosys/enosys > @@ -20,6 +20,12 @@ TS_DESC="enosys" > . "$TS_TOPDIR"/functions.sh > ts_init "$*" > > +function ts_canonicalise_strerror { > + sed -Ei -e 's/Out of memory/Cannot allocate memory/g' \ > + -e 's/Not a tty/Inappropriate ioctl for device/g' \ > + -e 's/No error information/Success/g' $1 > +} For something like this we already use tests/helpers/test_strerror.c for example (git grep result): tests/ts/fdisk/oddinput:ts_check_test_command "$TS_HELPER_STRERROR" tests/ts/fdisk/oddinput:sed -i -e "s@$($TS_HELPER_STRERROR ENOENT)@ENOENT@" $TS_OUTPUT $TS_ERRLOG tests/ts/fdisk/oddinput:sed -i -e "s@$($TS_HELPER_STRERROR EINVAL)@EINVAL@" $TS_OUTPUT $TS_ERRLOG It replaces the error message with the errno abbreviation. Karel -- Karel Zak <[email protected]> http://karelzak.blogspot.com