]> Savannah Git Hosting - gnulib.git/commitdiff
open tests: Enhance test.
authorBruno Haible <bruno@clisp.org>
Sun, 15 Sep 2019 12:41:57 +0000 (14:41 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 15 Sep 2019 15:27:27 +0000 (17:27 +0200)
* tests/test-open.h (test_open): Test the creation of an executable
regular file. Also improve initial cleanup.

ChangeLog
tests/test-open.h

index c94ebeb0eaf36470b368191121035903900ababc..9f97bb0d4992144046a1882c62c8d8a4ffa9a488 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-15  Bruno Haible  <bruno@clisp.org>
+
+       open tests: Enhance test.
+       * tests/test-open.h (test_open): Test the creation of an executable
+       regular file. Also improve initial cleanup.
+
 2019-09-15  Bruno Haible  <bruno@clisp.org>
 
        intprops tests: Avoid build failure with HP-UX cc.
index e5c47d22ee6da19d1c429765852b748a7347a20b..c0290ee8891d3d31e96c0c97ad69a85d80362c45 100644 (file)
@@ -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;