From: Dmitry V. Levin Date: Wed, 6 Jan 2016 09:36:00 +0000 (+0000) Subject: tests/truncate64.c: use libtests X-Git-Tag: v4.12~719 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bf0eb0859e6d374b0cb833606760c0469347230;p=strace tests/truncate64.c: use libtests * tests/truncate64.c: Use SKIP_MAIN_UNDEFINED. (main): Use assert and perror_msg_and_skip. --- diff --git a/tests/truncate64.c b/tests/truncate64.c index ba7f827b..0e193d59 100644 --- a/tests/truncate64.c +++ b/tests/truncate64.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,9 +30,10 @@ #ifdef __NR_truncate64 -#include -#include -#include +# include +# include +# include +# include int main(void) @@ -40,12 +41,11 @@ main(void) static const char fname[] = "truncate64\nfilename"; static const char qname[] = "truncate64\\nfilename"; const off_t len = 0xdefaceddeadbeef; - int rc = truncate(fname, len); - if (rc != -1 || ENOENT != errno) - return 77; - - printf("truncate64(\"%s\", %llu) = -1 ENOENT (No such file or directory)\n", + assert(truncate(fname, len) == -1); + if (ENOENT != errno) + perror_msg_and_skip("truncate"); + printf("truncate64(\"%s\", %llu) = -1 ENOENT (%m)\n", qname, (unsigned long long) len); puts("+++ exited with 0 +++"); @@ -54,10 +54,6 @@ main(void) #else -int -main(void) -{ - return 77; -} +SKIP_MAIN_UNDEFINED("__NR_truncate64") #endif