X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=tests%2Ftest-lseek.c;h=a57443db2230d00fa9ceb03aa74d9cba631e3ac7;hb=89ae4589dd58d12e7cbcf0e92c1d828c1e430f97;hp=f1f956e995083afd5e8589de1c3c9f09612546a2;hpb=40a871a5db0fb808c5224cf4d37af6c23c55290d;p=gnulib.git diff --git a/tests/test-lseek.c b/tests/test-lseek.c index f1f956e99..a57443db2 100644 --- a/tests/test-lseek.c +++ b/tests/test-lseek.c @@ -1,10 +1,10 @@ /* Test of lseek() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,26 +12,30 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* Written by Eric Blake, 2007. */ #include +#include + +#include "signature.h" +SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); + #include #include -#include #define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ + do \ + { \ + if (!(expr)) \ + { \ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - abort (); \ - } \ - } \ + fflush (stderr); \ + abort (); \ + } \ + } \ while (0) /* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' @@ -49,7 +53,11 @@ main (int argc, char **argv) ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; +#if ! defined __BEOS__ + /* POSIX says that the last lseek call, when failing, does not change + the current offset. But BeOS sets it to 0. */ ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); +#endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL); @@ -59,7 +67,11 @@ main (int argc, char **argv) ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; +#if ! defined __BEOS__ + /* POSIX says that the last lseek call, when failing, does not change + the current offset. But BeOS sets it to 0. */ ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); +#endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL);