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

tests/timer_create.c

index 983aa970701a50b9482530b3f5be61dfb4c6ce7d..651b426e0c0b6099daf260befafdfbcb83b8bbb0 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 <signal.h>
-#include <time.h>
-#include <unistd.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_timer_create
 
+# include <stdio.h>
+# include <signal.h>
+# include <time.h>
+# include <unistd.h>
+
 int
 main(void)
 {
@@ -46,7 +47,7 @@ main(void)
        };
 
        if (syscall(__NR_timer_create, CLOCK_REALTIME, &sev, &tid[0]))
-               return 77;
+               perror_msg_and_skip("timer_create CLOCK_REALTIME");
        printf("timer_create(CLOCK_REALTIME, {sigev_value={int=%d, ptr=%p}"
               ", sigev_signo=%u, sigev_notify=SIGEV_NONE}"
               ", [%d]) = 0\n",
@@ -57,7 +58,7 @@ main(void)
        sev.sigev_notify = SIGEV_SIGNAL;
        sev.sigev_signo = SIGALRM;
        if (syscall(__NR_timer_create, CLOCK_MONOTONIC, &sev, &tid[1]))
-               return 77;
+               perror_msg_and_skip("timer_create CLOCK_MONOTONIC");
        printf("timer_create(CLOCK_MONOTONIC, {sigev_value={int=%d, ptr=%p}"
               ", sigev_signo=SIGALRM, sigev_notify=SIGEV_SIGNAL}"
               ", [%d]) = 0\n",
@@ -70,7 +71,7 @@ main(void)
        sev.sigev_notify_attributes =
                (void *) (unsigned long) 0xcafef00dfacefeed;
        if (syscall(__NR_timer_create, CLOCK_REALTIME, &sev, &tid[2]))
-               return 77;
+               perror_msg_and_skip("timer_create CLOCK_REALTIME");
        printf("timer_create(CLOCK_REALTIME, {sigev_value={int=%d, ptr=%p}"
               ", sigev_signo=SIGALRM, sigev_notify=SIGEV_THREAD"
               ", sigev_notify_function=%p, sigev_notify_attributes=%p}"
@@ -96,7 +97,7 @@ main(void)
        sev.sigev_notify = SIGEV_THREAD_ID;
        sev.sigev_notify_thread_id = getpid();
        if (syscall(__NR_timer_create, CLOCK_MONOTONIC, &sev, &tid[3]))
-               return 77;
+               perror_msg_and_skip("timer_create CLOCK_MONOTONIC");
        printf("timer_create(CLOCK_MONOTONIC, {sigev_value={int=%d, ptr=%p}"
               ", sigev_signo=SIGALRM, sigev_notify=SIGEV_THREAD_ID"
               ", sigev_notify_thread_id=%d}"
@@ -113,10 +114,6 @@ main(void)
 
 #else
 
-int
-main(void)
-{
-       return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_timer_create")
 
 #endif