summaryrefslogtreecommitdiff
path: root/tests/timerfd_xettime.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2016-01-06 09:51:37 +0000
committerDmitry V. Levin <ldv@altlinux.org>2016-01-06 09:51:37 +0000
commit3a7c659e769680e81e789025b31539ca62b43265 (patch)
tree0bd5da0df17a85173ce9a3b82853fe063ed93a81 /tests/timerfd_xettime.c
parent0566d548f98918222e86bbf8dcb6c1837cd5334b (diff)
downloadstrace-3a7c659e769680e81e789025b31539ca62b43265.tar.gz
tests/timerfd_xettime.c: use libtests
* tests/timerfd_xettime.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_skip.
Diffstat (limited to 'tests/timerfd_xettime.c')
-rw-r--r--tests/timerfd_xettime.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/timerfd_xettime.c b/tests/timerfd_xettime.c
index e8f408328..f97c1db90 100644
--- a/tests/timerfd_xettime.c
+++ b/tests/timerfd_xettime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,11 +26,7 @@
*/
#include "tests.h"
-#include <stdio.h>
-#include <stdint.h>
-#include <time.h>
#include <fcntl.h>
-#include <unistd.h>
#include <sys/syscall.h>
#if defined __NR_timerfd_create \
@@ -38,12 +34,17 @@
&& defined __NR_timerfd_settime \
&& defined O_CLOEXEC
+# include <stdio.h>
+# include <stdint.h>
+# include <time.h>
+# include <unistd.h>
+
int
main(void)
{
(void) close(0);
if (syscall(__NR_timerfd_create, CLOCK_MONOTONIC, O_CLOEXEC | O_NONBLOCK))
- return 77;
+ perror_msg_and_skip("timerfd_create");
puts("timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC|TFD_NONBLOCK) = 0");
struct {
@@ -60,7 +61,7 @@ main(void)
};
if (syscall(__NR_timerfd_settime, 0, 0, &new.its, &old.its))
- return 77;
+ perror_msg_and_skip("timerfd_settime");
printf("timerfd_settime(0, 0"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
@@ -75,7 +76,7 @@ main(void)
(intmax_t) old.its.it_value.tv_nsec);
if (syscall(__NR_timerfd_gettime, 0, &old.its))
- return 77;
+ perror_msg_and_skip("timerfd_gettime");
printf("timerfd_gettime(0"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
") = 0\n",
@@ -90,10 +91,7 @@ main(void)
#else
-int
-main(void)
-{
- return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_timerfd_create && __NR_timerfd_gettime"
+ " && __NR_timerfd_settime && O_CLOEXEC")
#endif