From: Aqib Faruqui <aqibaf@amazon.com>
To: Shuah Khan <shuah@kernel.org>, <linux-kselftest@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <nh-open-source@amazon.com>, <aqibaf@amazon.com>
Subject: [PATCH v2 6/7] selftests: Fix stdbuf compatibility in mixed libc environments
Date: Tue, 2 Sep 2025 17:01:43 +0000 [thread overview]
Message-ID: <20250902170147.55583-7-aqibaf@amazon.com> (raw)
In-Reply-To: <20250902170147.55583-1-aqibaf@amazon.com>
The original stdbuf use only checked if /usr/bin/stdbuf exists in the
host's system but failed to verify compatibility between stdbuf and the
target test binary.
The issue occurs when:
- Host system has glibc-based stdbuf from coreutils
- Selftest binaries are compiled with a non-glibc toolchain (cross
compilation)
The fix adds a runtime compatibility test against the target test binary
before enabling stdbuf, enabling cross-compiled selftests to run
successfully.
Signed-off-by: Aqib Faruqui <aqibaf@amazon.com>
---
tools/testing/selftests/kselftest/runner.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
index 2c3c58e65..8d4e33bd5 100644
--- a/tools/testing/selftests/kselftest/runner.sh
+++ b/tools/testing/selftests/kselftest/runner.sh
@@ -107,7 +107,7 @@ run_one()
echo "# Warning: file $TEST is missing!"
echo "not ok $test_num $TEST_HDR_MSG"
else
- if [ -x /usr/bin/stdbuf ]; then
+ if [ -x /usr/bin/stdbuf ] && [ -x "$TEST" ] && /usr/bin/stdbuf --output=L ldd "$TEST" >/dev/null 2>&1; then
stdbuf="/usr/bin/stdbuf --output=L "
fi
eval kselftest_cmd_args="\$${kselftest_cmd_args_ref:-}"
--
2.47.3
next prev parent reply other threads:[~2025-09-02 17:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 17:01 [PATCH v2 0/7] Add compatibility fixes for KVM selftests with non-glibc C libraries Aqib Faruqui
2025-09-02 17:01 ` [PATCH v2 1/7] selftests/pidfd: Add architecture-specific fallback definitions for pidfd_open Aqib Faruqui
2025-09-02 17:01 ` [PATCH v2 2/7] selftests: harness: Include pidfd.h to get syscall definitions from tools/ Aqib Faruqui
2025-09-02 17:01 ` [PATCH v2 3/7] selftests: kselftest: Add memfd_create syscall compatibility Aqib Faruqui
2025-09-02 17:01 ` [PATCH v2 4/7] KVM: selftests: Add backtrace fallback Aqib Faruqui
2025-09-02 17:01 ` [PATCH v2 5/7] rseq: selftests: Add non-glibc compatibility fixes Aqib Faruqui
2025-09-02 17:01 ` Aqib Faruqui [this message]
2025-09-02 17:01 ` [PATCH v2 7/7] selftests: kselftest: Add ulong typedef for non-glibc compatibility Aqib Faruqui
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=20250902170147.55583-7-aqibaf@amazon.com \
--to=aqibaf@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nh-open-source@amazon.com \
--cc=shuah@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
all inboxes | Powered by JetHome®