]> granicus.if.org Git - strace/commitdiff
tests/timerfd_xettime.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 09:51:37 +0000 (09:51 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 09:51:37 +0000 (09:51 +0000)
* tests/timerfd_xettime.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

tests/timerfd_xettime.c

index e8f408328c8489e74b7839bb7ad78999722dfdd1..f97c1db904667152975380adcdf8b776f4e71ef4 100644 (file)
@@ -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
  */
 
 #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 \
  && 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