diff options
author | Bruno Haible <bruno@clisp.org> | 2019-09-15 14:41:57 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-09-15 17:27:27 +0200 |
commit | 9e75623a64a07215f2c7811e0356697d6df10fa2 (patch) | |
tree | efbc7d0bdfba2c3c930bc6880b6d06f7f3a9df1a | |
parent | 363834ac717a72835f599681ae98d4b433c82fe8 (diff) | |
download | gnulib-9e75623a64a07215f2c7811e0356697d6df10fa2.tar.gz gnulib-9e75623a64a07215f2c7811e0356697d6df10fa2.tar.bz2 |
open tests: Enhance test.
* tests/test-open.h (test_open): Test the creation of an executable
regular file. Also improve initial cleanup.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | tests/test-open.h | 9 |
2 files changed, 15 insertions, 0 deletions
@@ -1,5 +1,11 @@ 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. * tests/test-intprops.c: Disable a check that makes HP cc choke with "error 4018: Macro param too large after substitution - use -H option.". diff --git a/tests/test-open.h b/tests/test-open.h index e5c47d22ee..c0290ee889 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -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; |