From: Dmitry V. Levin Date: Wed, 6 Jan 2016 09:35:23 +0000 (+0000) Subject: tests/ftruncate64.c: use libtests X-Git-Tag: v4.12~721 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8efd32425522b3ef2712fbdd9d57ab1a1d691972;p=strace tests/ftruncate64.c: use libtests * tests/ftruncate64.c: Use SKIP_MAIN_UNDEFINED. (main): Use assert and perror_msg_and_skip. --- diff --git a/tests/ftruncate64.c b/tests/ftruncate64.c index 16b68c2b..37d0084c 100644 --- a/tests/ftruncate64.c +++ b/tests/ftruncate64.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,20 +30,21 @@ #ifdef __NR_ftruncate64 -#include -#include -#include +# include +# include +# include +# include int main(void) { const off_t len = 0xdefaceddeadbeef; - int rc = ftruncate(-1, len); - if (rc != -1 || EBADF != errno) - return 77; + assert(ftruncate(-1, len) == -1); + if (EBADF != errno) + perror_msg_and_skip("ftruncate"); - printf("ftruncate64(-1, %llu) = -1 EBADF (Bad file descriptor)\n", + printf("ftruncate64(-1, %llu) = -1 EBADF (%m)\n", (unsigned long long) len); puts("+++ exited with 0 +++"); @@ -52,10 +53,6 @@ main(void) #else -int -main(void) -{ - return 77; -} +SKIP_MAIN_UNDEFINED("__NR_ftruncate64") #endif