Permalink
Browse files

add test to make sure a created file survives an unmount/mount cycle

  • Loading branch information...
1 parent 7309f88 commit 92a93f4982d6d2af8bb557a2af84ad2cac8ea51b @eighthave eighthave committed May 17, 2012
Showing with 18 additions and 2 deletions.
  1. +18 −2 src/info/guardianproject/test/iocipher/VirtualFileSystemTest.java
@@ -40,8 +40,24 @@ public void testInitMountMkdirUnmount() {
} else {
Log.i(TAG, "vfs is NOT mounted");
}
- File f = new File("/test");
- assertTrue(f.mkdir());
+ File d = new File("/test");
+ assertTrue(d.mkdir());
+ vfs.unmount();
+ }
+
+ public void testMountCreateUnmountMountExists() {
+ vfs.mount();
+ File f = new File("/testMountCreateUnmountMountExists."
+ + Integer.toString((int) (Math.random() * 1024)));
+ try {
+ f.createNewFile();
+ } catch (Exception e) {
+ Log.e(TAG, "cannot create " + f.getPath());
+ assertFalse(true);
+ }
+ vfs.unmount();
+ vfs.mount();
+ assertTrue(f.exists());
vfs.unmount();
}
}

0 comments on commit 92a93f4

Please sign in to comment.