annotate tests/test-open.c @ 17530:8981b79e1271

error: make the module depend on vfprintf-posix * modules/error (Depends-on): Add vfprintf-posix, since error calls vfprintf unconditionally, via error_tail.
author Jim Meyering <meyering@fb.com>
date Sat, 12 Oct 2013 19:28:40 -0700
parents e542fd46ad6f
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9300
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of opening a file descriptor.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
2 Copyright (C) 2007-2013 Free Software Foundation, Inc.
9300
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9300
diff changeset
4 This program is free software: you can redistribute it and/or modify
9300
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9300
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9300
diff changeset
7 (at your option) any later version.
9300
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9300
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
9300
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <fcntl.h>
da8b529f93ee Test for 'open' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
12489
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12259
diff changeset
23 #include "signature.h"
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12259
diff changeset
24 SIGNATURE_CHECK (open, int, (char const *, int, ...));
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12259
diff changeset
25
12259
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
26 #include <errno.h>
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
27 #include <stdbool.h>
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
28 #include <stdio.h>
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
29 #include <unistd.h>
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
30
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12489
diff changeset
31 #include "macros.h"
12259
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
32
12105
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
33 #define BASE "test-open.t"
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
34
11862
1cbf6c0e3f4d test-fcntl-safer: split from test-open
Eric Blake <ebb9@byu.net>
parents: 11849
diff changeset
35 #include "test-open.h"
12105
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
36
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
37 int
12197
e45d9bb2233e tests: avoid several compiler warnings
Eric Blake <ebb9@byu.net>
parents: 12105
diff changeset
38 main (void)
12105
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
39 {
12259
80f02cc1739e open: detect FreeBSD bug
Eric Blake <ebb9@byu.net>
parents: 12197
diff changeset
40 return test_open (open, true);
12105
edba99785b75 test-open: on GNU/Hurd, /dev/null is a directory
Eric Blake <ebb9@byu.net>
parents: 11862
diff changeset
41 }