[PATCH] Cygwin: testsuite: test relative path to exe after addchdir.

Jeremy Drake cygwin@jdrake.com
Thu Jun 26 20:29:05 GMT 2025


This is apparently relative to the new cwd, but my implementation is
currently treating it as relative to the parent's cwd, so it's worth
testing.

Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
---
 winsup/testsuite/winsup.api/posix_spawn/errors.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/winsup/testsuite/winsup.api/posix_spawn/errors.c b/winsup/testsuite/winsup.api/posix_spawn/errors.c
index 38563441f3..2fc3217bc0 100644
--- a/winsup/testsuite/winsup.api/posix_spawn/errors.c
+++ b/winsup/testsuite/winsup.api/posix_spawn/errors.c
@@ -15,6 +15,7 @@ void cleanup_tmpfile (void)

 int main (void)
 {
+  posix_spawn_file_actions_t fa;
   pid_t pid;
   int fd;
   char *childargv[] = {"ls", NULL};
@@ -53,5 +54,12 @@ int main (void)
       posix_spawn (&pid, tmpsub, NULL, NULL, childargv, environ));
 #endif

+  /* expected ENOENT: relative path after chdir */
+  errCode (posix_spawn_file_actions_init (&fa));
+  errCode (posix_spawn_file_actions_addchdir_np (&fa, "/tmp"));
+  errCodeExpected (ENOENT,
+      posix_spawn (&pid, tmppath, &fa, NULL, childargv, environ));
+  errCode (posix_spawn_file_actions_destroy (&fa));
+
   return 0;
 }
-- 
2.49.0.windows.1



More information about the Cygwin-patches mailing list