subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1326633 - /subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c
Date Mon, 16 Apr 2012 14:36:17 GMT
Author: stefan2
Date: Mon Apr 16 14:36:17 2012
New Revision: 1326633

URL: http://svn.apache.org/viewvc?rev=1326633&view=rev
Log:
Make named_atomic-test find its sub-process under Windows, too.

* subversion/tests/libsvn_subr/named_atomic-test.c
  (run_procs): add a bit of directory magic

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c?rev=1326633&r1=1326632&r2=1326633&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c Mon Apr 16 14:36:17
2012
@@ -208,6 +208,21 @@ run_procs(apr_pool_t *pool, const char *
 
   /* all processes and their I/O data */
   apr_proc_t *process = apr_palloc(pool, count * sizeof(*process));
+  const char * directory = NULL;
+
+#ifdef _WIN32
+  /* Under Windows, the test will not be in the current directory
+   * and neither will be PROC. Therefore, determine its full path */
+  char path [MAX_PATH] = { 0 };
+  GetModuleFileNameA(NULL, path, sizeof(path));
+  *(strrchr(path, '\\') + 1) = 0;
+  proc = apr_pstrcat(pool, path, proc, ".exe", NULL);
+
+  /* And we need to set the working dir to our working dir to make
+   * our sub-processes find all DLLs. */
+  GetCurrentDirectoryA(sizeof(path), path);
+  directory = path;
+#endif
 
   /* start threads */
   for (i = 0; i < count; ++i)
@@ -222,16 +237,16 @@ run_procs(apr_pool_t *pool, const char *
         };
 
       SVN_ERR(svn_io_start_cmd3(&process[i],
-                                NULL,  /* path */
+                                directory,  /* working directory */
                                 args[0],
                                 args,
-                                NULL,  /* environment */
-                                FALSE, /* no handle inheritance */
-                                FALSE, /* no STDIN pipe */
+                                NULL,       /* environment */
+                                FALSE,      /* no handle inheritance */
+                                FALSE,      /* no STDIN pipe */
                                 NULL,
-                                FALSE, /* no STDOUT pipe */
+                                FALSE,      /* no STDOUT pipe */
                                 NULL,
-                                FALSE, /* no STDERR pipe */
+                                FALSE,      /* no STDERR pipe */
                                 NULL,
                                 pool));
     }



Mime
View raw message