Old non-mainline Linux and current non-mainline qemu-user use different
syscall numbers than mainline Linux.
__NR_getppid and __NR_rt_sigreturn are swapped.
As the runtime environment can't be determined during compilation,
sidestep the whole issue by skipping the test.
Link: https://lore.kernel.org/linux-csky/2fa3151f-5aab-406c-95d9-add398ae58b3@t-8ch.de/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/testing/selftests/nolibc/nolibc-test.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 6fba7025c5e3c002085862fdf6fa950da6000d6c..daf6a9b84a3051413cbb1d01918f745c3b83426c 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -995,7 +995,7 @@ int run_syscall(int min, int max)
int tmp;
int ret = 0;
void *p1, *p2;
- int has_gettid = 1;
+ int has_gettid = 1, has_getppid = 1;
int has_brk;
/* <proc> indicates whether or not /proc is mounted */
@@ -1009,6 +1009,11 @@ int run_syscall(int min, int max)
has_gettid = __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 30);
#endif
+ /* qemu-user and non-mainline Linux use different syscall number */
+#if defined(__csky__)
+ has_getppid = 0;
+#endif
+
/* on musl setting brk()/sbrk() always fails */
has_brk = brk(0) == 0;
@@ -1020,7 +1025,7 @@ int run_syscall(int min, int max)
*/
switch (test + __LINE__ + 1) {
CASE_TEST(getpid); EXPECT_SYSNE(1, getpid(), -1); break;
- CASE_TEST(getppid); EXPECT_SYSNE(1, getppid(), -1); break;
+ CASE_TEST(getppid); EXPECT_SYSNE(has_getppid, getppid(), -1); break;
CASE_TEST(gettid); EXPECT_SYSNE(has_gettid, gettid(), -1); break;
CASE_TEST(getpgid_self); EXPECT_SYSNE(1, getpgid(0), -1); break;
CASE_TEST(getpgid_bad); EXPECT_SYSER(1, getpgid(-1), -1, ESRCH); break;
--
2.46.2