You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/12 18:35:19 UTC

svn commit: r803585 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_getopt.h include/arch/windows/acr_arch.h os/win32/main.c shared/getopt.c test/testsuite.c

Author: mturk
Date: Wed Aug 12 16:35:18 2009
New Revision: 803585

URL: http://svn.apache.org/viewvc?rev=803585&view=rev
Log:
Fix Win32 late dll order

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_getopt.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
    commons/sandbox/runtime/trunk/src/main/native/shared/getopt.c
    commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_getopt.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_getopt.h?rev=803585&r1=803584&r2=803585&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_getopt.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_getopt.h Wed Aug 12 16:35:18 2009
@@ -40,7 +40,7 @@
 #define ACR_GETOPT_LONGONLY   0x04    /* operate as getopt_long_only */
 #define ACR_GETOPT_POSIXLY    0x08    /* Used instead POSIXLY_CORRECT env var */
 
-/** 
+/**
  * An @c apr_getopt_t error callback function.
  *
  * @a arg is this @c apr_getopt_t's @c errarg member.
@@ -51,7 +51,7 @@
 typedef struct acr_getopt_t acr_getopt_t;
 /**
  * Structure to store command line argument information.
- */ 
+ */
 struct acr_getopt_t {
     /** function to print error message (NULL == no messages) */
     acr_getopt_err_fn_t *errfn;

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=803585&r1=803584&r2=803585&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Wed Aug 12 16:35:18 2009
@@ -395,9 +395,9 @@
     SYSDLL_WS2_32       =  5,    /* ws2_32   From WinSock2.h             */
     SYSDLL_SHELL32      =  6,    /* shell32  From ShellAPI.h             */
     SYSDLL_ADVAPI32     =  7,    /* advapi32 From WinBase.h              */
-    SYSDLL_JVM          =  8,    /* jvm      From our own jvm.dll        */
-    SYSDLL_KTMW32       =  9,    /* ktmw32   From Ktmw32.h               */
-    SYSDLL_MSVCRT       = 10,    /* ktmw32   From Ktmw32.h               */
+    SYSDLL_MSVCRT       =  8,    /* msvcrt                               */
+    SYSDLL_JVM          =  9,    /* jvm      From our own jvm.dll        */
+    SYSDLL_KTMW32       = 10,    /* ktmw32   From Ktmw32.h               */
 
     SYSDLL_defined      = 11     /* must define as last idx_ + 1         */
 } acr_dlltoken_e;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=803585&r1=803584&r2=803585&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Wed Aug 12 16:35:18 2009
@@ -129,6 +129,7 @@
     "ws2_32.dll",
     "shell32.dll",
     "advapi32.dll",
+    "msvcrt.dll",
     "jvm.dll",
     "ktmw32.dll"
 };
@@ -181,7 +182,7 @@
                 rc = GetLastError();
                 SetErrorMode(em);
             }
-            if (!late_dll_handles[fnLib] && (fnLib < SYSDLL_KTMW32)) {
+            if (!late_dll_handles[fnLib] && (fnLib < SYSDLL_JVM)) {
                 /* Unable to load required library */
                 return rc;
             }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/getopt.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/getopt.c?rev=803585&r1=803584&r2=803585&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/getopt.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/getopt.c Wed Aug 12 16:35:18 2009
@@ -471,7 +471,7 @@
             *p = '\0';
             for (*valuep = ++p;
                  *p && *p != ',' && !acr_isspace(*p); ++p);
-            if (*p) 
+            if (*p)
                 *p++ = '\0';
         }
         else

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c?rev=803585&r1=803584&r2=803585&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Wed Aug 12 16:35:18 2009
@@ -33,6 +33,7 @@
 #include "acr_shm.h"
 #include "acr_crypto.h"
 #include "acr_getopt.h"
+#include "acr_env.h"
 #include "acr_version.h"
 
 #if defined (WIN32)
@@ -48,6 +49,8 @@
 #endif
 
 
+static int tests_failed = 0;
+
 static acr_getopt_option_t toptions[] = {
     {"help",    ACR_GETOPT_NO_ARGUMENT,         NULL,   'h', NULL },
     {"test",    ACR_GETOPT_REQUIRED_ARGUMENT,   NULL,   't', NULL },
@@ -55,12 +58,42 @@
     {NULL,                                 0,   NULL,     0, NULL }
 };
 
+
+static int test_getenv(int argc, const char *const argv[])
+{
+    int failed = 0;
+    const char *envval;
+
+    envval = ACR_EnvGet("PATH");
+    if (!envval)
+        failed++;
+    ACR_EnvSet("ACR_TEST_SUITE_VAR", "");
+    envval = ACR_EnvGet("ACR_TEST_SUITE_VAR");
+    if (envval)
+        failed++;
+    ACR_EnvSet("ACR_TEST_SUITE_VAR", "1");
+    envval = ACR_EnvGet("ACR_TEST_SUITE_VAR");
+    if (!envval)
+        failed++;
+    ACR_EnvDelete("ACR_TEST_SUITE_VAR");
+    envval = ACR_EnvGet("ACR_TEST_SUITE_VAR");
+    if (envval)
+        failed++;
+    tests_failed += failed;
+    if (failed)
+        fprintf(stderr, "getenv:        Failed (%d)\n", failed);
+    else
+        fprintf(stdout, "getenv:        OK\n");
+
+    return 0;
+}
+
 int main(int argc, const char *const argv[])
 {
     int rv = 0;
     acr_getopt_t *os;
     int ch;
-
+    const char *run_test = NULL;
     fprintf(stdout,
             "Running Apache Commons Runtime %s (%s version) test suite.\n",
             ACR_VERSION_STRING, ACR_GetLibraryBuilt());
@@ -83,7 +116,7 @@
                 goto cleanup;
             break;
             case 't' :
-                fprintf(stdout, "Using test %s\n", os->arg);
+                run_test = os->arg;
             break;
             default:
                 fprintf(stderr, "\n\nUsage  (TODO)\n");
@@ -94,10 +127,21 @@
     }
     argc -= os->ind;
     argv += os->ind;
+    if (ACR_EnvGet("ACR_TEST")) {
+        run_test = ACR_EnvGet("ACR_TEST");
+    }
+    if (run_test) {
+        fprintf(stdout, "Selected test: %s\n", run_test);
+        if (!stricmp(run_test, "all")) {
 
+        }
+        else if (!stricmp(run_test, "getenv")) {
+            rv = test_getenv(argc, argv);
+        }
+    }
 
 cleanup:
     ACR_GetoptFree(os);
-    return 0;
+    return rv;
 }