From: Dmitry V. Levin Date: Wed, 6 Jan 2016 09:34:30 +0000 (+0000) Subject: tests/ftruncate.c: use libtests X-Git-Tag: v4.12~722 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4c6592c150d1dfa7c61ef0df0c79f87811e5ba6;p=strace tests/ftruncate.c: use libtests * tests/ftruncate.c: Use SKIP_MAIN_UNDEFINED. (main): Use assert and perror_msg_and_skip. --- diff --git a/tests/ftruncate.c b/tests/ftruncate.c index d910e71e..68e3fa8d 100644 --- a/tests/ftruncate.c +++ b/tests/ftruncate.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 @@ -30,27 +30,27 @@ #ifdef __NR_ftruncate -#include -#include -#include +# include +# include +# include +# include -#include "kernel_types.h" +# include "kernel_types.h" int main(void) { const kernel_ulong_t len = (kernel_ulong_t) 0xdefaced0badc0deULL; - int rc; if (sizeof(len) > sizeof(long)) - rc = ftruncate(-1, len); + assert(ftruncate(-1, len) == -1); else - rc = syscall(__NR_ftruncate, -1L, len); + assert(syscall(__NR_ftruncate, -1L, len) == -1); - if (rc != -1 || EBADF != errno) - return 77; + if (EBADF != errno) + perror_msg_and_skip("ftruncate"); - printf("ftruncate(-1, %llu) = -1 EBADF (Bad file descriptor)\n", + printf("ftruncate(-1, %llu) = -1 EBADF (%m)\n", (unsigned long long) len); puts("+++ exited with 0 +++"); @@ -59,10 +59,6 @@ main(void) #else -int -main(void) -{ - return 77; -} +SKIP_MAIN_UNDEFINED("__NR_ftruncate") #endif