summaryrefslogtreecommitdiffstats
path: root/jill/tests
diff options
context:
space:
mode:
authorYohann Roussel <yroussel@google.com>2014-02-06 15:24:30 +0100
committerYohann Roussel <yroussel@google.com>2014-02-06 18:32:39 +0100
commite991948d20515a04e46524dbe1bf17222e872889 (patch)
tree63c7abc9002ff6054700beff5680d206701244b7 /jill/tests
parent1b0adcc591ba181dce100b0ca70d5a63eae43807 (diff)
downloadtoolchain_jill-e991948d20515a04e46524dbe1bf17222e872889.zip
toolchain_jill-e991948d20515a04e46524dbe1bf17222e872889.tar.gz
toolchain_jill-e991948d20515a04e46524dbe1bf17222e872889.tar.bz2
Jack initial import.
Change-Id: I8d1fc53d705d25429514842aac2368d9b87c8c6f
Diffstat (limited to 'jill/tests')
-rw-r--r--jill/tests/com/android/jill/Core.java53
-rw-r--r--jill/tests/com/android/jill/TestTools.java47
2 files changed, 100 insertions, 0 deletions
diff --git a/jill/tests/com/android/jill/Core.java b/jill/tests/com/android/jill/Core.java
new file mode 100644
index 0000000..8abf1c3
--- /dev/null
+++ b/jill/tests/com/android/jill/Core.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jill;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.File;
+
+
+public class Core {
+
+ @BeforeClass
+ public static void setUpClass() {
+ Main.class.getClassLoader().setDefaultAssertionStatus(true);
+ }
+
+ @Test
+ public void coreToJayceFromJar() throws Exception {
+ Options options = new Options();
+ options.setBinaryFile(new File(TestTools.getAndroidTop()
+ + "/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar"));
+ options.setVerbose(true);
+ options.container = ContainerType.DIR;
+ options.outputDirOrZip = TestTools.createTempDir("core_", "_dir");
+ new Jill(options, "0.1").process(options.getBinaryFile());
+ }
+
+ @Test
+ public void coreToJayceFromFolder() throws Exception {
+ Options options = new Options();
+ options.setBinaryFile(new File(TestTools.getAndroidTop()
+ + "/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes/"));
+ options.setVerbose(true);
+ options.container = ContainerType.DIR;
+ options.outputDirOrZip = TestTools.createTempDir("core_", "_dir");
+ new Jill(options, "0.1").process(options.getBinaryFile());
+ }
+}
diff --git a/jill/tests/com/android/jill/TestTools.java b/jill/tests/com/android/jill/TestTools.java
new file mode 100644
index 0000000..815679b
--- /dev/null
+++ b/jill/tests/com/android/jill/TestTools.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jill;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.annotation.Nonnull;
+
+public class TestTools {
+
+ @Nonnull
+ public static String getAndroidTop() {
+ String androidTop = System.getenv("ANDROID_BUILD_TOP");
+ if (androidTop == null) {
+ throw new AssertionError("Failed to locate environment variable ANDROID_BUILD_TOP.");
+ }
+ return androidTop;
+ }
+
+ @Nonnull
+ public static File createTempDir(@Nonnull String prefix, @Nonnull String suffix)
+ throws IOException {
+ File tmp = File.createTempFile(prefix, suffix);
+ if (!tmp.delete()) {
+ throw new IOException("Failed to delete file " + tmp.getAbsolutePath());
+ }
+ if (!tmp.mkdirs()) {
+ throw new IOException("Failed to create folder " + tmp.getAbsolutePath());
+ }
+ return tmp;
+ }
+}