From: Anna Wilcox <AWilcox@Wilcox-Tech.com>
To: util-linux@vger.kernel.org
Cc: Anna Wilcox <AWilcox@Wilcox-Tech.com>, Sam James <sam@gentoo.org>
Subject: [PATCH] test_enosys: Handle musl libc error strings
Date: Sun, 22 Mar 2026 22:03:52 -0500 [thread overview]
Message-ID: <20260323030358.59511-1-AWilcox@Wilcox-Tech.com> (raw)
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 <AWilcox@Wilcox-Tech.com>
Suggested-by: Sam James <sam@gentoo.org>
---
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
+}
+
ts_check_test_command "$TS_HELPER_ENOSYS"
ts_check_enosys_syscalls fallocate fsopen execve
@@ -34,6 +40,8 @@ $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
"$TS_CMD_ENOSYS" --syscall fallocate:12 $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
"$TS_CMD_ENOSYS" --syscall fallocate:ENOMEM $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+ts_canonicalise_strerror "$TS_OUTPUT"
+
ts_finalize_subtest
ts_init_subtest exec
@@ -43,6 +51,8 @@ FALLOCATE_TEST="$TS_HELPER_ENOSYS exec"
$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
"$TS_CMD_ENOSYS" --syscall execve $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+ts_canonicalise_strerror "$TS_OUTPUT"
+
ts_finalize_subtest
ts_init_subtest ioctl
@@ -57,6 +67,8 @@ $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
"$TS_CMD_ENOSYS" --ioctl FIOCLEX:12 $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
"$TS_CMD_ENOSYS" --ioctl FIOCLEX:ENOMEM $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+ts_canonicalise_strerror "$TS_OUTPUT"
+
ts_finalize_subtest
ts_finalize
--
2.52.0
next reply other threads:[~2026-03-23 3:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 3:03 Anna Wilcox [this message]
2026-03-23 13:32 ` [PATCH] test_enosys: Handle musl libc error strings Karel Zak
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=20260323030358.59511-1-AWilcox@Wilcox-Tech.com \
--to=awilcox@wilcox-tech.com \
--cc=sam@gentoo.org \
--cc=util-linux@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox