Merge "Add debug output for flaky retrace test"
diff --git a/build.gradle b/build.gradle
index 00b8a46..c205b2d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -676,9 +676,6 @@
task testJar(type: ShadowJar, dependsOn: testClasses) {
baseName = "r8tests"
from sourceSets.test.output
- if (!project.hasProperty('exclude_deps')) {
- relocate('org.objectweb.asm', 'com.android.tools.r8.org.objectweb.asm')
- }
}
task testJarNoDeps(type: ShadowJar, dependsOn: testClasses) {
diff --git a/src/main/java/com/android/tools/r8/graph/JarCode.java b/src/main/java/com/android/tools/r8/graph/JarCode.java
index 36df23e..3ce1467 100644
--- a/src/main/java/com/android/tools/r8/graph/JarCode.java
+++ b/src/main/java/com/android/tools/r8/graph/JarCode.java
@@ -118,6 +118,10 @@
return true;
}
+ public boolean hasLocalVariableTable() {
+ return getNode().localVariables != null && !getNode().localVariables.isEmpty();
+ }
+
@Override
public IRCode buildIR(
DexEncodedMethod encodedMethod,
diff --git a/src/test/java/com/android/tools/r8/ExternalR8TestBuilder.java b/src/test/java/com/android/tools/r8/ExternalR8TestBuilder.java
index 5f9d569..9dfb30d 100644
--- a/src/test/java/com/android/tools/r8/ExternalR8TestBuilder.java
+++ b/src/test/java/com/android/tools/r8/ExternalR8TestBuilder.java
@@ -4,6 +4,7 @@
package com.android.tools.r8;
+import static com.android.tools.r8.ToolHelper.CLASSPATH_SEPARATOR;
import static com.android.tools.r8.ToolHelper.getJavaExecutable;
import static org.junit.Assert.assertEquals;
@@ -16,7 +17,6 @@
import com.android.tools.r8.utils.FileUtils;
import com.android.tools.r8.utils.InternalOptions;
import com.google.common.base.Charsets;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -78,7 +78,7 @@
String classPath =
addR8ExternalDeps
? r8jar.toAbsolutePath().toString()
- + File.pathSeparator
+ + CLASSPATH_SEPARATOR
+ ToolHelper.DEPS_NOT_RELOCATED
: r8jar.toAbsolutePath().toString();
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index 8fe189b..bab857c 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -97,7 +97,8 @@
public static final String SMALI_BUILD_DIR = TESTS_BUILD_DIR + "smali/";
public static final String LINE_SEPARATOR = StringUtils.LINE_SEPARATOR;
- public static final String PATH_SEPARATOR = File.pathSeparator;
+ public static final String CLASSPATH_SEPARATOR = File.pathSeparator;
+
public static final String DEFAULT_DEX_FILENAME = "classes.dex";
public static final String DEFAULT_PROGUARD_MAP_FILE = "proguard.map";
@@ -1086,7 +1087,8 @@
}
public static ProcessResult runJava(List<Path> classpath, String... args) throws IOException {
- String cp = classpath.stream().map(Path::toString).collect(Collectors.joining(PATH_SEPARATOR));
+ String cp =
+ classpath.stream().map(Path::toString).collect(Collectors.joining(CLASSPATH_SEPARATOR));
List<String> cmdline = new ArrayList<String>(Arrays.asList(getJavaExecutable(), "-cp", cp));
cmdline.addAll(Arrays.asList(args));
ProcessBuilder builder = new ProcessBuilder(cmdline);
@@ -1106,7 +1108,8 @@
public static ProcessResult runJavaNoVerify(
List<Path> classpath, String mainClass, List<String> args) throws IOException {
- String cp = classpath.stream().map(Path::toString).collect(Collectors.joining(PATH_SEPARATOR));
+ String cp =
+ classpath.stream().map(Path::toString).collect(Collectors.joining(CLASSPATH_SEPARATOR));
ArrayList<String> cmdline = Lists.newArrayList(
getJavaExecutable(), "-cp", cp, "-noverify", mainClass);
cmdline.addAll(args);
diff --git a/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java b/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java
index 97047e8..8af2f8e 100644
--- a/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/BasicTestDependenciesDesugaringTest.java
@@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.desugar;
+import static com.android.tools.r8.ToolHelper.CLASSPATH_SEPARATOR;
+
import com.android.tools.r8.D8Command;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.errors.CompilationError;
@@ -30,8 +32,6 @@
@RunWith(Parameterized.class)
public class BasicTestDependenciesDesugaringTest {
- private static final String CLASSPATH_SEPARATOR = File.pathSeparator;
-
private static final String[] allLibs;
static {
try {
diff --git a/src/test/java/com/android/tools/r8/utils/codeinspector/FoundMethodSubject.java b/src/test/java/com/android/tools/r8/utils/codeinspector/FoundMethodSubject.java
index d878a86..6c23162 100644
--- a/src/test/java/com/android/tools/r8/utils/codeinspector/FoundMethodSubject.java
+++ b/src/test/java/com/android/tools/r8/utils/codeinspector/FoundMethodSubject.java
@@ -202,8 +202,7 @@
return !code.asCfCode().getLocalVariables().isEmpty();
}
if (code.isJarCode()) {
- return code.asJarCode().getNode().localVariables != null
- && !code.asJarCode().getNode().localVariables.isEmpty();
+ return code.asJarCode().hasLocalVariableTable();
}
throw new Unreachable("Unexpected code type: " + code.getClass().getSimpleName());
}