gethostid: skip test if sethostid undefined
PATCH 1/1 gethostid: skip test if sethostid undefined
This is to avoid compiling error if the sethostid() is not implemented, e.g. build with Alpine's musl-libc.
CI: https://github.com/wangli5665/ltp/runs/3019192920
--- configure.ac | 1 + testcases/kernel/syscalls/gethostid/gethostid01.c | 6 ++++++ 2 files changed, 7 insertions(+)
configure.ac +1 -0
@@ -128,6 +128,7 @@ AC_CHECK_FUNCS_ONCE([ \ renameat2 \ sched_getcpu \ sendmmsg \ + sethostid \ setns \ sigpending \ splice \
testcases/kernel/syscalls/gethostid/gethostid01.c +6 -0
@@ -26,6 +26,8 @@#include "tst_test.h" +#ifdef HAVE_SETHOSTID +static long origin;static long tc[] = {0x00000000 ,0x0000ffff };
@@ -64,3 +66,7 @@ static struct tst_test test = { .needs_root = 1, .tcnt = ARRAY_SIZE(tc), }; + +#else +TST_TEST_TCONF ("sethostid is undefined." ); +#endif
Signature · 1 line
2.31.1
PATCH 1/1 gethostid: skip test if sethostid undefined
Hi!
Quoted 28 lines
This is to avoid compiling error if the
sethostid()is not implemented, e.g. build with Alpine's musl-libc.CI: https://github.com/wangli5665/ltp/runs/3019192920
Signed-off-by Li Wang <[email protected]>--- configure.ac | 1 + testcases/kernel/syscalls/gethostid/gethostid01.c | 6 ++++++ 2 files changed, 7 insertions(+)configure.ac +1
-0@@ -128,6 +128,7 @@ AC_CHECK_FUNCS_ONCE([ \ renameat2 \ sched_getcpu \ sendmmsg \ + sethostid \ setns \ sigpending \ splice \testcases/kernel/syscalls/gethostid/gethostid01.c +0
-0
testcases/kernel/syscalls/gethostid/gethostid01.c line 27
Quoted 2 lines
testcases/kernel/syscalls/gethostid/gethostid01.c +0
-0@@ -26,6 +26,8 @@#include "tst_test.h"
Shouldn't we include config.h here?
testcases/kernel/syscalls/gethostid/gethostid01.c static struct tst_test test = { · line 72
Quoted 13 lines
testcases/kernel/syscalls/gethostid/gethostid01.c +6
-0+#ifdef HAVE_SETHOSTID +static long origin;static long tc[] = {0x00000000 ,0x0000ffff };@@ -64,3 +66,7 @@ static struct tst_test test = { .needs_root = 1, .tcnt = ARRAY_SIZE(tc), }; + +#else +TST_TEST_TCONF ("sethostid is undefined." ); +#endif
Other than that Reviewed-by: Cyril Hrubis <[email protected]>
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 gethostid: skip test if sethostid undefined
Quoted 8 lines
testcases/kernel/syscalls/gethostid/gethostid01.c line 27
Quoted 5 lines
testcases/kernel/syscalls/gethostid/gethostid01.c +0
-0@@ -26,6 +26,8 @@#include "tst_test.h" Shouldn't we include
config.hhere?
Yes, merged with including. Thanks for the quick reply.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210708/f407eb87/attachment.htm>
PATCH 1/1 gethostid: skip test if sethostid undefined
Hi Li,
Quoted 10 lines
Quoted 7 lines
testcases/kernel/syscalls/gethostid/gethostid01.c line 27
Quoted 5 lines
testcases/kernel/syscalls/gethostid/gethostid01.c +0
-0@@ -26,6 +26,8 @@#include "tst_test.h" Shouldn't we include
config.hhere?Yes, merged with including. Thanks for the quick reply.
Thanks for fixing 39f341af5 ("gethostid: Rewrite with newlib and use/test sethostid")
Kind regards,
Petr