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

tests/sched_xetattr.c

index 02061f4702e364d6148e0c7067748b508f595720..c06e9b26c8b48e20c7d71c1c4123f8b04ae539de 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 <inttypes.h>
-#include <unistd.h>
 #include <sys/syscall.h>
 
 #if defined __NR_sched_getattr && defined __NR_sched_setattr
 
+# include <inttypes.h>
+# include <stdio.h>
+# include <unistd.h>
+
 int
 main(void)
 {
@@ -51,7 +52,7 @@ main(void)
        } sched;
 
        if (syscall(__NR_sched_getattr, 0, &sched, sizeof(sched), 0))
-               return 77;
+               perror_msg_and_skip("sched_getattr");
 
        printf("sched_getattr\\(0, \\{size=%u, sched_policy=SCHED_[A-Z]+, sched_flags=%s, sched_nice=%u, sched_priority=%u, sched_runtime=%" PRIu64 ", sched_deadline=%" PRIu64 ", sched_period=%" PRIu64 "\\}, 256, 0\\) += 0\n",
                sched.attr.size,
@@ -64,7 +65,7 @@ main(void)
 
        sched.attr.sched_flags |= 1;
        if (syscall(__NR_sched_setattr, 0, &sched, 0))
-               return 77;
+               perror_msg_and_skip("sched_setattr");
 
        printf("sched_setattr\\(0, \\{size=%u, sched_policy=SCHED_[A-Z]+, sched_flags=%s, sched_nice=%u, sched_priority=%u, sched_runtime=%" PRIu64 ", sched_deadline=%" PRIu64 ", sched_period=%" PRIu64 "\\}, 0\\) += 0\n",
                sched.attr.size,
@@ -80,10 +81,6 @@ main(void)
 
 #else
 
-int
-main(void)
-{
-       return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_sched_getattr && __NR_sched_setattr")
 
 #endif