summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2024-04-12 15:35:36 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-27 18:11:44 +0300
commit63cc4f14bb039853e22353b1e344662b5ce70d4a (patch)
tree907341c489d127d5a067c89c09417ae9602bef8b /tools
parentc67f926ec870e96a704d7971d429d8e5c98d8f50 (diff)
downloadlinux-63cc4f14bb039853e22353b1e344662b5ce70d4a.tar.xz
selftests: kselftest: Fix build failure with NOLIBC
commit 16767502aa990cca2cb7d1372b31d328c4c85b40 upstream. As Mark explains ksft_min_kernel_version() can't be compiled with nolibc, it doesn't implement uname(). Fixes: 6d029c25b71f ("selftests/timers/posix_timers: Reimplement check_timer_distribution()") Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240412123536.GA32444@redhat.com Closes: https://lore.kernel.org/all/f0523b3a-ea08-4615-b0fb-5b504a2d39df@sirena.org.uk/ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/kselftest.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 68d5a93dff8d..e8eecbc83a60 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -331,6 +331,10 @@ static inline int ksft_exit_skip(const char *msg, ...)
static inline int ksft_min_kernel_version(unsigned int min_major,
unsigned int min_minor)
{
+#ifdef NOLIBC
+ ksft_print_msg("NOLIBC: Can't check kernel version: Function not implemented\n");
+ return 0;
+#else
unsigned int major, minor;
struct utsname info;
@@ -338,6 +342,7 @@ static inline int ksft_min_kernel_version(unsigned int min_major,
ksft_exit_fail_msg("Can't parse kernel version\n");
return major > min_major || (major == min_major && minor >= min_minor);
+#endif
}
#endif /* __KSELFTEST_H */