diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-01-02 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-01-02 08:00:00 +0000 |
commit | 1fc71b1933773fb52f5cb178b1b2a67d63ff2674 (patch) | |
tree | e09365795530f1b0912ed868efb1f559d0d65f42 | |
parent | a9ea64c96b959cae494fb171c990ece89e8b786a (diff) | |
download | strace-1fc71b1933773fb52f5cb178b1b2a67d63ff2674.tar.gz |
tests: enable time_types.h based tests unconditionally
* tests/msg_control.c: Do not include <linux/time_types.h>,
include "kernel_time_types.h" unconditionally instead.
(test_scm_timestamp_new, test_scm_timestampns_new): Compile
unconditionally.
(test_sol_socket): Call them unconditionally.
* tests/sockopt-timestamp.c: Do not include <linux/time_types.h>,
include "kernel_time_types.h" unconditionally instead.
(print_timestamp_new, print_timestampns_new): Compile unconditionally.
(main): Call them unconditionally.
-rw-r--r-- | tests/msg_control.c | 14 | ||||
-rw-r--r-- | tests/sockopt-timestamp.c | 14 |
2 files changed, 2 insertions, 26 deletions
diff --git a/tests/msg_control.c b/tests/msg_control.c index 47ff1ad42..dde35715e 100644 --- a/tests/msg_control.c +++ b/tests/msg_control.c @@ -20,11 +20,7 @@ #include <netinet/in.h> #include <arpa/inet.h> -#if defined HAVE_STRUCT___KERNEL_SOCK_TIMEVAL \ - || defined HAVE_STRUCT___KERNEL_TIMESPEC -# include <linux/time_types.h> -#endif - +#include "kernel_time_types.h" #include "kernel_timeval.h" #include "kernel_old_timespec.h" @@ -361,7 +357,6 @@ test_scm_timestamping_old(struct msghdr *const mh, void *const page) (unsigned long) len, rc, errno2name()); } -#ifdef HAVE_STRUCT___KERNEL_SOCK_TIMEVAL static void test_scm_timestamp_new(struct msghdr *const mh, void *const page) { @@ -408,9 +403,7 @@ test_scm_timestamp_new(struct msghdr *const mh, void *const page) (unsigned) cmsg->cmsg_len, (unsigned long) len, sprintrc(rc)); } -#endif /* HAVE_STRUCT___KERNEL_SOCK_TIMEVAL */ -#ifdef HAVE_STRUCT___KERNEL_TIMESPEC static void test_scm_timestampns_new(struct msghdr *const mh, void *const page) { @@ -512,7 +505,6 @@ test_scm_timestamping_new(struct msghdr *const mh, void *const page) (unsigned) cmsg->cmsg_len, (unsigned long) len, sprintrc(rc)); } -#endif /* HAVE_STRUCT___KERNEL_TIMESPEC */ static void print_security(const struct cmsghdr *const cmsg, const size_t cmsg_len) @@ -662,13 +654,9 @@ test_sol_socket(struct msghdr *const mh, void *const page) test_scm_timestamp_old(mh, page); test_scm_timestampns_old(mh, page); test_scm_timestamping_old(mh, page); -#ifdef HAVE_STRUCT___KERNEL_SOCK_TIMEVAL test_scm_timestamp_new(mh, page); -#endif -#ifdef HAVE_STRUCT___KERNEL_TIMESPEC test_scm_timestampns_new(mh, page); test_scm_timestamping_new(mh, page); -#endif test_unknown_type(mh, page, ARG_STR(SOL_SOCKET), "SCM_???"); } diff --git a/tests/sockopt-timestamp.c b/tests/sockopt-timestamp.c index 100f11076..ab2487081 100644 --- a/tests/sockopt-timestamp.c +++ b/tests/sockopt-timestamp.c @@ -19,11 +19,7 @@ # include <unistd.h> # include <sys/socket.h> -# if defined HAVE_STRUCT___KERNEL_SOCK_TIMEVAL \ - || defined HAVE_STRUCT___KERNEL_TIMESPEC -# include <linux/time_types.h> -# endif - +# include "kernel_time_types.h" # include "kernel_timeval.h" # include "kernel_old_timespec.h" @@ -110,7 +106,6 @@ print_timestampns_old(const struct cmsghdr *c) (long long) ts.tv_sec, (long long) ts.tv_nsec); } -# ifdef HAVE_STRUCT___KERNEL_SOCK_TIMEVAL static void print_timestamp_new(const struct cmsghdr *c) { @@ -129,9 +124,7 @@ print_timestamp_new(const struct cmsghdr *c) printf("{tv_sec=%lld, tv_usec=%lld}", (long long) tv.tv_sec, (long long) tv.tv_usec); } -# endif /* HAVE_STRUCT___KERNEL_SOCK_TIMEVAL */ -# ifdef HAVE_STRUCT___KERNEL_TIMESPEC static void print_timestampns_new(const struct cmsghdr *c) { @@ -150,7 +143,6 @@ print_timestampns_new(const struct cmsghdr *c) printf("{tv_sec=%lld, tv_nsec=%lld}", (long long) ts.tv_sec, (long long) ts.tv_nsec); } -# endif /* HAVE_STRUCT___KERNEL_TIMESPEC */ static unsigned int test_sockopt(int so_val, const char *str, void (*fun)(const struct cmsghdr *)) @@ -243,12 +235,8 @@ main(void) } tests[] = { { SO_TIMESTAMP_OLD, "SO_TIMESTAMP_OLD", print_timestamp_old }, { SO_TIMESTAMPNS_OLD, "SO_TIMESTAMPNS_OLD", print_timestampns_old }, -# ifdef HAVE_STRUCT___KERNEL_SOCK_TIMEVAL { SO_TIMESTAMP_NEW, "SO_TIMESTAMP_NEW", print_timestamp_new }, -# endif -# ifdef HAVE_STRUCT___KERNEL_TIMESPEC { SO_TIMESTAMPNS_NEW, "SO_TIMESTAMPNS_NEW", print_timestampns_new }, -# endif }; unsigned int tested = 0; for (unsigned int i = 0; i < ARRAY_SIZE(tests); ++i) |