usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-largefile.c
blobd2d6a1577b0c569e1a37e7e2b6c39c79b714953c
1 /* Test of largefile module.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2023. */
19 /* This test may fail if AC_SYS_LARGEFILE could not arrange for a 64-bit off_t.
20 This should be rare, though: only very old systems don't have support for
21 files larger than 2 GiB. */
23 #include <config.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include "intprops.h"
29 /* Although these tests could be done with static_assert, the test
30 harness prefers dynamic checking. */
32 int
33 main (void)
35 int result = 0;
37 /* Check the range of off_t.
38 With MSVC, this test succeeds only thanks to the 'sys_types' module. */
39 if (TYPE_MAXIMUM (off_t) >> 31 >> 31 == 0)
40 result |= 1;
42 /* Check the size of the 'struct stat' field 'st_size'.
43 With MSVC, this test succeeds only thanks to the 'sys_stat' module. */
45 struct stat st;
46 if (sizeof st.st_size != sizeof (off_t))
47 result |= 2;
50 return result;