X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-utimensat.c;h=439bf250dfe33a0d545c25484dde002164849192;hb=906943bafa97f097349474b393980d7e84855036;hp=b1dc94012527d6139a909c4533e396440fd4e478;hpb=89ae4589dd58d12e7cbcf0e92c1d828c1e430f97;p=gnulib.git diff --git a/tests/test-utimensat.c b/tests/test-utimensat.c index b1dc94012..439bf250d 100644 --- a/tests/test-utimensat.c +++ b/tests/test-utimensat.c @@ -1,5 +1,5 @@ /* Tests of utimensat. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,18 +35,8 @@ SIGNATURE_CHECK (utimensat, int, (int, char const *, struct timespec const[2], #include "stat-time.h" #include "timespec.h" #include "utimecmp.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "ignore-value.h" +#include "macros.h" #define BASE "test-utimensat.t" @@ -77,7 +67,20 @@ main (void) int fd; /* Clean up any trash from prior testsuite runs. */ - ASSERT (system ("rm -rf " BASE "*") == 0); + ignore_value (system ("rm -rf " BASE "*")); + + /* Test behaviour for invalid file descriptors. */ + { + errno = 0; + ASSERT (utimensat (-1, "foo", NULL, 0) == -1); + ASSERT (errno == EBADF); + } + { + close (99); + errno = 0; + ASSERT (utimensat (99, "foo", NULL, 0) == -1); + ASSERT (errno == EBADF); + } /* Basic tests. */ result1 = test_utimens (do_utimensat, true);