From 32604d628fa8f4cfeb7822a5af5187397b4b8e86 Mon Sep 17 00:00:00 2001 From: Jean-Marie Henaff Date: Wed, 25 Feb 2015 13:57:22 +0100 Subject: Remove useless tests from Jill Those tests can now be passed with jack-tests framework and the appropriate configuration file. Change-Id: Ie7d0e06133fabb1cf4cc9c91d1d0fe34807fff40 --- build.xml | 88 +++++++++++++- jill/.classpath | 1 + jill/tests/com/android/jill/AllTests.java | 18 +-- jill/tests/com/android/jill/AnnotationTest.java | 45 ------- jill/tests/com/android/jill/Core.java | 12 +- .../android/jill/FibonacciThreeAddressTest.java | 45 ------- jill/tests/com/android/jill/FieldTest.java | 45 ------- jill/tests/com/android/jill/InnerTest.java | 45 ------- jill/tests/com/android/jill/JarjarTest.java | 45 ------- jill/tests/com/android/jill/JillTestTools.java | 131 --------------------- jill/tests/com/android/jill/NoClasspathTest.java | 42 ------- .../bouncycastle/BouncycastleCompilationTest.java | 46 -------- .../androidtree/core/CoreCompilationTest.java | 42 ------- .../frameworks/FrameworksBaseCompilationTest.java | 51 -------- .../services/ServicesCompilationTest.java | 55 --------- jill/tests/com/android/jill/shrob/ShrinkTest.java | 131 --------------------- .../com/android/jill/shrob/expected-042-001.txt | 11 -- .../com/android/jill/shrob/expected-042-002.txt | 11 -- .../com/android/jill/shrob/expected-042-003.txt | 11 -- 19 files changed, 94 insertions(+), 781 deletions(-) delete mode 100644 jill/tests/com/android/jill/AnnotationTest.java delete mode 100644 jill/tests/com/android/jill/FibonacciThreeAddressTest.java delete mode 100644 jill/tests/com/android/jill/FieldTest.java delete mode 100644 jill/tests/com/android/jill/InnerTest.java delete mode 100644 jill/tests/com/android/jill/JarjarTest.java delete mode 100644 jill/tests/com/android/jill/JillTestTools.java delete mode 100644 jill/tests/com/android/jill/NoClasspathTest.java delete mode 100644 jill/tests/com/android/jill/compile/androidtree/bouncycastle/BouncycastleCompilationTest.java delete mode 100644 jill/tests/com/android/jill/compile/androidtree/core/CoreCompilationTest.java delete mode 100644 jill/tests/com/android/jill/compile/androidtree/frameworks/FrameworksBaseCompilationTest.java delete mode 100644 jill/tests/com/android/jill/compile/androidtree/services/ServicesCompilationTest.java delete mode 100644 jill/tests/com/android/jill/shrob/ShrinkTest.java delete mode 100644 jill/tests/com/android/jill/shrob/expected-042-001.txt delete mode 100644 jill/tests/com/android/jill/shrob/expected-042-002.txt delete mode 100644 jill/tests/com/android/jill/shrob/expected-042-003.txt diff --git a/build.xml b/build.xml index 87483f1..ad7e2d3 100644 --- a/build.xml +++ b/build.xml @@ -126,6 +126,7 @@ + @@ -134,9 +135,9 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jill/.classpath b/jill/.classpath index 1d0fd46..c567998 100644 --- a/jill/.classpath +++ b/jill/.classpath @@ -12,5 +12,6 @@ + diff --git a/jill/tests/com/android/jill/AllTests.java b/jill/tests/com/android/jill/AllTests.java index 67e8a52..e3ead54 100644 --- a/jill/tests/com/android/jill/AllTests.java +++ b/jill/tests/com/android/jill/AllTests.java @@ -17,12 +17,6 @@ package com.android.jill; -import com.android.jill.compile.androidtree.bouncycastle.BouncycastleCompilationTest; -import com.android.jill.compile.androidtree.core.CoreCompilationTest; -import com.android.jill.compile.androidtree.frameworks.FrameworksBaseCompilationTest; -import com.android.jill.compile.androidtree.services.ServicesCompilationTest; -import com.android.jill.shrob.ShrinkTest; - import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @@ -32,16 +26,6 @@ import org.junit.runners.Suite.SuiteClasses; */ @RunWith(Suite.class) @SuiteClasses(value = { - AnnotationTest.class, - FibonacciThreeAddressTest.class, - FieldTest.class, - InnerTest.class, - JarjarTest.class, - NoClasspathTest.class, - BouncycastleCompilationTest.class, - CoreCompilationTest.class, - FrameworksBaseCompilationTest.class, - ServicesCompilationTest.class, - ShrinkTest.class}) + Core.class}) public class AllTests { } diff --git a/jill/tests/com/android/jill/AnnotationTest.java b/jill/tests/com/android/jill/AnnotationTest.java deleted file mode 100644 index 170f09b..0000000 --- a/jill/tests/com/android/jill/AnnotationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.jack.Main; - -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.File; - -/** - * JUnit test for compilation of annotation. - */ -public class AnnotationTest { - - private static final File ANNOTATION001_PATH = - JillTestTools.getJackTestsWithJackFolder("annotation/test001"); - - @BeforeClass - public static void setUpClass() { - Main.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - public void test001_3WithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, - new File(ANNOTATION001_PATH, "Annotation2.java"), false /*withDebugInfo*/); - } - -} diff --git a/jill/tests/com/android/jill/Core.java b/jill/tests/com/android/jill/Core.java index 5325f5e..af433ec 100644 --- a/jill/tests/com/android/jill/Core.java +++ b/jill/tests/com/android/jill/Core.java @@ -17,13 +17,15 @@ package com.android.jill; import com.android.jack.test.TestsProperties; +import com.android.jack.test.toolchain.AbstractTestTools; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import java.io.File; - +@Ignore("Tree") public class Core { @BeforeClass @@ -35,10 +37,10 @@ public class Core { public void coreToJayceFromJar() throws Exception { Options options = new Options(); options.setBinaryFile(new File(TestsProperties.getAndroidRootDir().getPath() - + "/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar")); + + "/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar")); options.setVerbose(true); options.container = ContainerType.DIR; - options.outputDirOrZip = JillTestTools.createTempDir("core_", "_dir"); + options.outputDirOrZip = AbstractTestTools.createTempDir(); new Jill(options, "0.1").process(options.getBinaryFile()); } @@ -46,10 +48,10 @@ public class Core { public void coreToJayceFromFolder() throws Exception { Options options = new Options(); options.setBinaryFile(new File(TestsProperties.getAndroidRootDir().getPath() - + "/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes/")); + + "/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes/")); options.setVerbose(true); options.container = ContainerType.DIR; - options.outputDirOrZip = JillTestTools.createTempDir("core_", "_dir"); + options.outputDirOrZip = AbstractTestTools.createTempDir(); new Jill(options, "0.1").process(options.getBinaryFile()); } } diff --git a/jill/tests/com/android/jill/FibonacciThreeAddressTest.java b/jill/tests/com/android/jill/FibonacciThreeAddressTest.java deleted file mode 100644 index 235a000..0000000 --- a/jill/tests/com/android/jill/FibonacciThreeAddressTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.jack.Main; - -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.File; - -/** - * JUnit test for compilation of Fibonacci (three-address style). - */ -public class FibonacciThreeAddressTest { - - private static final String CLASS_BINARY_NAME = "com/android/jack/fibonacci/jack/FibonacciThreeAddress"; - private static final File JAVA_FILEPATH = JillTestTools.getJackTestFromBinaryName(CLASS_BINARY_NAME); - - @BeforeClass - public static void setUpClass() { - // Enable assertions - Main.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - public void testCompareFiboDexFileWithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, JAVA_FILEPATH, false /*withDebugInfo*/); - } - -} diff --git a/jill/tests/com/android/jill/FieldTest.java b/jill/tests/com/android/jill/FieldTest.java deleted file mode 100644 index d353874..0000000 --- a/jill/tests/com/android/jill/FieldTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.jack.Main; - -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * JUnit test for compilation of fields. - */ -public class FieldTest { - - @BeforeClass - public static void setUpClass() { - Main.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - public void testStaticWithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, - JillTestTools.getJackTestsWithJackFolder("field/static003"), false /*withDebugInfo*/); - } - - @Test - public void testInstanceWithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, - JillTestTools.getJackTestsWithJackFolder("field/instance005"), false /*withDebugInfo*/); - } -} diff --git a/jill/tests/com/android/jill/InnerTest.java b/jill/tests/com/android/jill/InnerTest.java deleted file mode 100644 index 9118db6..0000000 --- a/jill/tests/com/android/jill/InnerTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.jack.Main; - -import org.junit.BeforeClass; -import org.junit.Test; - -public class InnerTest { - - - @BeforeClass - public static void setUpClass() { - Main.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - public void testCheckStructure20WithJill() throws Exception { - //TODO: find out why debug info check fails - JillTestTools.checkStructureWithJill(null, - JillTestTools.getJackTestsWithJackFolder("inner/test020"), false /*withDebugInfo*/); - } - - @Test - public void testCheckStructure21WithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, - JillTestTools.getJackTestsWithJackFolder("inner/test021"), false /*withDebugInfo*/); - } -} diff --git a/jill/tests/com/android/jill/JarjarTest.java b/jill/tests/com/android/jill/JarjarTest.java deleted file mode 100644 index 89e723a..0000000 --- a/jill/tests/com/android/jill/JarjarTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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 com.android.jack.JarJarRules; -import com.android.jack.Main; - -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * JUnit test for compilation of field access. - */ -public class JarjarTest { - - - @BeforeClass - public static void setUpClass() { - Main.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - public void testCheckStructure003() throws Exception { - JillTestTools.checkStructureWithJill( - null, - JillTestTools.getJackTestsWithJackFolder("jarjar/test003"), - false, - new JarJarRules(JillTestTools.getJackTestFolder("jarjar/test003"), "jarjar-rules.txt"), - null); - } -} diff --git a/jill/tests/com/android/jill/JillTestTools.java b/jill/tests/com/android/jill/JillTestTools.java deleted file mode 100644 index 5b366a3..0000000 --- a/jill/tests/com/android/jill/JillTestTools.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 com.android.jack.DexComparator; -import com.android.jack.JarJarRules; -import com.android.jack.ProguardFlags; -import com.android.jack.TestTools; -import com.android.jack.backend.dex.DexFileWriter; -import com.android.jack.test.TestsProperties; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - -public class JillTestTools extends TestTools { - - @Nonnull - private static final String JILL_UNIT_TESTS_PATH = "jill/tests/"; - - @Nonnull - private static final String JILL_PACKAGE = "com/android/jill/"; - - @Nonnull - private static final File JILL_DIR = new File(TestsProperties.getJackRootDir(), "../jill"); - - @Nonnull - private static final File JILL = new File(JILL_DIR, "dist/jill.jar"); - - @Nonnull - public static File getJillTestFolder(@Nonnull String testName) { - return new File(JILL_DIR, JILL_UNIT_TESTS_PATH + JILL_PACKAGE + testName); - } - - public static void runJill(@Nonnull File inputFile, @Nonnull File outputFile) throws Exception { - String[] args = new String[] { - "--output", - outputFile.getAbsolutePath(), - inputFile.getAbsolutePath()}; - - Options options = Main.getOptions(args); - new Jill(options, "").process(options.getBinaryFile()); - } - - public static void runJillToZip(@Nonnull File inputFile, @Nonnull File outputFile) throws Exception { - String[] args = new String[] {"--output", - outputFile.getAbsolutePath(), - inputFile.getAbsolutePath()}; - Options options = Main.getOptions(args); - new Jill(options, "").process(options.getBinaryFile()); - } - - public static void checkStructureWithJill( - @CheckForNull File[] refClasspath, - @Nonnull File fileOrSourceList, - boolean withDebugInfo) throws Exception { - checkStructureWithJill( - refClasspath, - fileOrSourceList, - withDebugInfo, - null, - null); - } - - public static void checkStructureWithJill( - @CheckForNull File[] classpath, - @Nonnull File fileOrSourceList, - boolean withDebugInfo, - @CheckForNull JarJarRules jarjarRules, - @CheckForNull ProguardFlags[] proguardFlags) throws Exception { - - com.android.jack.Options options = - buildCommandLineArgs(classpath, fileOrSourceList); - - boolean useEcjAsRefCompiler = withDebugInfo; - - // Prepare files and directories - File testDir = createTempDir("jillTest", null); - - if (withDebugInfo) { - List ecjArguments = new ArrayList(options.getEcjArguments()); - ecjArguments.add(0, "-g"); - options.setEcjArguments(ecjArguments); - } - - ReferenceCompilerFiles files = createReferenceCompilerFiles(testDir, - options, - proguardFlags, - null, - null, - withDebugInfo, - useEcjAsRefCompiler, - jarjarRules); - - File refJar = files.jarFile; - File refDex = files.dexFile; - - // Run Jill on generated class file - File jackFile = new File(testDir, "test.jayce"); - if (!jackFile.exists() && !jackFile.mkdirs()) { - throw new IOException("Could not create directory \"" + testDir.getName() + "\""); - } - runJill(refJar, jackFile); - - // Run Jack on .jack - File jackDexFolder = TestTools.createTempDir("jack", "dex"); - compileJackToDex(new com.android.jack.Options(), jackFile, jackDexFolder, false); - - // Compare Jack Dex file to reference - new DexComparator(withDebugInfo, /* strict */false, /* compareDebugInfoBinary */ false, - /* compareInstructionNumber */ false, 0f).compare(refDex, new File(jackDexFolder, DexFileWriter.DEX_FILENAME)); - } -} diff --git a/jill/tests/com/android/jill/NoClasspathTest.java b/jill/tests/com/android/jill/NoClasspathTest.java deleted file mode 100644 index ee34fce..0000000 --- a/jill/tests/com/android/jill/NoClasspathTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 com.android.jack.category.SlowTests; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; - -@Category(SlowTests.class) -public class NoClasspathTest { - - protected static final File FRAMEWORK_JAR = JillTestTools - .getFromAndroidTree("/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/" - + "classes.jar"); - - @Test - public void frameworkFromJill() throws Exception { - File frameworkJackZip = JillTestTools.createTempFile("framework", ".zip"); - JillTestTools.runJillToZip(FRAMEWORK_JAR, frameworkJackZip); - - File frameworkDex = JillTestTools.createTempDir("framework", "dex"); - JillTestTools.compileJackToDex(new com.android.jack.Options(), frameworkJackZip, frameworkDex, - false); - } -} diff --git a/jill/tests/com/android/jill/compile/androidtree/bouncycastle/BouncycastleCompilationTest.java b/jill/tests/com/android/jill/compile/androidtree/bouncycastle/BouncycastleCompilationTest.java deleted file mode 100644 index d26f042..0000000 --- a/jill/tests/com/android/jill/compile/androidtree/bouncycastle/BouncycastleCompilationTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2012 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.compile.androidtree.bouncycastle; - -import com.android.jack.JarJarRules; -import com.android.jack.ProguardFlags; -import com.android.jack.category.SlowTests; -import com.android.jill.JillTestTools; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; - -public class BouncycastleCompilationTest { - - private static final File SOURCELIST = JillTestTools.getTargetLibSourcelist("bouncycastle"); - - private static final JarJarRules JARJAR_RULES = new JarJarRules( - JillTestTools.getFromAndroidTree("external/bouncycastle/jarjar-rules.txt")); - - @Test - @Category(SlowTests.class) - public void compareBouncycastleStructureWithJill() throws Exception { - JillTestTools.checkStructureWithJill( - null, - SOURCELIST, - false /* compareDebugInfoBinary */, - JARJAR_RULES, - (ProguardFlags[]) null); - } -} diff --git a/jill/tests/com/android/jill/compile/androidtree/core/CoreCompilationTest.java b/jill/tests/com/android/jill/compile/androidtree/core/CoreCompilationTest.java deleted file mode 100644 index 10a5ca5..0000000 --- a/jill/tests/com/android/jill/compile/androidtree/core/CoreCompilationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2012 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.compile.androidtree.core; - -import com.android.jack.category.SlowTests; -import com.android.jill.JillTestTools; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; - -public class CoreCompilationTest { - - private static final File SOURCELIST = JillTestTools.getTargetLibSourcelist("core"); - - @BeforeClass - public static void setUpClass() { - CoreCompilationTest.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - @Category(SlowTests.class) - public void compareLibCoreStructureWithJill() throws Exception { - JillTestTools.checkStructureWithJill(null, SOURCELIST, false /*withDebugInfo*/); - } -} diff --git a/jill/tests/com/android/jill/compile/androidtree/frameworks/FrameworksBaseCompilationTest.java b/jill/tests/com/android/jill/compile/androidtree/frameworks/FrameworksBaseCompilationTest.java deleted file mode 100644 index 723b2e8..0000000 --- a/jill/tests/com/android/jill/compile/androidtree/frameworks/FrameworksBaseCompilationTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2012 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.compile.androidtree.frameworks; - -import com.android.jack.category.SlowTests; -import com.android.jill.JillTestTools; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; - -public class FrameworksBaseCompilationTest { - - private final static File[] CLASSPATH = new File[] { - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes.jar"), - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar"), - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar")}; - - private static final File SOURCELIST = JillTestTools.getTargetLibSourcelist("framework"); - - @BeforeClass - public static void setUpClass() { - FrameworksBaseCompilationTest.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - @Category(SlowTests.class) - public void compareFrameworksStructureWithJill() throws Exception { - JillTestTools.checkStructureWithJill(CLASSPATH, SOURCELIST, - false /*withDebugInfo*/); - } -} diff --git a/jill/tests/com/android/jill/compile/androidtree/services/ServicesCompilationTest.java b/jill/tests/com/android/jill/compile/androidtree/services/ServicesCompilationTest.java deleted file mode 100644 index dc9bf1b..0000000 --- a/jill/tests/com/android/jill/compile/androidtree/services/ServicesCompilationTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2012 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.compile.androidtree.services; - -import com.android.jack.category.SlowTests; -import com.android.jill.JillTestTools; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; - -public class ServicesCompilationTest { - - private static final File[] CLASSPATH = new File[] { - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/android.policy_intermediates/classes.jar"), - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar"), - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar"), - JillTestTools.getFromAndroidTree( - "out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar"), JillTestTools.getFromAndroidTree("out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar")}; - - private static final File SOURCELIST = JillTestTools.getTargetLibSourcelist("services"); - - @BeforeClass - public static void setUpClass() { - ServicesCompilationTest.class.getClassLoader().setDefaultAssertionStatus(true); - } - - @Test - @Category(SlowTests.class) - public void compareServicesStructureWithJill() throws Exception { - JillTestTools.checkStructureWithJill( - CLASSPATH, - SOURCELIST, - false /* withDebugInfo */); - } -} diff --git a/jill/tests/com/android/jill/shrob/ShrinkTest.java b/jill/tests/com/android/jill/shrob/ShrinkTest.java deleted file mode 100644 index d166902..0000000 --- a/jill/tests/com/android/jill/shrob/ShrinkTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2012 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.shrob; - -import com.android.jack.Options; -import com.android.jack.ProguardFlags; -import com.android.jack.shrob.ListingComparator; -import com.android.jack.shrob.shrink.ShrinkStructurePrinter; -import com.android.jill.JillTestTools; - -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Arrays; - -import javax.annotation.Nonnull; - -public class ShrinkTest { - - @Nonnull - private static final File[] defaultBootclasspath = JillTestTools.getDefaultClasspath(); - - private static ProguardFlags dontObfuscateFlagFile = - new ProguardFlags(JillTestTools.getJackTestFolder("shrob"), "dontobfuscate.flags"); - - @BeforeClass - public static void setUpClass() { - ShrinkTest.class.getClassLoader().setDefaultAssertionStatus(true); - } - - protected ProguardFlags generateInjars(@Nonnull File injar) throws IOException { - File injarFlags = JillTestTools.createTempFile("injars", ".flags"); - BufferedWriter writer = new BufferedWriter(new FileWriter(injarFlags)); - writer.append("-injars "); - writer.append(injar.getAbsolutePath()); - writer.close(); - return new ProguardFlags(injarFlags); - } - - @Test - public void test3_001() throws Exception { - File libzip = JillTestTools.createTempFile("lib", ".zip"); - String testName = "shrob/test003"; - File testFolder = JillTestTools.getJackTestFolder(testName); - JillTestTools.runJillToZip(JillTestTools.getJackTestLibFolder(testName), libzip); - File refFolder = new File(testFolder, "refsShrinking"); - ProguardFlags[] proguardflagsFiles = new ProguardFlags[] { - dontObfuscateFlagFile, - new ProguardFlags(testFolder, "proguard.flags001")}; - JillTestTools.checkListing(defaultBootclasspath, new File[] {libzip}, - JillTestTools.getJackTestsWithJackFolder(testName), proguardflagsFiles, - new File(refFolder, "expected-001.txt")); - } - - @Test - public void test3_002() throws Exception { - File libzip = JillTestTools.createTempFile("lib", ".zip"); - String testName = "shrob/test003"; - File testFolder = JillTestTools.getJackTestFolder(testName); - JillTestTools.runJillToZip(JillTestTools.getJackTestLibFolder(testName), libzip); - File refFolder = new File(testFolder, "refsShrinking"); - ProguardFlags[] proguardflagsFiles = new ProguardFlags[] { - dontObfuscateFlagFile, - new ProguardFlags(testFolder, "proguard.flags002"), - generateInjars(libzip)}; - JillTestTools.checkListing(defaultBootclasspath, null, - JillTestTools.getJackTestsWithJackFolder(testName), proguardflagsFiles, - new File(refFolder, "expected-002.txt")); - } - - @Test - public void test42_001() throws Exception { - runTest("042", "001"); - } - - @Test - public void test42_002() throws Exception { - runTest("042", "002"); - } - - @Test - public void test42_003() throws Exception { - runTest("042", "003"); - } - - private void runTest(@Nonnull String testNumber, @Nonnull String flagNumber) throws Exception { - String testName = "shrob/test" + testNumber; - File libzip = JillTestTools.createTempFile("lib", ".zip"); - File testFolder = JillTestTools.getJackTestFolder(testName); - JillTestTools.runJillToZip(JillTestTools.getJackTestsWithJackFolder(testName), libzip); - ProguardFlags[] proguardflagsFiles = new ProguardFlags[] { - dontObfuscateFlagFile, - new ProguardFlags(testFolder, "proguard.flags" + flagNumber)}; - Options options = new Options(); - File candidateNodeListing = JillTestTools.createTempFile("nodeListing", ".txt"); - options.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING.getName(), "true"); - options.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING_FILE.getName(), - candidateNodeListing.getPath()); - options.addProperty(Options.METHOD_FILTER.getName(), "supported-methods"); - options.disableDxOptimizations(); - options.setProguardFlagsFile(Arrays.asList(proguardflagsFiles)); - - File outFolder = JillTestTools.createTempDir("checklisting", "dex"); - JillTestTools.compileJackToDex(options, - libzip, - outFolder, - /* zip = */ false ); - - ListingComparator.compare(new File(JillTestTools.getJillTestFolder("shrob"), - "expected-" +testNumber + "-" + flagNumber + ".txt"), - candidateNodeListing); - } -} diff --git a/jill/tests/com/android/jill/shrob/expected-042-001.txt b/jill/tests/com/android/jill/shrob/expected-042-001.txt deleted file mode 100644 index 73c763a..0000000 --- a/jill/tests/com/android/jill/shrob/expected-042-001.txt +++ /dev/null @@ -1,11 +0,0 @@ -Lcom/android/jack/shrob/test042/jack/EnumToKeep;: -Lcom/android/jack/shrob/test042/jack/EnumToKeep; A -Lcom/android/jack/shrob/test042/jack/EnumToKeep; B -Lcom/android/jack/shrob/test042/jack/EnumToKeep; C -[Lcom/android/jack/shrob/test042/jack/EnumToKeep; $VALUES -(Ljava/lang/String;I)V -values()[Lcom/android/jack/shrob/test042/jack/EnumToKeep; -()V -(Ljava/lang/String;ILcom/android/jack/shrob/test042/jack/EnumToKeep$1;)V -Lcom/android/jack/shrob/test042/jack/EnumToKeep$1;: -(Ljava/lang/String;I)V diff --git a/jill/tests/com/android/jill/shrob/expected-042-002.txt b/jill/tests/com/android/jill/shrob/expected-042-002.txt deleted file mode 100644 index 73c763a..0000000 --- a/jill/tests/com/android/jill/shrob/expected-042-002.txt +++ /dev/null @@ -1,11 +0,0 @@ -Lcom/android/jack/shrob/test042/jack/EnumToKeep;: -Lcom/android/jack/shrob/test042/jack/EnumToKeep; A -Lcom/android/jack/shrob/test042/jack/EnumToKeep; B -Lcom/android/jack/shrob/test042/jack/EnumToKeep; C -[Lcom/android/jack/shrob/test042/jack/EnumToKeep; $VALUES -(Ljava/lang/String;I)V -values()[Lcom/android/jack/shrob/test042/jack/EnumToKeep; -()V -(Ljava/lang/String;ILcom/android/jack/shrob/test042/jack/EnumToKeep$1;)V -Lcom/android/jack/shrob/test042/jack/EnumToKeep$1;: -(Ljava/lang/String;I)V diff --git a/jill/tests/com/android/jill/shrob/expected-042-003.txt b/jill/tests/com/android/jill/shrob/expected-042-003.txt deleted file mode 100644 index 7f584a5..0000000 --- a/jill/tests/com/android/jill/shrob/expected-042-003.txt +++ /dev/null @@ -1,11 +0,0 @@ -Lcom/android/jack/shrob/test042/jack/EnumToKeep$1;: -(Ljava/lang/String;I)V -Lcom/android/jack/shrob/test042/jack/EnumToKeep;: -Lcom/android/jack/shrob/test042/jack/EnumToKeep; A -Lcom/android/jack/shrob/test042/jack/EnumToKeep; B -Lcom/android/jack/shrob/test042/jack/EnumToKeep; C -[Lcom/android/jack/shrob/test042/jack/EnumToKeep; $VALUES -(Ljava/lang/String;I)V -values()[Lcom/android/jack/shrob/test042/jack/EnumToKeep; -()V -(Ljava/lang/String;ILcom/android/jack/shrob/test042/jack/EnumToKeep$1;)V -- cgit v1.1