From: Dmitry V. Levin Date: Wed, 6 Jan 2016 09:48:05 +0000 (+0000) Subject: tests/clock_xettime.c: use libtests X-Git-Tag: v4.12~717 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d499b5128023afa8532db5940777059ee5ef354;p=strace tests/clock_xettime.c: use libtests * tests/clock_xettime.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_skip. --- diff --git a/tests/clock_xettime.c b/tests/clock_xettime.c index 40a89c67..633351a0 100644 --- a/tests/clock_xettime.c +++ b/tests/clock_xettime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "tests.h" #include #include #include @@ -46,13 +47,13 @@ main(void) }; if (syscall(__NR_clock_getres, CLOCK_REALTIME, &t.ts)) - return 77; + perror_msg_and_skip("clock_getres CLOCK_REALTIME"); printf("clock_getres(CLOCK_REALTIME, {%jd, %jd}) = 0\n", (intmax_t) t.ts.tv_sec, (intmax_t) t.ts.tv_nsec); if (syscall(__NR_clock_gettime, CLOCK_PROCESS_CPUTIME_ID, &t.ts)) - return 77; + perror_msg_and_skip("clock_gettime CLOCK_PROCESS_CPUTIME_ID"); printf("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {%jd, %jd}) = 0\n", (intmax_t) t.ts.tv_sec, (intmax_t) t.ts.tv_nsec); @@ -60,9 +61,10 @@ main(void) t.ts.tv_sec = 0xdeface1; t.ts.tv_nsec = 0xdeface2; if (!syscall(__NR_clock_settime, CLOCK_THREAD_CPUTIME_ID, &t.ts)) - return 77; + error_msg_and_skip("clock_settime CLOCK_THREAD_CPUTIME_ID:" + " EINVAL expected"); printf("clock_settime(CLOCK_THREAD_CPUTIME_ID, {%jd, %jd})" - " = -1 EINVAL (Invalid argument)\n", + " = -1 EINVAL (%m)\n", (intmax_t) t.ts.tv_sec, (intmax_t) t.ts.tv_nsec); @@ -72,10 +74,6 @@ main(void) #else -int -main(void) -{ - return 77; -} +SKIP_MAIN_UNDEFINED("__NR_clock_getres && __NR_clock_gettime && __NR_clock_settime") #endif