Mercurial > hg > octave-shane > gnulib-hg
annotate tests/test-fsync.c @ 12520:e84eea643139
tests: fix license on several tests
The use of GPLv2+ was a relic of copy-and-paste, and not intentional.
* tests/test-des.c: Update to GPLv3+.
* tests/test-flock.c: Likewise.
* tests/test-fsync.c: Likewise.
* tests/test-futimens.h: Likewise.
* tests/test-gc-arcfour.c: Likewise.
* tests/test-gc-arctwo.c: Likewise.
* tests/test-gc-des.c: Likewise.
* tests/test-gc-hmac-md5.c: Likewise.
* tests/test-gc-hmac-sha1.c: Likewise.
* tests/test-gc-md2.c: Likewise.
* tests/test-gc-md4.c: Likewise.
* tests/test-gc-md5.c: Likewise.
* tests/test-gc-pbkdf2-sha1.c: Likewise.
* tests/test-gc-rijndael.c: Likewise.
* tests/test-gc-sha1.c: Likewise.
* tests/test-gc.c: Likewise.
* tests/test-getcwd.c: Likewise.
* tests/test-link.c: Likewise.
* tests/test-link.h: Likewise.
* tests/test-lutimens.h: Likewise.
* tests/test-md2.c: Likewise.
* tests/test-md4.c: Likewise.
* tests/test-mkdir.h: Likewise.
* tests/test-rename.c: Likewise.
* tests/test-rename.h: Likewise.
* tests/test-safe-alloc.c: Likewise.
* tests/test-utimens-common.h: Likewise.
* tests/test-utimens.h: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 29 Dec 2009 09:25:40 -0700 |
parents | a48d3d749ca5 |
children | c2cbabec01dd |
rev | line source |
---|---|
10565 | 1 /* Test of fsync() function. |
12197
e45d9bb2233e
tests: avoid several compiler warnings
Eric Blake <ebb9@byu.net>
parents:
10814
diff
changeset
|
2 Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
10565 | 3 |
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 | |
12520
e84eea643139
tests: fix license on several tests
Eric Blake <ebb9@byu.net>
parents:
12496
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
10565 | 7 (at your option) any later version. |
8 | |
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. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
16 | |
17 #include <config.h> | |
10814
ce4af5bb9f57
Avoid test failure on Haiku.
Bruno Haible <bruno@clisp.org>
parents:
10565
diff
changeset
|
18 |
12487
8ba9831d54bf
Include header file being tested immediately after config.h.
Bruno Haible <bruno@clisp.org>
parents:
12197
diff
changeset
|
19 #include <unistd.h> |
8ba9831d54bf
Include header file being tested immediately after config.h.
Bruno Haible <bruno@clisp.org>
parents:
12197
diff
changeset
|
20 |
12489 | 21 #include "signature.h" |
22 SIGNATURE_CHECK (fsync, int, (int)); | |
23 | |
10814
ce4af5bb9f57
Avoid test failure on Haiku.
Bruno Haible <bruno@clisp.org>
parents:
10565
diff
changeset
|
24 #include <errno.h> |
10565 | 25 #include <fcntl.h> |
26 | |
12496
a48d3d749ca5
Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents:
12489
diff
changeset
|
27 #include "macros.h" |
10565 | 28 |
29 int | |
12197
e45d9bb2233e
tests: avoid several compiler warnings
Eric Blake <ebb9@byu.net>
parents:
10814
diff
changeset
|
30 main (void) |
10565 | 31 { |
32 int fd; | |
33 const char *file = "test-fsync.txt"; | |
34 | |
10814
ce4af5bb9f57
Avoid test failure on Haiku.
Bruno Haible <bruno@clisp.org>
parents:
10565
diff
changeset
|
35 if (fsync (0) != 0) |
ce4af5bb9f57
Avoid test failure on Haiku.
Bruno Haible <bruno@clisp.org>
parents:
10565
diff
changeset
|
36 ASSERT (errno == EINVAL); |
10565 | 37 fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644); |
38 ASSERT (0 <= fd); | |
39 ASSERT (write (fd, "hello", 5) == 5); | |
40 ASSERT (fsync (fd) == 0); | |
41 ASSERT (close (fd) == 0); | |
42 ASSERT (unlink (file) == 0); | |
43 | |
44 return 0; | |
45 } |