@@ -392,6 +392,11 @@ static inline __printf(1, 2) 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 -1;
+#else
unsigned int major, minor;
struct utsname info;
@@ -399,6 +404,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 */
@@ -241,7 +241,7 @@ static int check_timer_distribution(void)
if (!ctd_failed)
ksft_test_result_pass("check signal distribution\n");
- else if (ksft_min_kernel_version(6, 3))
+ else if (ksft_min_kernel_version(6, 3) > 0)
ksft_test_result_fail("check signal distribution\n");
else
ksft_test_result_skip("check signal distribution (old kernel)\n");
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> Closes: https://lore.kernel.org/all/f0523b3a-ea08-4615-b0fb-5b504a2d39df@sirena.org.uk/ Signed-off-by: Oleg Nesterov <oleg@redhat.com> --- tools/testing/selftests/kselftest.h | 6 ++++++ tools/testing/selftests/timers/posix_timers.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)