diff options
author | Benoit Lamarche <benoitlamarche@google.com> | 2015-06-04 11:39:58 +0200 |
---|---|---|
committer | Benoit Lamarche <benoitlamarche@google.com> | 2015-06-17 18:02:43 +0200 |
commit | 325b47a0195f7ee1a711f87bee42c8293523f558 (patch) | |
tree | 0d104b8fb15f34c10b50b8883ea3c5701bccace7 /jack-tests/tests | |
parent | 397c97b3fd080ea3db25851e7de1c07bc3f9cba1 (diff) | |
download | toolchain_jack-325b47a0195f7ee1a711f87bee42c8293523f558.zip toolchain_jack-325b47a0195f7ee1a711f87bee42c8293523f558.tar.gz toolchain_jack-325b47a0195f7ee1a711f87bee42c8293523f558.tar.bz2 |
Adapt FileAccessErrorTest to support CaseInsensitiveFS
This is a bit hackish since it uses the Location, but I guess that
for a test it'll do.
Bug: 21486756
(cherry picked from commit 64e246e3b74e6989a4f930192cc7ed81fd2ed667)
Change-Id: Ie301194abc50fcc1db9801e93736579c8d03667c
Diffstat (limited to 'jack-tests/tests')
-rw-r--r-- | jack-tests/tests/com/android/jack/error/FileAccessErrorTest.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/jack-tests/tests/com/android/jack/error/FileAccessErrorTest.java b/jack-tests/tests/com/android/jack/error/FileAccessErrorTest.java index 8cb6472..5ee022a 100644 --- a/jack-tests/tests/com/android/jack/error/FileAccessErrorTest.java +++ b/jack-tests/tests/com/android/jack/error/FileAccessErrorTest.java @@ -20,6 +20,8 @@ import com.android.jack.JackAbortException; import com.android.jack.JackUserException; import com.android.jack.Main; import com.android.jack.backend.jayce.JayceFileImporter; +import com.android.jack.library.FileType; +import com.android.jack.library.InputJackLibrary; import com.android.jack.library.LibraryIOException; import com.android.jack.library.LibraryReadingException; import com.android.jack.test.category.KnownBugs; @@ -30,16 +32,18 @@ import com.android.sched.util.codec.ListParsingException; import com.android.sched.util.codec.ParsingException; import com.android.sched.util.config.PropertyIdException; import com.android.sched.util.file.WrongPermissionException; +import com.android.sched.util.location.FileLocation; +import com.android.sched.vfs.InputVFile; import junit.framework.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import java.io.ByteArrayOutputStream; import java.io.File; +import java.util.Iterator; /** * JUnit test checking Jack behavior on file access error. @@ -168,7 +172,6 @@ public class FileAccessErrorTest { * Checks that compilation fails correctly when jack file is not readable. */ @Test - @Ignore public void testFileAccessError004() throws Exception { ErrorTestHelper te = new ErrorTestHelper(); @@ -190,10 +193,15 @@ public class FileAccessErrorTest { jackApiToolchain = AbstractTestTools.getCandidateToolchain(JackApiToolchainBase.class); ByteArrayOutputStream errOut = new ByteArrayOutputStream(); + InputJackLibrary jackLib = null; try { - for (File jackFile : AbstractTestTools.getFiles(te.getJackFolder(), JayceFileImporter.JAYCE_FILE_EXTENSION)) { - if (!jackFile.setReadable(false)) { - Assert.fail("Fails to change file permissions of " + jackFile.getAbsolutePath()); + jackLib = AbstractTestTools.getInputJackLibrary(te.getJackFolder()); + Iterator<InputVFile> jackFileIter = jackLib.iterator(FileType.JAYCE); + while (jackFileIter.hasNext()) { + InputVFile vFile = jackFileIter.next(); + File file = new File(((FileLocation) vFile.getLocation()).getPath()); + if (!file.setReadable(false)) { + Assert.fail("Fails to change file permissions of " + file.getAbsolutePath()); } } @@ -206,6 +214,9 @@ public class FileAccessErrorTest { Assert.assertTrue(e.getCause() instanceof LibraryReadingException); Assert.assertTrue(e.getCause().getCause() instanceof LibraryIOException); } finally { + if (jackLib != null) { + jackLib.close(); + } String errOutput = errOut.toString(); Assert.assertTrue(errOutput.contains( "Error during the library reading phase: I/O error when accessing ")); // user reporting |