summaryrefslogtreecommitdiffstats
path: root/sched/tests
diff options
context:
space:
mode:
authorBenoit Lamarche <benoitlamarche@google.com>2015-02-02 16:14:34 +0100
committerBenoit Lamarche <benoitlamarche@google.com>2015-02-06 12:34:22 +0100
commit9455008864906968cbe9d061162319dcdc1cefa1 (patch)
tree8cb11627ac16e70e70875ea4190ade5e4532b2d5 /sched/tests
parent08cb1e6efe6099be1435544c62ec30ea51716064 (diff)
downloadtoolchain_jack-9455008864906968cbe9d061162319dcdc1cefa1.zip
toolchain_jack-9455008864906968cbe9d061162319dcdc1cefa1.tar.gz
toolchain_jack-9455008864906968cbe9d061162319dcdc1cefa1.tar.bz2
Retry adding CachedDirectFS
Change-Id: I389b367f5a425ea58733b8f8dc8533464d3974d7
Diffstat (limited to 'sched/tests')
-rw-r--r--sched/tests/com/android/sched/vfs/VFSTest.java49
1 files changed, 46 insertions, 3 deletions
diff --git a/sched/tests/com/android/sched/vfs/VFSTest.java b/sched/tests/com/android/sched/vfs/VFSTest.java
index 80d8ec2..0769a40 100644
--- a/sched/tests/com/android/sched/vfs/VFSTest.java
+++ b/sched/tests/com/android/sched/vfs/VFSTest.java
@@ -145,6 +145,50 @@ public class VFSTest {
}
@Test
+ public void testCachedDirectFS()
+ throws NotDirectoryException,
+ CannotCreateFileException,
+ WrongPermissionException,
+ CannotSetPermissionException,
+ NoSuchFileException,
+ FileAlreadyExistsException,
+ IOException {
+ File file = null;
+ InputOutputVFS directVFS = null;
+ InputOutputVFS directVFS2 = null;
+ try {
+ file = File.createTempFile("vfs", "dir");
+ String path = file.getAbsolutePath();
+ Assert.assertTrue(file.delete());
+
+ directVFS = new GenericInputOutputVFS(new CachedDirectFS(new Directory(path, null,
+ Existence.NOT_EXIST, Permission.WRITE, ChangePermission.NOCHANGE),
+ Permission.READ | Permission.WRITE));
+
+ testOutputVFS(directVFS);
+ testDelete(directVFS);
+ testInputVFS(directVFS);
+ directVFS.close();
+
+ directVFS2 =
+ new GenericInputOutputVFS(new DirectFS(new Directory(path, null, Existence.MUST_EXIST,
+ Permission.WRITE, ChangePermission.NOCHANGE), Permission.READ | Permission.WRITE));
+ testInputVFS(directVFS2);
+
+ } finally {
+ if (directVFS != null) {
+ directVFS.close();
+ }
+ if (directVFS2 != null) {
+ directVFS2.close();
+ }
+ if (file != null) {
+ FileUtils.deleteDir(file);
+ }
+ }
+ }
+
+ @Test
public void testDeflateFS()
throws NotDirectoryException,
CannotCreateFileException,
@@ -560,8 +604,7 @@ public class VFSTest {
// let's delete "dirA/dirAA/dirAAB/fileAAB1"
InputOutputVDir dirA = ioVFS.getRootInputOutputVDir().getInputVDir(new VPath("dirA", '/'));
{
- InputOutputVFile fileAAB1 =
- (InputOutputVFile) dirA.getInputVFile(new VPath("dirAA/dirAAB/fileAAB1", '/'));
+ InputOutputVFile fileAAB1 = dirA.getInputVFile(new VPath("dirAA/dirAAB/fileAAB1", '/'));
fileAAB1.delete();
try {
ioVFS.getRootInputVDir().getInputVFile(new VPath("dirA/dirAA/dirAAB/fileAAB1", '/'));
@@ -575,7 +618,7 @@ public class VFSTest {
InputOutputVDir dirBB =
ioVFS.getRootInputOutputVDir().getInputVDir(new VPath("dirB/dirBB", '/'));
{
- InputOutputVFile fileBB1 = (InputOutputVFile) dirBB.getInputVFile(new VPath("fileBB1", '/'));
+ InputOutputVFile fileBB1 = dirBB.getInputVFile(new VPath("fileBB1", '/'));
fileBB1.delete();
try {
ioVFS.getRootInputVDir().getInputVFile(new VPath("dirB/dirBB/fileBB1", '/'));