harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r499423 - /harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c
Date Wed, 24 Jan 2007 14:44:06 GMT
Author: hindessm
Date: Wed Jan 24 06:44:05 2007
New Revision: 499423

URL: http://svn.apache.org/viewvc?view=rev&rev=499423
Log:
Attempt to ensure that created files/directories are removed.

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c?view=diff&rev=499423&r1=499422&r2=499423
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfile/shared/hyfile.c
Wed Jan 24 06:44:05 2007
@@ -51,6 +51,7 @@
   if (!fd) {
     fprintf(stderr, "Failed to open hytest.tmp for write %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -58,6 +59,7 @@
   printf("  hyfile_write wrote %d bytes\n", bytes);
   if (bytes != 7) {
     fprintf(stderr, "hyfile_write wrote %d bytes not %d\n", bytes, 7);
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -65,6 +67,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_write_text write failed: %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -73,6 +76,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_sync failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -80,6 +84,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_close failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -87,6 +92,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_move failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -96,6 +102,7 @@
   if (!fd) {
     fprintf(stderr, "Failed to open hytest.tmp2 for read %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -103,6 +110,7 @@
   printf("  offset = %d\n", offset);
   if (offset != 7) {
     fprintf(stderr, "Failed to seek hytest.tmp2\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -112,11 +120,13 @@
   printf("  buf = %s\n", buf);
   if (bytes != 10) {
     fprintf(stderr, "Failed to read hytest.tmp2\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
   if (strcmp(buf, "testing123") != 0) {
     fprintf(stderr, "Failed to read correct content from hytest.tmp2\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -124,6 +134,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_close failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -131,11 +142,13 @@
   printf("  length = %d\n", length);
   if (length != 18) {
     fprintf(stderr, "hytest.tmp2 has incorrect length\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
   if (hyportLibrary.file_attr(&hyportLibrary, "hytest.tmp2") != HyIsFile) {
     fprintf(stderr, "hytest.tmp2 has incorrect type\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -143,6 +156,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_unlink failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -150,11 +164,13 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_mkdir failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
   if (hyportLibrary.file_attr(&hyportLibrary, "hytest.dir.tmp") != HyIsDir) {
     fprintf(stderr, "hytest.dir.tmp has incorrect type\n");
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -162,6 +178,7 @@
   if (rc != 0) {
     fprintf(stderr, "hyfile_unlinkdir failed %s\n",
             hyportLibrary.error_last_error_message(&hyportLibrary));
+    cleanup(hyportLibrary);
     exit(1);
   }
 
@@ -173,3 +190,12 @@
 
   return 0;
 }
+
+void cleanup(HyPortLibrary hyportLibrary)
+{
+  hyportLibrary.file_unlink(&hyportLibrary, "hytest.tmp");
+  hyportLibrary.file_unlink(&hyportLibrary, "hytest.tmp2");
+  hyportLibrary.file_unlinkdir(&hyportLibrary, "hytest.dir.tmp");
+}
+
+



Mime
View raw message