Split applymapping tests into source and shrunken library

This CL prepares tests for a fix to using applymapping with a proguard
mapping file for naming output where the library is either provided as
program source or library, but unobfuscated. Almost all tests are
relevant for the use case where the library is obfuscated, thus we
duplicate tests.

The logic has changed in the following tests:

InnerEnumValuesTest
-------------------
This test assumed that when renaming enum-values
that the backing string would also be renamed. Thus, if we have:

enum {
  STATE_X,
  STATE_Y
}

and map:

STATE_X -> a
STATE_Y -> y

the test would assert that:

system.out.print(STATE_X).equals("a")

We should generally not change the backing name in strings of enum
values.

MemberResolutionAsmTest
-----------------------
This tests that:

public class A {
  public void foo() { ... }
}

public class B extends A {
  private void foo() { ... }
}

and a mapping file:

A.foo -> a;

what should happen to B.foo.

Notice that this code does not compile and only happens if one links
against libraries where methods has been made private or if the code
is manually written or created with separate compilation.

In this case, one probably named foo to give it exactly the same name
as the base method. The test is changed to then expect B.foo to be
renamed to a.

WhenToApplyTest
---------------
This test tested what would happen if a mapping file was given with
applymapping and we have minification enabled. Given a mapping file
means that one gives an explicit map for how all types should be
named, so this test no longer applies. Nothing in this test was not
tested elsewhere so it has been removed.

Bug: 126503704
Bug: 123092153
Bug: 121305642
Change-Id: Ida14467eabc0f35a8b50cbe3938bccbe3be93cf9
diff --git a/src/test/examples/naming001/keep-rules-105.txt b/src/test/examples/naming001/keep-rules-105.txt
index f3bf7f6..634edb6 100644
--- a/src/test/examples/naming001/keep-rules-105.txt
+++ b/src/test/examples/naming001/keep-rules-105.txt
@@ -6,6 +6,7 @@
 
 -keep class naming001.D {
   public static void main(...);
+  public void keep();
 }
 
 -applymapping mapping-105.txt
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/NoMappingDump.java b/src/test/java/com/android/tools/r8/naming/applymapping/NoMappingDump.java
deleted file mode 100644
index ae46c2a..0000000
--- a/src/test/java/com/android/tools/r8/naming/applymapping/NoMappingDump.java
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
-
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  class HasMapping {
-//    HasMapping() {
-//      foo();
-//    }
-//
-//    void foo() {
-//      System.out.println("HasMapping#foo");
-//    }
-//  }
-class HasMappingDump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(V1_8, ACC_SUPER, "HasMapping", null, "java/lang/Object", null);
-
-    classWriter.visitSource("HasMapping.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(2, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(3, label1);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "HasMapping", "foo", "()V", false);
-      Label label2 = new Label();
-      methodVisitor.visitLabel(label2);
-      methodVisitor.visitLineNumber(4, label2);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(0, "foo", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(3, label0);
-      methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-      methodVisitor.visitLdcInsn("HasMapping#foo");
-      methodVisitor.visitMethodInsn(
-          INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(4, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  class NoMapping extends HasMapping {
-//    NoMapping() {
-//      super();
-//      bar();
-//    }
-//
-//    private void bar() {
-//      System.out.println("NoMapping#foo");
-//    }
-//  }
-//
-// then renamed bar() to foo() to introduce name clash.
-class NoMappingDump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(V1_8, ACC_SUPER, "NoMapping", null, "HasMapping", null);
-
-    classWriter.visitSource("NoMapping.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(12, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "HasMapping", "<init>", "()V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(13, label1);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "NoMapping", "foo", "()V", false);
-      Label label2 = new Label();
-      methodVisitor.visitLabel(label2);
-      methodVisitor.visitLineNumber(14, label2);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(ACC_PRIVATE, "foo", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(9, label0);
-      methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-      methodVisitor.visitLdcInsn("NoMapping#foo");
-      methodVisitor.visitMethodInsn(
-          INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(10, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  public class NoMappingMain {
-//    public static void main(String[] args) {
-//      new NoMapping();
-//    }
-//  }
-class NoMappingMainDump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(
-        V1_8, ACC_PUBLIC | ACC_SUPER, "NoMappingMain", null, "java/lang/Object", null);
-
-    classWriter.visitSource("NoMappingMain.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(19, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(
-          ACC_PUBLIC | ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(22, label0);
-      methodVisitor.visitTypeInsn(NEW, "NoMapping");
-      methodVisitor.visitInsn(DUP);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "NoMapping", "<init>", "()V", false);
-      methodVisitor.visitInsn(POP);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(23, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/SwappingDump.java b/src/test/java/com/android/tools/r8/naming/applymapping/SwappingDump.java
deleted file mode 100644
index 0dea699..0000000
--- a/src/test/java/com/android/tools/r8/naming/applymapping/SwappingDump.java
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
-
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  class A {
-//    A() {
-//      x();
-//      y();
-//    }
-//
-//    private void x() {
-//      System.out.println("A#x");
-//    }
-//
-//    public void y() {
-//      System.out.println("A#y");
-//    }
-//  }
-class ADump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(V1_8, ACC_SUPER, "A", null, "java/lang/Object", null);
-
-    classWriter.visitSource("Test.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(2, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(3, label1);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "A", "x", "()V", false);
-      Label label2 = new Label();
-      methodVisitor.visitLabel(label2);
-      methodVisitor.visitLineNumber(4, label2);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "A", "y", "()V", false);
-      Label label3 = new Label();
-      methodVisitor.visitLabel(label3);
-      methodVisitor.visitLineNumber(5, label3);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(ACC_PRIVATE, "x", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(7, label0);
-      methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-      methodVisitor.visitLdcInsn("A#x");
-      methodVisitor.visitMethodInsn(
-          INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(8, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(ACC_PUBLIC, "y", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(11, label0);
-      methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-      methodVisitor.visitLdcInsn("A#y");
-      methodVisitor.visitMethodInsn(
-          INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(12, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  class B extends A {
-//  }
-class BDump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(V1_8, ACC_SUPER, "B", null, "A", null);
-
-    classWriter.visitSource("Test.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(15, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "A", "<init>", "()V", false);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
-
-// Generated by running tools/asmifier.py on the following code snippet:
-//
-//  public class Main {
-//    public static void main(String[] args) {
-//      new B().y();
-//    }
-//  }
-//
-// then replaced use of y() with x() to introduce IllegalAccessError.
-class MainDump implements Opcodes {
-
-  public static byte[] dump () throws Exception {
-
-    ClassWriter classWriter = new ClassWriter(0);
-    MethodVisitor methodVisitor;
-
-    classWriter.visit(V1_8, ACC_PUBLIC | ACC_SUPER, "Main", null, "java/lang/Object", null);
-
-    classWriter.visitSource("Test.java", null);
-
-    {
-      methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(18, label0);
-      methodVisitor.visitVarInsn(ALOAD, 0);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(1, 1);
-      methodVisitor.visitEnd();
-    }
-    {
-      methodVisitor = classWriter.visitMethod(
-          ACC_PUBLIC | ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
-      methodVisitor.visitCode();
-      Label label0 = new Label();
-      methodVisitor.visitLabel(label0);
-      methodVisitor.visitLineNumber(20, label0);
-      methodVisitor.visitTypeInsn(NEW, "B");
-      methodVisitor.visitInsn(DUP);
-      methodVisitor.visitMethodInsn(INVOKESPECIAL, "B", "<init>", "()V", false);
-      methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "B", "x", "()V", false);
-      Label label1 = new Label();
-      methodVisitor.visitLabel(label1);
-      methodVisitor.visitLineNumber(21, label1);
-      methodVisitor.visitInsn(RETURN);
-      methodVisitor.visitMaxs(2, 1);
-      methodVisitor.visitEnd();
-    }
-    classWriter.visitEnd();
-
-    return classWriter.toByteArray();
-  }
-}
-
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/WhenToApplyTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/WhenToApplyTest.java
deleted file mode 100644
index 25497e3..0000000
--- a/src/test/java/com/android/tools/r8/naming/applymapping/WhenToApplyTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
-
-import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import com.android.tools.r8.ProguardTestRunResult;
-import com.android.tools.r8.R8TestRunResult;
-import com.android.tools.r8.TestBase;
-import com.android.tools.r8.ToolHelper;
-import com.android.tools.r8.utils.BooleanUtils;
-import com.android.tools.r8.utils.FileUtils;
-import com.android.tools.r8.utils.StringUtils;
-import com.android.tools.r8.utils.codeinspector.ClassSubject;
-import com.android.tools.r8.utils.codeinspector.MethodSubject;
-import java.nio.file.Path;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-class ToBeRenamedClass {
-  void toBeRenamedMethod() {
-    System.out.println("foo");
-  }
-}
-
-class WhenToApplyTestRunner {
-  public static void main(String[] args) {
-    ToBeRenamedClass instance = new ToBeRenamedClass();
-    instance.toBeRenamedMethod();
-    System.out.println(instance.getClass().getSimpleName());
-  }
-}
-
-@RunWith(Parameterized.class)
-public class WhenToApplyTest extends TestBase {
-
-  @ClassRule
-  public static TemporaryFolder temporaryFolder = ToolHelper.getTemporaryFolderForTest();
-
-  private static Class<?> MAIN = WhenToApplyTestRunner.class;
-  private static String RENAMED_CLASS_NAME =
-      ToBeRenamedClass.class.getPackage().getName() + ".ABC";
-  private static String NORMAL_OUTPUT = StringUtils.lines("foo", "ToBeRenamedClass");
-  private static String APPLIED_OUTPUT = StringUtils.lines("foo", "ABC");
-  private static String RENAMED_OUTPUT = StringUtils.lines("foo", "a");
-
-  private static Path mappingFile;
-  private static Path configuration;
-  private boolean minification;
-
-  @Parameterized.Parameters(name = "minification: {0}")
-  public static Boolean[] data() {
-    return BooleanUtils.values();
-  }
-
-  public WhenToApplyTest(boolean minification) {
-    this.minification = minification;
-  }
-
-  @BeforeClass
-  public static void setUpMappingFile() throws Exception {
-    mappingFile = temporaryFolder.newFile("mapping.txt").toPath().toAbsolutePath();
-    FileUtils.writeTextFile(mappingFile, StringUtils.lines(
-        ToBeRenamedClass.class.getTypeName() + " -> " + RENAMED_CLASS_NAME + ":",
-        "  void toBeRenamedMethod() -> abc"));
-    configuration = temporaryFolder.newFile("pg.conf").toPath().toAbsolutePath();
-    FileUtils.writeTextFile(configuration, StringUtils.lines(
-        "-dontoptimize",
-        "-applymapping " + mappingFile
-    ));
-  }
-
-  @Test
-  public void testProguard() throws Exception {
-    ProguardTestRunResult result = testForProguard()
-        .addProgramClasses(ToBeRenamedClass.class, MAIN)
-        .addKeepMainRule(MAIN)
-        .addKeepRuleFiles(configuration)
-        .minification(minification)
-        .compile().run(MAIN);
-    if (minification) {
-      result.assertSuccessWithOutput(APPLIED_OUTPUT);
-    } else {
-      result.assertSuccessWithOutput(NORMAL_OUTPUT);
-    }
-    result.inspect(inspector -> {
-      ClassSubject classSubject = inspector.clazz(ToBeRenamedClass.class);
-      assertThat(classSubject, isPresent());
-      // As renaming won't happen again, we can use the original name to search for the method.
-      MethodSubject methodSubject = classSubject.uniqueMethodWithName("toBeRenamedMethod");
-      assertThat(methodSubject, isPresent());
-      String methodName =
-          minification
-              ? "abc"                // mapped name with minification
-              : "toBeRenamedMethod"; // original name without minification
-      assertEquals(methodName, methodSubject.getFinalName());
-    });
-  }
-
-  @Test
-  public void testR8() throws Exception {
-    R8TestRunResult result = testForR8(Backend.DEX)
-        .addProgramClasses(ToBeRenamedClass.class, MAIN)
-        .addKeepMainRule(MAIN)
-        .addKeepRuleFiles(configuration)
-        .minification(minification)
-        .compile().run(MAIN);
-    if (minification) {
-      result.assertSuccessWithOutput(RENAMED_OUTPUT);
-    } else {
-      result.assertSuccessWithOutput(APPLIED_OUTPUT);
-    }
-    result.inspect(inspector -> {
-      ClassSubject classSubject = inspector.clazz(RENAMED_CLASS_NAME);
-      assertThat(classSubject, isPresent());
-      // Mapped name will be regarded as an original name if minification is disabled.
-      String methodName =
-          minification
-              ? "toBeRenamedMethod" // original name
-              : "abc";              // mapped name without minification
-      MethodSubject methodSubject = classSubject.uniqueMethodWithName(methodName);
-      assertThat(methodSubject, isPresent());
-      methodName =
-          minification
-              ? "a"    // minified name
-              : "abc"; // mapped name without minification
-      assertEquals(methodName, methodSubject.getFinalName());
-    });
-  }
-
-}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/NameClashTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shared/NameClashTest.java
similarity index 94%
rename from src/test/java/com/android/tools/r8/naming/applymapping/NameClashTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shared/NameClashTest.java
index 0da8519..048f281 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/NameClashTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shared/NameClashTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shared;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
@@ -10,6 +10,9 @@
 import com.android.tools.r8.CompilationFailedException;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.ToolHelper;
+import com.android.tools.r8.naming.applymapping.shared.ProgramWithLibraryClasses.AnotherLibraryClass;
+import com.android.tools.r8.naming.applymapping.shared.ProgramWithLibraryClasses.LibraryClass;
+import com.android.tools.r8.naming.applymapping.shared.ProgramWithLibraryClasses.ProgramClass;
 import com.android.tools.r8.utils.FileUtils;
 import com.android.tools.r8.utils.StringUtils;
 import com.google.common.collect.ImmutableList;
@@ -21,34 +24,6 @@
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
-class LibraryClass {
-  static String LIB_MSG = "LibraryClass::foo";
-  void foo() {
-    System.out.println(LIB_MSG);
-  }
-}
-
-class AnotherLibraryClass {
-  static String ANOTHERLIB_MSG = "AnotherLibraryClass::foo";
-  void foo() {
-    System.out.println(ANOTHERLIB_MSG);
-  }
-}
-
-class ProgramClass extends LibraryClass {
-  static String PRG_MSG = "ProgramClass::bar";
-  void bar() {
-    System.out.println(PRG_MSG);
-  }
-
-  public static void main(String[] args) {
-    new AnotherLibraryClass().foo();
-    ProgramClass instance = new ProgramClass();
-    instance.foo();
-    instance.bar();
-  }
-}
-
 public class NameClashTest extends TestBase {
 
   @ClassRule
@@ -73,9 +48,12 @@
         temporaryFolder.newFile("prgMinifiedLib.jar").toPath().toAbsolutePath();
     writeToJar(prgJarThatUsesMinifiedLib, ImmutableList.of(ProgramClassDump.dump()));
     libJar = temporaryFolder.newFile("lib.jar").toPath().toAbsolutePath();
-    writeToJar(libJar, ImmutableList.of(
-        ToolHelper.getClassAsBytes(LibraryClass.class),
-        ToolHelper.getClassAsBytes(AnotherLibraryClass.class)));
+    writeToJar(
+        libJar,
+        ImmutableList.of(
+            ToolHelper.getClassAsBytes(ProgramWithLibraryClasses.class),
+            ToolHelper.getClassAsBytes(LibraryClass.class),
+            ToolHelper.getClassAsBytes(AnotherLibraryClass.class)));
   }
 
   @Before
@@ -220,6 +198,7 @@
     }
   }
 
+  @Ignore("b/123092153")
   @Test
   public void testR8_prgClassRenamedToExistingPrgClass() throws Exception {
     FileUtils.writeTextFile(mappingFile, mappingToExistingClassName());
@@ -262,6 +241,7 @@
     }
   }
 
+  @Ignore("b/123092153")
   @Test
   public void testR8_prgClassesRenamedToSameName() throws Exception {
     FileUtils.writeTextFile(mappingFile, mappingToTheSameClassName());
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/shared/NoMappingDumps.java b/src/test/java/com/android/tools/r8/naming/applymapping/shared/NoMappingDumps.java
new file mode 100644
index 0000000..de0c25e
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shared/NoMappingDumps.java
@@ -0,0 +1,201 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.naming.applymapping.shared;
+
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+public class NoMappingDumps {
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  class HasMapping {
+  //    HasMapping() {
+  //      foo();
+  //    }
+  //
+  //    void foo() {
+  //      System.out.println("HasMapping#foo");
+  //    }
+  //  }
+  public static class HasMappingDump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(V1_8, ACC_SUPER, "HasMapping", null, "java/lang/Object", null);
+
+      classWriter.visitSource("HasMapping.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(2, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(3, label1);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "HasMapping", "foo", "()V", false);
+        Label label2 = new Label();
+        methodVisitor.visitLabel(label2);
+        methodVisitor.visitLineNumber(4, label2);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor = classWriter.visitMethod(0, "foo", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(3, label0);
+        methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+        methodVisitor.visitLdcInsn("HasMapping#foo");
+        methodVisitor.visitMethodInsn(
+            INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(4, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  class NoMapping extends HasMapping {
+  //    NoMapping() {
+  //      super();
+  //      bar();
+  //    }
+  //
+  //    private void bar() {
+  //      System.out.println("NoMapping#foo");
+  //    }
+  //  }
+  //
+  // then renamed bar() to foo() to introduce name clash.
+  public static class NoMappingDump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(V1_8, ACC_SUPER, "NoMapping", null, "HasMapping", null);
+
+      classWriter.visitSource("NoMapping.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(12, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "HasMapping", "<init>", "()V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(13, label1);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "NoMapping", "foo", "()V", false);
+        Label label2 = new Label();
+        methodVisitor.visitLabel(label2);
+        methodVisitor.visitLineNumber(14, label2);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor = classWriter.visitMethod(ACC_PRIVATE, "foo", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(9, label0);
+        methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+        methodVisitor.visitLdcInsn("NoMapping#foo");
+        methodVisitor.visitMethodInsn(
+            INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(10, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  public class NoMappingMain {
+  //    public static void main(String[] args) {
+  //      new NoMapping();
+  //    }
+  //  }
+  public static class NoMappingMainDump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(
+          V1_8, ACC_PUBLIC | ACC_SUPER, "NoMappingMain", null, "java/lang/Object", null);
+
+      classWriter.visitSource("NoMappingMain.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(19, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor =
+            classWriter.visitMethod(
+                ACC_PUBLIC | ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(22, label0);
+        methodVisitor.visitTypeInsn(NEW, "NoMapping");
+        methodVisitor.visitInsn(DUP);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "NoMapping", "<init>", "()V", false);
+        methodVisitor.visitInsn(POP);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(23, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/NameClashTestDump.java b/src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramClassDump.java
similarity index 95%
rename from src/test/java/com/android/tools/r8/naming/applymapping/NameClashTestDump.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramClassDump.java
index 7da3800..d5660cc 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/NameClashTestDump.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramClassDump.java
@@ -1,8 +1,9 @@
 // Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shared;
 
+import com.android.tools.r8.naming.applymapping.shared.ProgramWithLibraryClasses.LibraryClass;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.Label;
@@ -29,7 +30,7 @@
 //     void a() -> foo
 //   B -> AnotherLibraryClass:
 //     void a() -> foo
-class ProgramClassDump implements Opcodes {
+public class ProgramClassDump implements Opcodes {
 
   public static byte[] dump () throws Exception {
 
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramWithLibraryClasses.java b/src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramWithLibraryClasses.java
new file mode 100644
index 0000000..7b9766f
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shared/ProgramWithLibraryClasses.java
@@ -0,0 +1,42 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.naming.applymapping.shared;
+
+public class ProgramWithLibraryClasses {
+
+  public static class LibraryClass {
+
+    public static String LIB_MSG = "LibraryClass::foo";
+
+    void foo() {
+      System.out.println(LIB_MSG);
+    }
+  }
+
+  public static class AnotherLibraryClass {
+
+    public static String ANOTHERLIB_MSG = "AnotherLibraryClass::foo";
+
+    void foo() {
+      System.out.println(ANOTHERLIB_MSG);
+    }
+  }
+
+  public static class ProgramClass extends LibraryClass {
+
+    public static String PRG_MSG = "ProgramClass::bar";
+
+    void bar() {
+      System.out.println(PRG_MSG);
+    }
+
+    public static void main(String[] args) {
+      new AnotherLibraryClass().foo();
+      ProgramClass instance = new ProgramClass();
+      instance.foo();
+      instance.bar();
+    }
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/shared/SwappingDump.java b/src/test/java/com/android/tools/r8/naming/applymapping/shared/SwappingDump.java
new file mode 100644
index 0000000..b96c8ef
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shared/SwappingDump.java
@@ -0,0 +1,194 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.naming.applymapping.shared;
+
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+public class SwappingDump {
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  class A {
+  //    A() {
+  //      x();
+  //      y();
+  //    }
+  //
+  //    private void x() {
+  //      System.out.println("A#x");
+  //    }
+  //
+  //    public void y() {
+  //      System.out.println("A#y");
+  //    }
+  //  }
+  public static class ADump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(V1_8, ACC_SUPER, "A", null, "java/lang/Object", null);
+
+      classWriter.visitSource("Test.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(2, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(3, label1);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "A", "x", "()V", false);
+        Label label2 = new Label();
+        methodVisitor.visitLabel(label2);
+        methodVisitor.visitLineNumber(4, label2);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "A", "y", "()V", false);
+        Label label3 = new Label();
+        methodVisitor.visitLabel(label3);
+        methodVisitor.visitLineNumber(5, label3);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor = classWriter.visitMethod(ACC_PRIVATE, "x", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(7, label0);
+        methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+        methodVisitor.visitLdcInsn("A#x");
+        methodVisitor.visitMethodInsn(
+            INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(8, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor = classWriter.visitMethod(ACC_PUBLIC, "y", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(11, label0);
+        methodVisitor.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+        methodVisitor.visitLdcInsn("A#y");
+        methodVisitor.visitMethodInsn(
+            INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(12, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  class B extends A {
+  //  }
+  public static class BDump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(V1_8, ACC_SUPER, "B", null, "A", null);
+
+      classWriter.visitSource("Test.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(15, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "A", "<init>", "()V", false);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+
+  // Generated by running tools/asmifier.py on the following code snippet:
+  //
+  //  public class Main {
+  //    public static void main(String[] args) {
+  //      new B().y();
+  //    }
+  //  }
+  //
+  // then replaced use of y() with x() to introduce IllegalAccessError.
+  public static class MainDump implements Opcodes {
+
+    public static byte[] dump() throws Exception {
+
+      ClassWriter classWriter = new ClassWriter(0);
+      MethodVisitor methodVisitor;
+
+      classWriter.visit(V1_8, ACC_PUBLIC | ACC_SUPER, "Main", null, "java/lang/Object", null);
+
+      classWriter.visitSource("Test.java", null);
+
+      {
+        methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(18, label0);
+        methodVisitor.visitVarInsn(ALOAD, 0);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(1, 1);
+        methodVisitor.visitEnd();
+      }
+      {
+        methodVisitor =
+            classWriter.visitMethod(
+                ACC_PUBLIC | ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
+        methodVisitor.visitCode();
+        Label label0 = new Label();
+        methodVisitor.visitLabel(label0);
+        methodVisitor.visitLineNumber(20, label0);
+        methodVisitor.visitTypeInsn(NEW, "B");
+        methodVisitor.visitInsn(DUP);
+        methodVisitor.visitMethodInsn(INVOKESPECIAL, "B", "<init>", "()V", false);
+        methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "B", "x", "()V", false);
+        Label label1 = new Label();
+        methodVisitor.visitLabel(label1);
+        methodVisitor.visitLineNumber(21, label1);
+        methodVisitor.visitInsn(RETURN);
+        methodVisitor.visitMaxs(2, 1);
+        methodVisitor.visitEnd();
+      }
+      classWriter.visitEnd();
+
+      return classWriter.toByteArray();
+    }
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingAfterVerticalMergingTest.java
similarity index 98%
rename from src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingAfterVerticalMergingTest.java
index 8856f47..822c847 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingAfterVerticalMergingTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingTest.java
new file mode 100644
index 0000000..7cd5e17
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ApplyMappingTest.java
@@ -0,0 +1,203 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.tools.r8.CompilationFailedException;
+import com.android.tools.r8.DiagnosticsHandler;
+import com.android.tools.r8.R8Command;
+import com.android.tools.r8.StringConsumer;
+import com.android.tools.r8.TestBase;
+import com.android.tools.r8.ToolHelper;
+import com.android.tools.r8.graph.DexMethod;
+import com.android.tools.r8.graph.DexType;
+import com.android.tools.r8.naming.ClassNameMapper;
+import com.android.tools.r8.utils.AndroidApp;
+import com.android.tools.r8.utils.FileUtils;
+import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.InstructionSubject;
+import com.android.tools.r8.utils.codeinspector.InvokeInstructionSubject;
+import com.android.tools.r8.utils.codeinspector.MethodSubject;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Iterator;
+import java.util.concurrent.ExecutionException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class ApplyMappingTest extends TestBase {
+
+  private static final String MAPPING = "test-mapping.txt";
+
+  private static final Path MINIFICATION_JAR =
+      Paths.get(ToolHelper.EXAMPLES_BUILD_DIR, "minification" + FileUtils.JAR_EXTENSION);
+
+  private static final Path NAMING001_JAR =
+      Paths.get(ToolHelper.EXAMPLES_BUILD_DIR, "naming001" + FileUtils.JAR_EXTENSION);
+
+  private static final Path NAMING044_JAR =
+      Paths.get(ToolHelper.EXAMPLES_BUILD_DIR, "naming044" + FileUtils.JAR_EXTENSION);
+
+  private static final Path APPLYMAPPING044_JAR =
+      Paths.get(ToolHelper.EXAMPLES_BUILD_DIR, "applymapping044" + FileUtils.JAR_EXTENSION);
+
+  private Path out;
+
+  private Backend backend;
+
+  @Parameters(name = "Backend: {0}")
+  public static Backend[] data() {
+    return Backend.values();
+  }
+
+  public ApplyMappingTest(Backend backend) {
+    this.backend = backend;
+  }
+
+  @Before
+  public void setup() throws IOException {
+    out = temp.newFolder("out").toPath();
+  }
+
+  @Ignore("b/121305642")
+  @Test
+  public void test044_obfuscate_and_apply() throws Exception {
+    // keep rules that allow obfuscations while keeping everything.
+    Path flagForObfuscation = Paths.get(ToolHelper.EXAMPLES_DIR, "naming044", "keep-rules-005.txt");
+    Path proguardMap = out.resolve(MAPPING);
+    class ProguardMapConsumer implements StringConsumer {
+      String map;
+
+      @Override
+      public void accept(String string, DiagnosticsHandler handler) {
+        map = string;
+      }
+    }
+    ProguardMapConsumer mapConsumer = new ProguardMapConsumer();
+    runR8(
+        ToolHelper.addProguardConfigurationConsumer(
+                getCommandForApps(out, flagForObfuscation, NAMING044_JAR)
+                    .setProguardMapConsumer(mapConsumer),
+                pgConfig -> {
+                  pgConfig.setPrintMapping(true);
+                  pgConfig.setPrintMappingFile(proguardMap);
+                })
+            .setOutput(out, outputMode(Backend.CF))
+            .build());
+
+    // Obviously, dumped map and resource inside the app should be *identical*.
+    ClassNameMapper mapperFromFile = ClassNameMapper.mapperFromFile(proguardMap);
+    ClassNameMapper mapperFromApp = ClassNameMapper.mapperFromString(mapConsumer.map);
+    assertEquals(mapperFromFile, mapperFromApp);
+
+    Path instrOut = temp.newFolder("instr").toPath();
+    Path flag = Paths.get(ToolHelper.EXAMPLES_DIR, "applymapping044", "keep-rules.txt");
+    AndroidApp instrApp =
+        runR8(
+            ToolHelper.addProguardConfigurationConsumer(
+                    getCommandForInstrumentation(instrOut, flag, out, APPLYMAPPING044_JAR)
+                        .setDisableMinification(true),
+                    pgConfig -> pgConfig.setApplyMappingFile(proguardMap))
+                .build());
+
+    CodeInspector inspector = createDexInspector(instrApp);
+    MethodSubject main = inspector.clazz("applymapping044.Main").method(CodeInspector.MAIN);
+    Iterator<InvokeInstructionSubject> iterator =
+        main.iterateInstructions(InstructionSubject::isInvoke);
+    // B#m()
+    String b = iterator.next().holder().toString();
+    assertEquals("naming044.B", mapperFromApp.deobfuscateClassName(b));
+    // sub.SubB#n()
+    String subB = iterator.next().holder().toString();
+    assertEquals("naming044.sub.SubB", mapperFromApp.deobfuscateClassName(subB));
+    // Skip A#<init>
+    iterator.next();
+    // Skip B#<init>
+    iterator.next();
+    // B#f(A)
+    InvokeInstructionSubject f = iterator.next();
+    DexType a1 = f.invokedMethod().proto.parameters.values[0];
+    assertNotEquals("naming044.A", a1.toString());
+    assertEquals("naming044.A", mapperFromApp.deobfuscateClassName(a1.toString()));
+    assertNotEquals("f", f.invokedMethod().name.toString());
+    // Skip AsubB#<init>
+    iterator.next();
+    // AsubB#f(A)
+    InvokeInstructionSubject overloaded_f = iterator.next();
+    DexMethod aSubB_f = overloaded_f.invokedMethod();
+    DexType a2 = aSubB_f.proto.parameters.values[0];
+    assertNotEquals("naming044.A", a2.toString());
+    assertEquals("naming044.A", mapperFromApp.deobfuscateClassName(a2.toString()));
+    assertNotEquals("f", aSubB_f.name.toString());
+    // B#f == AsubB#f
+    assertEquals(f.invokedMethod().name.toString(), aSubB_f.name.toString());
+    // sub.SubB#<init>(int)
+    InvokeInstructionSubject subBinit = iterator.next();
+    assertNotEquals("naming044.sub.SubB", subBinit.holder().toString());
+    assertEquals(
+        "naming044.sub.SubB", mapperFromApp.deobfuscateClassName(subBinit.holder().toString()));
+    // sub.SubB#f(A)
+    InvokeInstructionSubject original_f = iterator.next();
+    DexMethod subB_f = original_f.invokedMethod();
+    DexType a3 = subB_f.proto.parameters.values[0];
+    assertEquals(a2, a3);
+    assertNotEquals("f", original_f.invokedMethod().name.toString());
+  }
+
+  private static CodeInspector createDexInspector(AndroidApp outputApp)
+      throws IOException, ExecutionException {
+    return new CodeInspector(outputApp);
+  }
+
+  @Ignore("b/121305642")
+  @Test
+  public void test_minification_conflict_mapping() throws Exception {
+    Path flag =
+        Paths.get(ToolHelper.EXAMPLES_DIR, "minification", "keep-rules-apply-conflict-mapping.txt");
+    try {
+      runR8(getCommandForApps(out, flag, MINIFICATION_JAR).build());
+      fail("Expect to detect renaming conflict");
+    } catch (CompilationFailedException e) {
+      assertTrue(e.getCause().getMessage().contains("functionFromIntToInt"));
+    }
+  }
+
+  private R8Command.Builder getCommandForInstrumentation(
+      Path out, Path flag, Path mainApp, Path instrApp) throws IOException {
+    return R8Command.builder()
+        .addLibraryFiles(runtimeJar(backend), mainApp)
+        .addProgramFiles(instrApp)
+        .setOutput(out, outputMode(backend))
+        .addProguardConfigurationFiles(flag);
+  }
+
+  private R8Command.Builder getCommandForApps(Path out, Path flag, Path... jars)
+      throws IOException {
+    return R8Command.builder()
+        .addLibraryFiles(runtimeJar(backend))
+        .addProgramFiles(jars)
+        .setOutput(out, outputMode(backend))
+        .addProguardConfigurationFiles(flag);
+  }
+
+  private static AndroidApp runR8(R8Command command) throws CompilationFailedException {
+    return ToolHelper.runR8(
+        command,
+        options -> {
+          // Disable inlining to make this test not depend on inlining decisions.
+          options.enableInlining = false;
+        });
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/CompositionalLenseTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/CompositionalLenseTest.java
similarity index 91%
rename from src/test/java/com/android/tools/r8/naming/applymapping/CompositionalLenseTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/CompositionalLenseTest.java
index 8ac24bf..68385c5 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/CompositionalLenseTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/CompositionalLenseTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
@@ -24,6 +24,7 @@
 import java.nio.file.Path;
 import java.util.Iterator;
 import java.util.List;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -66,15 +67,16 @@
     this.backend = backend;
   }
 
+  @Ignore("b/127434575")
   @Test
   public void test() throws Exception {
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        "com.android.tools.r8.naming.applymapping.Base -> X:",
-        "  void foo() -> bar",
-        "com.android.tools.r8.naming.applymapping.Sub -> Y:",
-        "  void foo() -> bar"
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            Base.class.getTypeName() + " -> X:",
+            "  void foo() -> bar",
+            Sub.class.getTypeName() + " -> Y:",
+            "  void foo() -> bar");
     FileUtils.writeTextFile(mapPath, pgMap);
 
     AndroidApp app = readClasses(CLASSES);
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/InnerEnumValuesTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/InnerEnumValuesTest.java
new file mode 100644
index 0000000..a866303
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/InnerEnumValuesTest.java
@@ -0,0 +1,102 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
+
+import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import com.android.tools.r8.TestBase;
+import com.android.tools.r8.naming.applymapping.shrunkenlibrary.Outer.InnerEnum;
+import com.android.tools.r8.utils.FileUtils;
+import com.android.tools.r8.utils.StringUtils;
+import com.android.tools.r8.utils.codeinspector.ClassSubject;
+import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.FieldSubject;
+import java.nio.file.Path;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class InnerEnumValuesTest extends TestBase {
+  private static Class<?> MAIN = TestApp.class;
+  private static final String RENAMED_NAME = "x.y.z$ie";
+  private static final String EXPECTED_OUTPUT = StringUtils.lines(
+      "STATE_A", "STATE_B", "STATE_A", "STATE_B");
+
+  private static Path mappingFile;
+  private final Backend backend;
+
+  @Parameterized.Parameters(name = "Backend: {0}")
+  public static Backend[] data() {
+    return Backend.values();
+  }
+
+  public InnerEnumValuesTest(Backend backend) {
+    this.backend = backend;
+  }
+
+  @Before
+  public void setup() throws Exception {
+    // Mapping file that describes that inner enum has been renamed.
+    mappingFile = temp.newFile("mapping.txt").toPath();
+    FileUtils.writeTextFile(
+        mappingFile,
+        StringUtils.lines(
+            Outer.class.getTypeName() + " -> " + "x.y.z:",
+            "    void <init>() -> <init>",
+            InnerEnum.class.getTypeName() + " -> " + "x.y.z$ie:",
+            "    " + InnerEnum.class.getTypeName() + " STATE_A -> state_X",
+            "    " + InnerEnum.class.getTypeName() + " STATE_B -> state_Y",
+            "    " + InnerEnum.class.getTypeName() + "[] $VALUES -> XY",
+            "    void <clinit>() -> <clinit>",
+            "    void <init>(java.lang.String,int) -> <init>",
+            "    " + InnerEnum.class.getTypeName() + " valueOf(java.lang.String) -> valueOf",
+            "    " + InnerEnum.class.getTypeName() + "[] values() -> values"));
+  }
+
+  @Ignore("b/127434575")
+  @Test
+  public void b124177369() throws Exception {
+    CodeInspector inspector =
+        testForR8(backend)
+            .addProgramClassesAndInnerClasses(
+                com.android.tools.r8.naming.applymapping.shrunkenlibrary.Outer.class)
+            .addProgramClasses(MAIN)
+            .addKeepMainRule(MAIN)
+            .addKeepRules("-dontoptimize")
+            .addKeepRules("-applymapping " + mappingFile.toAbsolutePath())
+            .compile()
+            .run(MAIN)
+            .assertSuccessWithOutput(EXPECTED_OUTPUT)
+            .inspector();
+    ClassSubject classSubject = inspector.clazz(RENAMED_NAME);
+    FieldSubject fieldX = classSubject.uniqueFieldWithName("STATE_A");
+    assertThat(fieldX, isPresent());
+    assertEquals(fieldX.getFinalName(), "state_X");
+    FieldSubject fieldY = classSubject.uniqueFieldWithName("STATE_B");
+    assertThat(fieldY, isPresent());
+    assertEquals(fieldY.getFinalName(), "state_Y");
+  }
+}
+
+class Outer {
+  public enum InnerEnum {
+    STATE_A,
+    STATE_B
+  }
+}
+
+class TestApp {
+  public static void main(String[] args) {
+    for (InnerEnum i : InnerEnum.values()) {
+      System.out.println(i);
+    }
+    System.out.println(InnerEnum.STATE_A);
+    System.out.println(InnerEnum.STATE_B);
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionAsmTest.java
similarity index 90%
rename from src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionAsmTest.java
index 1a72ebc..30965a2 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionAsmTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
@@ -16,6 +16,12 @@
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.DexVm.Version;
 import com.android.tools.r8.ToolHelper.ProcessResult;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.HasMappingDump;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.NoMappingDump;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.NoMappingMainDump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.ADump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.BDump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.MainDump;
 import com.android.tools.r8.origin.Origin;
 import com.android.tools.r8.utils.AndroidApp;
 import com.android.tools.r8.utils.FileUtils;
@@ -25,6 +31,7 @@
 import com.google.common.collect.ImmutableList;
 import java.nio.file.Path;
 import java.util.List;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -68,6 +75,7 @@
   //      new NoMapping();
   //    }
   //  }
+  @Ignore("b/127434575")
   @Test
   public void test_noMapping() throws Exception {
     String main = "NoMappingMain";
@@ -118,13 +126,14 @@
     assertThat(x, isRenamed());
     assertEquals("a", x.getFinalName());
 
+    // To ensure still getting illegal-access error we need to rename consistently.
     ClassSubject sub = codeInspector.clazz("NoMapping");
     assertThat(sub, isPresent());
     assertThat(sub, isRenamed());
     assertEquals("Y", sub.getFinalName());
-    MethodSubject y = sub.method("void", "foo", ImmutableList.of());
+    MethodSubject y = sub.method("void", "a", ImmutableList.of());
     assertThat(y, isPresent());
-    assertThat(y, not(isRenamed()));
+    assertThat(y, isRenamed());
     assertEquals("foo", y.getFinalName());
   }
 
@@ -151,6 +160,7 @@
   //      new B().x(); // IllegalAccessError
   //    }
   //  }
+  @Ignore("b/127434575")
   @Test
   public void test_swapping() throws Exception {
     String main = "Main";
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionTest.java
similarity index 97%
rename from src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionTest.java
index 5ee3195..3b2b8cc 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MemberResolutionTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
@@ -21,6 +21,7 @@
 import com.google.common.collect.ImmutableList;
 import java.nio.file.Path;
 import java.util.List;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -89,6 +90,7 @@
     this.backend = backend;
   }
 
+  @Ignore("b/127434575")
   @Test
   public void testPrivateMethodsWithSameName() throws Exception {
     String pkg = this.getClass().getPackage().getName();
diff --git a/src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MultiDimensionalArrayTest.java
similarity index 92%
rename from src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MultiDimensionalArrayTest.java
index 22ea4ae..7aaf278 100644
--- a/src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/MultiDimensionalArrayTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
@@ -22,6 +22,7 @@
 import java.nio.file.Path;
 import java.util.List;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 class ToBeRenamedForMultiDimensionalArrayTest {
@@ -66,13 +67,14 @@
         ToolHelper.getClassAsBytes(MultiDimensionalArrayTestMain.class));
   }
 
+  @Ignore("b/127434575")
   @Test
   public void test() throws Exception {
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        "com.android.tools.r8.naming.ToBeRenamedForMultiDimensionalArrayTest -> X:",
-        "  java.lang.String foo() -> bar"
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            ToBeRenamedForMultiDimensionalArrayTest.class.getTypeName() + "-> X:",
+            "  java.lang.String foo() -> bar");
     FileUtils.writeTextFile(mapPath, pgMap);
 
     AndroidApp app = buildAndroidApp(classes);
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ShrunkenLibraryTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ShrunkenLibraryTest.java
similarity index 97%
rename from src/test/java/com/android/tools/r8/naming/applymapping/ShrunkenLibraryTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ShrunkenLibraryTest.java
index 61250a2..05a6235 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ShrunkenLibraryTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/shrunkenlibrary/ShrunkenLibraryTest.java
@@ -2,7 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.shrunkenlibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingAfterVerticalMergingTest.java
similarity index 78%
copy from src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java
copy to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingAfterVerticalMergingTest.java
index 8856f47..cc2d2ef 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingAfterVerticalMergingTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
@@ -23,8 +23,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-class Resources {
-}
+class Resources {}
 
 @NeverMerge
 class ResourceWrapper extends Resources {
@@ -64,10 +63,10 @@
 
 @RunWith(Parameterized.class)
 public class ApplyMappingAfterVerticalMergingTest extends TestBase {
-  private final static Class<?>[] CLASSES = {
-      NeverMerge.class, Resources.class, ResourceWrapper.class, TintResources.class
+  private static final Class<?>[] CLASSES = {
+    NeverMerge.class, Resources.class, ResourceWrapper.class, TintResources.class
   };
-  private final static Class<?> MAIN = TintResources.class;
+  private static final Class<?> MAIN = TintResources.class;
 
   private Backend backend;
 
@@ -80,28 +79,31 @@
     this.backend = backend;
   }
 
-  @Ignore("b/12042934")
+  @Ignore("b/127434575")
   @Test
   public void b121042934() throws Exception {
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    CodeInspector inspector1 = testForR8(backend)
-        .addProgramClasses(CLASSES)
-        .addKeepMainRule(MAIN)
-        .addKeepRules("-printmapping " + mapPath.toAbsolutePath())
-        .compile()
-        .inspector();
-    CodeInspector inspector2 = testForR8(backend)
-        .addProgramClasses(CLASSES)
-        .addKeepMainRule(MAIN)
-        .addKeepRules("-applymapping " + mapPath.toAbsolutePath())
-        .compile()
-        .inspector();
+    CodeInspector inspector1 =
+        testForR8(backend)
+            .addProgramClasses(CLASSES)
+            .addKeepMainRule(MAIN)
+            .addKeepRules("-printmapping " + mapPath.toAbsolutePath())
+            .compile()
+            .inspector();
+    CodeInspector inspector2 =
+        testForR8(backend)
+            .addProgramClasses(CLASSES)
+            .addKeepMainRule(MAIN)
+            .addKeepRules("-applymapping " + mapPath.toAbsolutePath())
+            .compile()
+            .inspector();
 
     ClassSubject classSubject1 = inspector1.clazz(MAIN);
     assertThat(classSubject1, isPresent());
     assertThat(classSubject1, isRenamed());
-    ClassSubject classSubject2 = inspector2.clazz(
-        DescriptorUtils.getClassNameFromDescriptor(classSubject1.getFinalDescriptor()));
+    ClassSubject classSubject2 =
+        inspector2.clazz(
+            DescriptorUtils.getClassNameFromDescriptor(classSubject1.getFinalDescriptor()));
     assertThat(classSubject2, isPresent());
     assertThat(classSubject2, not(isRenamed()));
     assertEquals(classSubject1.getFinalDescriptor(), classSubject2.getFinalDescriptor());
@@ -122,5 +124,4 @@
     assertThat(method2, not(isRenamed()));
     assertEquals(method1.getFinalSignature().toString(), method2.getFinalSignature().toString());
   }
-
 }
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingTest.java
similarity index 66%
rename from src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingTest.java
index b175785..15675ff 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/ApplyMappingTest.java
@@ -1,26 +1,20 @@
-// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import com.android.tools.r8.CompilationFailedException;
-import com.android.tools.r8.DiagnosticsHandler;
 import com.android.tools.r8.R8Command;
-import com.android.tools.r8.StringConsumer;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.graph.DexMethod;
 import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.naming.ClassNameMapper;
 import com.android.tools.r8.utils.AndroidApp;
 import com.android.tools.r8.utils.FileUtils;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
@@ -76,91 +70,7 @@
     out = temp.newFolder("out").toPath();
   }
 
-  @Ignore("b/121305642")
-  @Test
-  public void test044_obfuscate_and_apply() throws Exception {
-    // keep rules that allow obfuscations while keeping everything.
-    Path flagForObfuscation =
-        Paths.get(ToolHelper.EXAMPLES_DIR, "naming044", "keep-rules-005.txt");
-    Path proguardMap = out.resolve(MAPPING);
-    class ProguardMapConsumer implements StringConsumer {
-      String map;
-
-      @Override
-      public void accept(String string, DiagnosticsHandler handler) {
-        map = string;
-      }
-    }
-    ProguardMapConsumer mapConsumer = new ProguardMapConsumer();
-    runR8(
-        ToolHelper.addProguardConfigurationConsumer(
-                getCommandForApps(out, flagForObfuscation, NAMING044_JAR)
-                    .setProguardMapConsumer(mapConsumer),
-                pgConfig -> {
-                  pgConfig.setPrintMapping(true);
-                  pgConfig.setPrintMappingFile(proguardMap);
-                })
-            .build());
-
-    // Obviously, dumped map and resource inside the app should be *identical*.
-    ClassNameMapper mapperFromFile = ClassNameMapper.mapperFromFile(proguardMap);
-    ClassNameMapper mapperFromApp = ClassNameMapper.mapperFromString(mapConsumer.map);
-    assertEquals(mapperFromFile, mapperFromApp);
-
-    Path instrOut = temp.newFolder("instr").toPath();
-    Path flag = Paths.get(ToolHelper.EXAMPLES_DIR, "applymapping044", "keep-rules.txt");
-    AndroidApp instrApp =
-        runR8(
-            ToolHelper.addProguardConfigurationConsumer(
-                    getCommandForInstrumentation(instrOut, flag, out, APPLYMAPPING044_JAR)
-                        .setDisableMinification(true),
-                    pgConfig -> pgConfig.setApplyMappingFile(proguardMap))
-                .build());
-
-    CodeInspector inspector = createDexInspector(instrApp);
-    MethodSubject main = inspector.clazz("applymapping044.Main").method(CodeInspector.MAIN);
-    Iterator<InvokeInstructionSubject> iterator =
-        main.iterateInstructions(InstructionSubject::isInvoke);
-    // B#m()
-    String b = iterator.next().holder().toString();
-    assertEquals("naming044.B", mapperFromApp.deobfuscateClassName(b));
-    // sub.SubB#n()
-    String subB = iterator.next().holder().toString();
-    assertEquals("naming044.sub.SubB", mapperFromApp.deobfuscateClassName(subB));
-    // Skip A#<init>
-    iterator.next();
-    // Skip B#<init>
-    iterator.next();
-    // B#f(A)
-    InvokeInstructionSubject f = iterator.next();
-    DexType a1 = f.invokedMethod().proto.parameters.values[0];
-    assertNotEquals("naming044.A", a1.toString());
-    assertEquals("naming044.A", mapperFromApp.deobfuscateClassName(a1.toString()));
-    assertNotEquals("f", f.invokedMethod().name.toString());
-    // Skip AsubB#<init>
-    iterator.next();
-    // AsubB#f(A)
-    InvokeInstructionSubject overloaded_f = iterator.next();
-    DexMethod aSubB_f = overloaded_f.invokedMethod();
-    DexType a2 = aSubB_f.proto.parameters.values[0];
-    assertNotEquals("naming044.A", a2.toString());
-    assertEquals("naming044.A", mapperFromApp.deobfuscateClassName(a2.toString()));
-    assertNotEquals("f", aSubB_f.name.toString());
-    // B#f == AsubB#f
-    assertEquals(f.invokedMethod().name.toString(), aSubB_f.name.toString());
-    // sub.SubB#<init>(int)
-    InvokeInstructionSubject subBinit = iterator.next();
-    assertNotEquals("naming044.sub.SubB", subBinit.holder().toString());
-    assertEquals("naming044.sub.SubB",
-        mapperFromApp.deobfuscateClassName(subBinit.holder().toString()));
-    // sub.SubB#f(A)
-    InvokeInstructionSubject original_f = iterator.next();
-    DexMethod subB_f = original_f.invokedMethod();
-    DexType a3 = subB_f.proto.parameters.values[0];
-    assertEquals(a2, a3);
-    assertNotEquals("f", original_f.invokedMethod().name.toString());
-  }
-
+  @Ignore("b/126503704")
   @Test
   public void test044_apply() throws Exception {
     Path flag =
@@ -169,6 +79,7 @@
         runR8(
             getCommandForInstrumentation(out, flag, NAMING044_JAR, APPLYMAPPING044_JAR)
                 .setDisableMinification(true)
+                .setOutput(out, outputMode(Backend.CF))
                 .build());
 
     // Make sure the given proguard map is indeed applied.
@@ -219,6 +130,7 @@
     return new CodeInspector(outputApp);
   }
 
+  @Ignore("b/126503704")
   @Test
   public void test_naming001_rule105() throws Exception {
     // keep rules to reserve D and E, along with a proguard map.
@@ -253,6 +165,7 @@
     assertEquals("peek", m.invokedMethod().name.toSourceString());
   }
 
+  @Ignore("b/126503704")
   @Test
   public void test_naming001_rule106() throws Exception {
     // keep rules just to rename E
@@ -288,18 +201,6 @@
     assertEquals( "La/a;", newInstance.getType().toSmaliString());
   }
 
-  @Test
-  public void test_minification_conflict_mapping() throws Exception {
-    Path flag = Paths.get(
-        ToolHelper.EXAMPLES_DIR, "minification", "keep-rules-apply-conflict-mapping.txt");
-    try {
-      runR8(getCommandForApps(out, flag, MINIFICATION_JAR).build());
-      fail("Expect to detect renaming conflict");
-    } catch (CompilationFailedException e) {
-      assertTrue(e.getCause().getMessage().contains("functionFromIntToInt"));
-    }
-  }
-
   private R8Command.Builder getCommandForInstrumentation(
       Path out, Path flag, Path mainApp, Path instrApp) throws IOException {
     return R8Command.builder()
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/InnerEnumValuesTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/InnerEnumValuesTest.java
similarity index 64%
rename from src/test/java/com/android/tools/r8/naming/applymapping/InnerEnumValuesTest.java
rename to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/InnerEnumValuesTest.java
index 08d0ff3..ab32049 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/InnerEnumValuesTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/InnerEnumValuesTest.java
@@ -1,44 +1,45 @@
-// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
 import com.android.tools.r8.TestBase;
-import com.android.tools.r8.naming.applymapping.Outer.InnerEnum;
-import com.android.tools.r8.utils.BooleanUtils;
+import com.android.tools.r8.naming.applymapping.sourcelibrary.Outer.InnerEnum;
 import com.android.tools.r8.utils.FileUtils;
 import com.android.tools.r8.utils.StringUtils;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
+import com.android.tools.r8.utils.codeinspector.CodeInspector;
 import com.android.tools.r8.utils.codeinspector.FieldSubject;
 import java.nio.file.Path;
 import java.util.Collection;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
 @RunWith(Parameterized.class)
 public class InnerEnumValuesTest extends TestBase {
+
   private static final Class<?> MAIN = TestApp.class;
   private static final String RENAMED_NAME = "x.y.z$ie";
-  private static final String EXPECTED_OUTPUT = StringUtils.lines("STATE_A", "STATE_B");
+  private static final String EXPECTED_OUTPUT = StringUtils.lines(
+      "STATE_A", "STATE_B", "STATE_A", "STATE_B");
 
   private static Path mappingFile;
   private final Backend backend;
-  private final boolean minification;
 
-  @Parameterized.Parameters(name = "Backend: {0} minification: {1}")
-  public static Collection<Object[]> data() {
-    return buildParameters(Backend.values(), BooleanUtils.values());
+  @Parameterized.Parameters(name = "Backend: {0}")
+  public static Backend[] data() {
+    return Backend.values();
   }
 
-  public InnerEnumValuesTest(Backend backend, boolean minification) {
+  public InnerEnumValuesTest(Backend backend) {
     this.backend = backend;
-    this.minification = minification;
   }
 
   @Before
@@ -60,28 +61,29 @@
             "    " + InnerEnum.class.getTypeName() + "[] values() -> values"));
   }
 
+  @Ignore("b/126503704")
   @Test
   public void b124177369() throws Exception {
-    testForR8(backend)
-        .addProgramClassesAndInnerClasses(Outer.class)
+    CodeInspector inspector = testForR8(Backend.CF)
+        .addProgramClassesAndInnerClasses(
+            Outer.class)
         .addProgramClasses(MAIN)
         .addKeepMainRule(MAIN)
         .addKeepRules("-applymapping " + mappingFile.toAbsolutePath())
-        .minification(minification)
-        .compile()
-        .inspect(inspector -> {
-          ClassSubject enumSubject = inspector.clazz(RENAMED_NAME);
-          assertThat(enumSubject, isPresent());
-          assertEquals(minification, enumSubject.isRenamed());
-          String fieldName =
-              minification
-                  ? "a"        // minified name
-                  : "state_X"; // mapped name without minification
-          FieldSubject stateA = enumSubject.uniqueFieldWithName(fieldName);
-          assertThat(stateA, isPresent());
-        })
         .run(MAIN)
-        .assertSuccessWithOutput(EXPECTED_OUTPUT);
+        .assertSuccessWithOutput(EXPECTED_OUTPUT)
+        .inspector();
+    ClassSubject enumSubject = inspector.clazz(RENAMED_NAME);
+    assertThat(enumSubject, isPresent());
+    // TODO(b/124177369): method signature Object Outer$InnerEnum[]#clone() left in values().
+    //  .run(MAIN)
+    //  .assertSuccessWithOutput(EXPECTED_OUTPUT);
+    FieldSubject fieldX = enumSubject.uniqueFieldWithName("STATE_A");
+    assertThat(fieldX, isPresent());
+    assertEquals("state_X", fieldX.getFinalName());
+    FieldSubject fieldY = enumSubject.uniqueFieldWithName("STATE_B");
+    assertThat(fieldY, isPresent());
+    assertEquals("state_Y", fieldY.getFinalName());
   }
 }
 
@@ -97,5 +99,7 @@
     for (InnerEnum i : InnerEnum.values()) {
       System.out.println(i);
     }
+    System.out.println(InnerEnum.STATE_A);
+    System.out.println(InnerEnum.STATE_B);
   }
 }
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionAsmTest.java
similarity index 80%
copy from src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java
copy to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionAsmTest.java
index 1a72ebc..e155150 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionAsmTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionAsmTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
@@ -16,6 +16,12 @@
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.DexVm.Version;
 import com.android.tools.r8.ToolHelper.ProcessResult;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.HasMappingDump;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.NoMappingDump;
+import com.android.tools.r8.naming.applymapping.shared.NoMappingDumps.NoMappingMainDump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.ADump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.BDump;
+import com.android.tools.r8.naming.applymapping.shared.SwappingDump.MainDump;
 import com.android.tools.r8.origin.Origin;
 import com.android.tools.r8.utils.AndroidApp;
 import com.android.tools.r8.utils.FileUtils;
@@ -25,6 +31,7 @@
 import com.google.common.collect.ImmutableList;
 import java.nio.file.Path;
 import java.util.List;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -68,19 +75,21 @@
   //      new NoMapping();
   //    }
   //  }
+  @Ignore("b/126503704")
   @Test
   public void test_noMapping() throws Exception {
     String main = "NoMappingMain";
-    AndroidApp input = buildAndroidApp(
-        HasMappingDump.dump(), NoMappingDump.dump(), NoMappingMainDump.dump());
+    AndroidApp input =
+        buildAndroidApp(HasMappingDump.dump(), NoMappingDump.dump(), NoMappingMainDump.dump());
 
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        "HasMapping -> X:",
-        "  void foo() -> a",
-        "NoMapping -> Y:"
-        // Intentionally missing a mapping for `private` foo().
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            "HasMapping -> X:",
+            "  void foo() -> a",
+            "NoMapping -> Y:"
+            // Intentionally missing a mapping for `private` foo().
+            );
     FileUtils.writeTextFile(mapPath, pgMap);
 
     R8Command.Builder builder = ToolHelper.prepareR8CommandBuilder(input, emptyConsumer(backend));
@@ -89,8 +98,7 @@
             ImmutableList.of(
                 keepMainProguardConfiguration(main),
                 // Do not turn on -allowaccessmodification
-                "-applymapping " + mapPath,
-                "-dontobfuscate"), // to use the renamed names in test-mapping.txt
+                "-applymapping " + mapPath),
             Origin.unknown())
         .addLibraryFiles(runtimeJar(backend));
     AndroidApp processedApp =
@@ -101,8 +109,8 @@
               options.enableVerticalClassMerging = false;
             });
 
-    List<byte[]> classBytes = ImmutableList.of(
-        HasMappingDump.dump(), NoMappingDump.dump(), NoMappingMainDump.dump());
+    List<byte[]> classBytes =
+        ImmutableList.of(HasMappingDump.dump(), NoMappingDump.dump(), NoMappingMainDump.dump());
     ProcessResult outputBefore = runOnJavaRaw(main, classBytes, ImmutableList.of());
     assertEquals(0, outputBefore.exitCode);
     String outputAfter = runOnVM(processedApp, main, backend);
@@ -118,14 +126,13 @@
     assertThat(x, isRenamed());
     assertEquals("a", x.getFinalName());
 
+    // To ensure still getting illegal-access error we need to rename consistently.
     ClassSubject sub = codeInspector.clazz("NoMapping");
     assertThat(sub, isPresent());
     assertThat(sub, isRenamed());
     assertEquals("Y", sub.getFinalName());
-    MethodSubject y = sub.method("void", "foo", ImmutableList.of());
+    MethodSubject y = sub.method("void", "a", ImmutableList.of());
     assertThat(y, isPresent());
-    assertThat(y, not(isRenamed()));
-    assertEquals("foo", y.getFinalName());
   }
 
   //  class A { // : X
@@ -151,20 +158,21 @@
   //      new B().x(); // IllegalAccessError
   //    }
   //  }
+  @Ignore("b/126503704")
   @Test
   public void test_swapping() throws Exception {
     String main = "Main";
-    AndroidApp input = buildAndroidApp(
-        ADump.dump(), BDump.dump(), MainDump.dump());
+    AndroidApp input = buildAndroidApp(ADump.dump(), BDump.dump(), MainDump.dump());
 
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        "A -> X:",
-        "  void x() -> y",
-        "  void y() -> x",
-        "B -> Y:"
-        // Intentionally missing mappings for non-overridden members
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            "A -> X:",
+            "  void x() -> y",
+            "  void y() -> x",
+            "B -> Y:"
+            // Intentionally missing mappings for non-overridden members
+            );
     FileUtils.writeTextFile(mapPath, pgMap);
 
     R8Command.Builder builder = ToolHelper.prepareR8CommandBuilder(input, emptyConsumer(backend));
@@ -198,10 +206,10 @@
     if (backend == Backend.DEX) {
       expectedErrorSignature = "void X.y()";
       if (ToolHelper.getDexVm().getVersion().isOlderThanOrEqual(Version.V6_0_1)) {
-        expectedErrorMessage ="IncompatibleClassChangeError";
+        expectedErrorMessage = "IncompatibleClassChangeError";
       }
       if (ToolHelper.getDexVm().getVersion().isOlderThanOrEqual(Version.V4_4_4)) {
-        expectedErrorMessage ="illegal method access";
+        expectedErrorMessage = "illegal method access";
         expectedErrorSignature = "LX;.y ()V";
       }
     }
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionTest.java
similarity index 89%
copy from src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java
copy to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionTest.java
index 5ee3195..c070e72 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/MemberResolutionTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MemberResolutionTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming.applymapping;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
@@ -21,6 +21,7 @@
 import com.google.common.collect.ImmutableList;
 import java.nio.file.Path;
 import java.util.List;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -47,7 +48,7 @@
   // String tag -> q
   private String tag = "PrivateInitialTag_ConcreteChecker";
 
-  ConcreteChecker(String tag){
+  ConcreteChecker(String tag) {
     this.tag = tag;
   }
 
@@ -89,20 +90,21 @@
     this.backend = backend;
   }
 
+  @Ignore("b/126503704")
   @Test
   public void testPrivateMethodsWithSameName() throws Exception {
     String pkg = this.getClass().getPackage().getName();
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        pkg + ".AbstractChecker -> " + pkg + ".X:",
-        "  java.lang.String tag -> p",
-        "  void check() -> x",
-        "  void foo() -> a",
-        pkg + ".ConcreteChecker -> " + pkg + ".Y:",
-        "  java.lang.String tag -> q",
-        "  void check() -> y",
-        "  void foo() -> a"
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            pkg + ".AbstractChecker -> " + pkg + ".X:",
+            "  java.lang.String tag -> p",
+            "  void check() -> x",
+            "  void foo() -> a",
+            pkg + ".ConcreteChecker -> " + pkg + ".Y:",
+            "  java.lang.String tag -> q",
+            "  void check() -> y",
+            "  void foo() -> a");
     FileUtils.writeTextFile(mapPath, pgMap);
 
     AndroidApp app = readClasses(CLASSES);
diff --git a/src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MultiDimensionalArrayTest.java
similarity index 87%
copy from src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java
copy to src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MultiDimensionalArrayTest.java
index 22ea4ae..abcae3d 100644
--- a/src/test/java/com/android/tools/r8/naming/MultiDimensionalArrayTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/sourcelibrary/MultiDimensionalArrayTest.java
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.naming;
+package com.android.tools.r8.naming.applymapping.sourcelibrary;
 
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static org.junit.Assert.assertEquals;
@@ -22,6 +22,7 @@
 import java.nio.file.Path;
 import java.util.List;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 class ToBeRenamedForMultiDimensionalArrayTest {
@@ -61,18 +62,20 @@
 
   @Before
   public void setUp() throws Exception {
-    classes = ImmutableList.of(
-        ToolHelper.getClassAsBytes(ToBeRenamedForMultiDimensionalArrayTest.class),
-        ToolHelper.getClassAsBytes(MultiDimensionalArrayTestMain.class));
+    classes =
+        ImmutableList.of(
+            ToolHelper.getClassAsBytes(ToBeRenamedForMultiDimensionalArrayTest.class),
+            ToolHelper.getClassAsBytes(MultiDimensionalArrayTestMain.class));
   }
 
+  @Ignore("b/126503704")
   @Test
   public void test() throws Exception {
     Path mapPath = temp.newFile("test-mapping.txt").toPath();
-    List<String> pgMap = ImmutableList.of(
-        "com.android.tools.r8.naming.ToBeRenamedForMultiDimensionalArrayTest -> X:",
-        "  java.lang.String foo() -> bar"
-    );
+    List<String> pgMap =
+        ImmutableList.of(
+            ToBeRenamedForMultiDimensionalArrayTest.class.getTypeName() + " -> X:",
+            "  java.lang.String foo() -> bar");
     FileUtils.writeTextFile(mapPath, pgMap);
 
     AndroidApp app = buildAndroidApp(classes);