summaryrefslogtreecommitdiff
path: root/gnulib-tests/test-open.h
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-tests/test-open.h')
-rw-r--r--gnulib-tests/test-open.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/gnulib-tests/test-open.h b/gnulib-tests/test-open.h
index 8996c09..c57054f 100644
--- a/gnulib-tests/test-open.h
+++ b/gnulib-tests/test-open.h
@@ -1,5 +1,5 @@
/* Test of opening a file descriptor.
- Copyright (C) 2007-2018 Free Software Foundation, Inc.
+ Copyright (C) 2007-2020 Free Software Foundation, Inc.
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
@@ -37,8 +37,11 @@ static ALWAYS_INLINE int
test_open (int (*func) (char const *, int, ...), bool print)
{
int fd;
+
/* Remove anything from prior partial run. */
unlink (BASE "file");
+ unlink (BASE "e.exe");
+ unlink (BASE "link");
/* Cannot create directory. */
errno = 0;
@@ -51,6 +54,11 @@ test_open (int (*func) (char const *, int, ...), bool print)
ASSERT (0 <= fd);
ASSERT (close (fd) == 0);
+ /* Create an executable regular file. */
+ fd = func (BASE "e.exe", O_CREAT | O_RDONLY, 0700);
+ ASSERT (0 <= fd);
+ ASSERT (close (fd) == 0);
+
/* Trailing slash handling. */
errno = 0;
ASSERT (func (BASE "file/", O_RDONLY) == -1);
@@ -98,6 +106,7 @@ test_open (int (*func) (char const *, int, ...), bool print)
/* Cleanup. */
ASSERT (unlink (BASE "file") == 0);
+ ASSERT (unlink (BASE "e.exe") == 0);
ASSERT (unlink (BASE "link") == 0);
return 0;