commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r806618 - /commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
Date Fri, 21 Aug 2009 16:02:37 GMT
Author: mturk
Date: Fri Aug 21 16:02:37 2009
New Revision: 806618

URL: http://svn.apache.org/viewvc?rev=806618&view=rev
Log:
Test IoClose

Modified:
    commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c

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=806618&r1=806617&r2=806618&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Fri Aug 21 16:02:37 2009
@@ -35,6 +35,8 @@
 #include "acr_crypto.h"
 #include "acr_getopt.h"
 #include "acr_env.h"
+#include "acr_io.h"
+#include "acr_dso.h"
 #include "acr_version.h"
 
 #if defined (WIN32)
@@ -42,11 +44,13 @@
 #include <sys/stat.h>
 #define random rand
 #define srandom srand
-#endif
-
-#if !defined(WIN32)
+#define PRINT_PSTR    "%S"
+#define STD_PREFIX    L"acr-test-"
+#else
 extern mode_t acr_default_umask;
 extern mode_t acr_default_perms;
+#define PRINT_PSTR    "%s"
+#define STD_PREFIX    "acr-test-"
 #endif
 
 
@@ -93,33 +97,37 @@
 {
     int failed = 0;
     int   fd;
-    char *fn;
-    fprintf(stdout, "Using Temporary Directory : `%s\'\n",
+    acr_pchar_t *fn;
+    fprintf(stdout, "Using Temporary Directory : `" PRINT_PSTR "\'\n",
             ACR_TempPathGet(NULL));
 
     fd = ACR_TempFileMake(NULL, ACR_TempPathGet(NULL),
-                          "acr-test-", 0);
+                          STD_PREFIX, 0);
     if (fd < 0)
         failed++;
     else {
-        fprintf(stdout, "Using Temporary File : `%s\'\n",
+        fprintf(stdout, "Using Temporary File : `" PRINT_PSTR "\'\n",
                 ACR_FileNameGet(NULL, fd));
+        if (ACR_IoClose(NULL, fd))
+            failed++;
     }
 
     fd = ACR_TempFileMake(NULL, ACR_TempPathGet(NULL),
-                          "acr-test-", 1);
+                          STD_PREFIX, 1);
     if (fd < 0)
         failed++;
     else {
-        fprintf(stdout, "Using Temporary File : `%s\'\n",
+        fprintf(stdout, "Using Temporary File : `" PRINT_PSTR "\'\n",
                 ACR_FileNameGet(NULL, fd));
+        if (ACR_IoClose(NULL, fd))
+            failed++;
     }
     fn = ACR_TempDirMake(NULL, ACR_TempPathGet(NULL),
-                          "acr-test-");
+                         STD_PREFIX);
     if (fn == NULL)
         failed++;
     else {
-        fprintf(stdout, "Using Temporary Dir  : `%s\'\n", fn);
+        fprintf(stdout, "Using Temporary Dir  : `" PRINT_PSTR "\'\n", fn);
         ACR_Free(NULL, THROW_NMARK, fn);
     }
 



Mime
View raw message