summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Lamarche <benoitlamarche@google.com>2015-05-27 15:56:45 +0200
committerBenoit Lamarche <benoitlamarche@google.com>2015-05-29 11:56:53 +0200
commit074951b98dc7203f62ae76e894a19af38ed65725 (patch)
treed34171bbd9487743026ce24d562f73a9f31abd3e
parentc359103bc956a61f1e87081994617b62a78f1dc8 (diff)
downloadtoolchain_jack-074951b98dc7203f62ae76e894a19af38ed65725.zip
toolchain_jack-074951b98dc7203f62ae76e894a19af38ed65725.tar.gz
toolchain_jack-074951b98dc7203f62ae76e894a19af38ed65725.tar.bz2
Adapt ClasspathTests to use InputJackLibrary
(cherry picked from commit 860b271f80ccbd6d283fe671444a9c89c0ff892d) Change-Id: Icdbad809fdfdfdacaa5c63c9b7812846fd7390c7
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java10
-rw-r--r--jack-tests/tests/com/android/jack/classpath/ClasspathTests.java11
2 files changed, 17 insertions, 4 deletions
diff --git a/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java b/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
index 655e8fa..934bca3 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
@@ -20,6 +20,8 @@ import com.google.common.base.Splitter;
import com.android.jack.Sourcelist;
+import com.android.jack.library.InputJackLibrary;
+import com.android.jack.library.InputJackLibraryCodec;
import com.android.jack.test.TestConfigurationException;
import com.android.jack.test.TestsProperties;
import com.android.jack.test.runner.RuntimeRunner;
@@ -28,6 +30,7 @@ import com.android.jack.test.runner.RuntimeRunnerFactory;
import com.android.jack.test.util.ExecFileException;
import com.android.jack.test.util.ExecuteFile;
import com.android.jack.util.NamingTools;
+import com.android.sched.util.codec.CodecContext;
import com.android.sched.util.file.Files;
import com.android.sched.util.stream.ByteStreamSucker;
@@ -640,4 +643,11 @@ public abstract class AbstractTestTools {
}
}
}
+
+ /**
+ * The returned {@link InputJackLibrary} must be closed.
+ */
+ public static InputJackLibrary getInputJackLibraryFromDir(@Nonnull File dir) {
+ return new InputJackLibraryCodec().parseString(new CodecContext(), dir.getPath());
+ }
}
diff --git a/jack-tests/tests/com/android/jack/classpath/ClasspathTests.java b/jack-tests/tests/com/android/jack/classpath/ClasspathTests.java
index 16e9340..e570611 100644
--- a/jack-tests/tests/com/android/jack/classpath/ClasspathTests.java
+++ b/jack-tests/tests/com/android/jack/classpath/ClasspathTests.java
@@ -19,6 +19,7 @@ package com.android.jack.classpath;
import com.android.jack.Jack;
import com.android.jack.JackAbortException;
import com.android.jack.library.FileType;
+import com.android.jack.library.InputJackLibrary;
import com.android.jack.library.LibraryReadingException;
import com.android.jack.test.category.KnownBugs;
import com.android.jack.test.toolchain.AbstractTestTools;
@@ -27,6 +28,7 @@ import com.android.jack.test.toolchain.JackApiToolchainBase;
import com.android.jack.test.toolchain.JackBasedToolchain;
import com.android.jack.test.toolchain.JillBasedToolchain;
import com.android.jack.test.toolchain.LegacyJillToolchain;
+import com.android.sched.vfs.VPath;
import junit.framework.Assert;
@@ -126,10 +128,11 @@ public class ClasspathTests {
{
// delete unused inner in classpath and check we can still compile with it
- boolean deleted = new File(libOut, FileType.JAYCE.getPrefix()
- + "/com/android/jack/classpath/test003/lib/HasInnersClasses$InnerToDelete"
- + toolchain.getLibraryElementsExtension()).delete();
- Assert.assertTrue(deleted);
+ InputJackLibrary lib = AbstractTestTools.getInputJackLibraryFromDir(libOut);
+ lib.getFile(FileType.JAYCE,
+ new VPath("com/android/jack/classpath/test003/lib/HasInnersClasses$InnerToDelete", '/'))
+ .delete();
+ lib.close();
toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class, excludeList);
File testOut = AbstractTestTools.createTempDir();
File testSrc = new File(testDir, "jack");