On Cygwin, I see these test failures:

FAIL: test-execle.sh
====================

C:/cygwin64/home/bruno/testdir-all/build-cygwin64/gltests/test-exec-child.exe: 
error while loading shared libraries: ?: cannot open shared object file: No 
such file or directory
FAIL test-execle.sh (exit status: 1)

FAIL: test-execve.sh
====================

C:/cygwin64/home/bruno/testdir-all/build-cygwin64/gltests/test-exec-child.exe: 
error while loading shared libraries: ?: cannot open shared object file: No 
such file or directory
FAIL test-execve.sh (exit status: 1)

FAIL: test-execvpe.sh
=====================

C:/cygwin64/home/bruno/testdir-all/build-cygwin64/gltests/test-exec-child.exe: 
error while loading shared libraries: ?: cannot open shared object file: No 
such file or directory
FAIL test-execvpe.sh (exit status: 1)

This patch fixes them.


2021-01-20  Bruno Haible  <br...@clisp.org>

        exec*e tests: Avoid test failures on Cygwin.
        * tests/test-execle-main.c (main): On Cygwin, add /bin to the new PATH.
        * tests/test-execve-main.c (main): Likewise.
        * tests/test-execvpe-main.c (main): Likewise.

diff --git a/tests/test-execle-main.c b/tests/test-execle-main.c
index 1b1f33b..2c085f6 100644
--- a/tests/test-execle-main.c
+++ b/tests/test-execle-main.c
@@ -30,7 +30,17 @@ int
 main ()
 {
   const char *progname = "./test-exec-child";
-  const char *env[3] = { "PATH=.", "Hommingberg=Gepardenforelle", NULL };
+  const char *env[3] =
+    {
+      #ifdef __CYGWIN__
+      /* The Cygwin DLLs needed by the program are in /bin.  */
+      "PATH=.:/bin",
+      #else
+      "PATH=.",
+      #endif
+      "Hommingberg=Gepardenforelle",
+      NULL
+    };
   execle (progname,
           progname,
           "abc def",
diff --git a/tests/test-execve-main.c b/tests/test-execve-main.c
index 88d7a7e..970372d 100644
--- a/tests/test-execve-main.c
+++ b/tests/test-execve-main.c
@@ -30,7 +30,17 @@ int
 main ()
 {
   const char *progname = "./test-exec-child";
-  const char *env[3] = { "PATH=.", "Hommingberg=Gepardenforelle", NULL };
+  const char *env[3] =
+    {
+      #ifdef __CYGWIN__
+      /* The Cygwin DLLs needed by the program are in /bin.  */
+      "PATH=.:/bin",
+      #else
+      "PATH=.",
+      #endif
+      "Hommingberg=Gepardenforelle",
+      NULL
+    };
   const char *argv[12] =
     {
       progname,
diff --git a/tests/test-execvpe-main.c b/tests/test-execvpe-main.c
index 9b4eca2..560ae8e 100644
--- a/tests/test-execvpe-main.c
+++ b/tests/test-execvpe-main.c
@@ -30,7 +30,17 @@ int
 main ()
 {
   const char *progname = "test-exec-child";
-  const char *env[3] = { "PATH=.", "Hommingberg=Gepardenforelle", NULL };
+  const char *env[3] =
+    {
+      #ifdef __CYGWIN__
+      /* The Cygwin DLLs needed by the program are in /bin.  */
+      "PATH=.:/bin",
+      #else
+      "PATH=.",
+      #endif
+      "Hommingberg=Gepardenforelle",
+      NULL
+    };
   const char *argv[12] =
     {
       progname,


Reply via email to