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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
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
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
3
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
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
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
7 (at your option) any later version.
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
8
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
12 GNU General Public License for more details.
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
13
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
16
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
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
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12487
diff changeset
21 #include "signature.h"
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12487
diff changeset
22 SIGNATURE_CHECK (fsync, int, (int));
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12487
diff changeset
23
10814
ce4af5bb9f57 Avoid test failure on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
24 #include <errno.h>
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
25 #include <fcntl.h>
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
26
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12489
diff changeset
27 #include "macros.h"
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
28
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
29 int
12197
e45d9bb2233e tests: avoid several compiler warnings
Eric Blake <ebb9@byu.net>
parents: 10814
diff changeset
30 main (void)
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
31 {
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
32 int fd;
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
33 const char *file = "test-fsync.txt";
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
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
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
37 fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
38 ASSERT (0 <= fd);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
39 ASSERT (write (fd, "hello", 5) == 5);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
40 ASSERT (fsync (fd) == 0);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
41 ASSERT (close (fd) == 0);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
42 ASSERT (unlink (file) == 0);
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
43
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
44 return 0;
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents:
diff changeset
45 }