>From 9e75623a64a07215f2c7811e0356697d6df10fa2 Mon Sep 17 00:00:00 2001 From: Bruno Haible
Date: Sun, 15 Sep 2019 14:41:57 +0200 Subject: [PATCH 1/3] open tests: Enhance test. * tests/test-open.h (test_open): Test the creation of an executable regular file. Also improve initial cleanup. --- ChangeLog | 6 ++++++ tests/test-open.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index c94ebeb..9f97bb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2019-09-15 Bruno Haible + 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 + 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 e5c47d2..c0290ee 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; -- 2.7.4