]> granicus.if.org Git - strace/commitdiff
tests/restart_syscall.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 5 Jan 2016 23:14:25 +0000 (23:14 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 5 Jan 2016 23:14:25 +0000 (23:14 +0000)
* tests/restart_syscall.c (main): Use assert, perror_msg_and_fail,
and perror_msg_and_skip.

tests/restart_syscall.c

index 860f1688e85c04d4149dd7305ccb0f21a3ad208e..3f07d7836cbffda675055cf6a5f446e0884fba0d 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
@@ -26,6 +26,7 @@
  */
 
 #include "tests.h"
+#include <assert.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <signal.h>
@@ -40,21 +41,19 @@ main(void)
         * x32 is broken from the beginning:
         * https://lkml.org/lkml/2015/11/30/790
         */
-       return 77;
+       error_msg_and_skip("x32 is broken");
 #else
        const sigset_t set = {};
        const struct sigaction act = { .sa_handler = SIG_IGN };
        const struct itimerval itv = { .it_value.tv_usec = 111111 };
        struct timespec req = { .tv_nsec = 222222222 }, rem;
 
-       if (sigaction(SIGALRM, &act, NULL))
-               return 77;
-       if (sigprocmask(SIG_SETMASK, &set, NULL))
-               return 77;
+       assert(sigaction(SIGALRM, &act, NULL) == 0);
+       assert(sigprocmask(SIG_SETMASK, &set, NULL) == 0);
        if (setitimer(ITIMER_REAL, &itv, NULL))
-               return 77;
+               perror_msg_and_skip("setitimer");
        if (nanosleep(&req, &rem))
-               return 0;
+               perror_msg_and_fail("nanosleep");
 
        printf("nanosleep\\(\\{%jd, %jd\\}, \\{%jd, %jd\\}\\)"
               " = \\? ERESTART_RESTARTBLOCK \\(Interrupted by signal\\)\n",