diff options
author | Oleg Nesterov <oleg@redhat.com> | 2024-04-12 14:35:36 +0200 |
---|---|---|
committer | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-04-24 16:37:15 +0000 |
commit | c42229ff08af45998f40114e1b7d953514c92c19 (patch) | |
tree | 889b60a6af2f9f1faf5cf94cb72588ab5e49afd1 | |
parent | 997e38a303c5178b6e8af1e120c2d2ef01baf175 (diff) | |
download | common-c42229ff08af45998f40114e1b7d953514c92c19.tar.gz |
UPSTREAM: selftests: kselftest: Fix build failure with NOLIBC
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>
Change-Id: Ifdc3a80d0837590b4010aa25832f5dac1f31e410
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/
(cherry picked from commit 16767502aa990cca2cb7d1372b31d328c4c85b40)
Signed-off-by: Edward Liaw <edliaw@google.com>
-rw-r--r-- | tools/testing/selftests/kselftest.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 973b18e156b2..16ab1bb9cc83 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -392,6 +392,10 @@ 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 0; +#else unsigned int major, minor; struct utsname info; @@ -399,6 +403,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 */ |