Merge "Fix none.d8.Art370_dex_v37Test test specification:"
diff --git a/src/test/java/com/android/tools/r8/JctfTestSpecifications.java b/src/test/java/com/android/tools/r8/JctfTestSpecifications.java
index 03eddc7..b1934dd 100644
--- a/src/test/java/com/android/tools/r8/JctfTestSpecifications.java
+++ b/src/test/java/com/android/tools/r8/JctfTestSpecifications.java
@@ -5,7 +5,7 @@
 package com.android.tools.r8;
 
 import static com.android.tools.r8.TestCondition.D8_COMPILER;
-import static com.android.tools.r8.TestCondition.R8DEBUG_AFTER_D8_COMPILER;
+import static com.android.tools.r8.TestCondition.R8_AFTER_D8_COMPILER;
 import static com.android.tools.r8.TestCondition.R8_COMPILER;
 import static com.android.tools.r8.TestCondition.any;
 import static com.android.tools.r8.TestCondition.match;
@@ -4654,11 +4654,11 @@
           // 1) t04
           // java.lang.AssertionError
 
-          .put("lang.reflect.Field.getLjava_lang_Object.Field_get_A04", match(R8DEBUG_AFTER_D8_COMPILER))
+          .put("lang.reflect.Field.getLjava_lang_Object.Field_get_A04", match(R8_AFTER_D8_COMPILER))
           // 1) t02
           // java.lang.AssertionError: expected:<9223372036854775807> but was:<72057594037927935>
 
-          .put("lang.reflect.Field.getLongLjava_lang_Object.Field_getLong_A04", match(R8DEBUG_AFTER_D8_COMPILER))
+          .put("lang.reflect.Field.getLongLjava_lang_Object.Field_getLong_A04", match(R8_AFTER_D8_COMPILER))
           // 1)
           // java.lang.AssertionError: expected:<9223372036854775807> but was:<72057594037927935>
 
diff --git a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
index 8f1dadd..66844af 100644
--- a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
+++ b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 package com.android.tools.r8;
 
+import static com.android.tools.r8.TestCondition.compilers;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -71,7 +72,7 @@
   public enum CompilerUnderTest {
     D8,
     R8,
-    R8DEBUG_AFTER_D8 // refers to the R8/debug step but implies a previous D8 step as well
+    R8_AFTER_D8 // refers to the R8 (default: debug) step but implies a previous D8 step as well
   }
 
   private static final String ART_TESTS_DIR = "tests/art";
@@ -554,8 +555,11 @@
           // Array index out of bounds exception.
           .put("150-loadlibrary", TestCondition.any())
           // Uses dex file version 37 and therefore only runs on Android N and above.
-          .put("370-dex-v37",
-              TestCondition.match(TestCondition.tools(DexTool.JACK, DexTool.DX),
+          .put(
+              "370-dex-v37",
+              TestCondition.match(
+                  TestCondition.tools(DexTool.JACK, DexTool.DX),
+                  compilers(CompilerUnderTest.R8, CompilerUnderTest.D8),
                   TestCondition.runtimes(DexVm.ART_4_4_4, DexVm.ART_5_1_1, DexVm.ART_6_0_1)))
           // Array index out of bounds exception.
           .put("449-checker-bce", TestCondition.any())
@@ -906,7 +910,7 @@
         compilationMode = CompilationMode.RELEASE;
         break;
       case D8:
-      case R8DEBUG_AFTER_D8:
+      case R8_AFTER_D8:
         compilationMode = CompilationMode.DEBUG;
         break;
       default:
@@ -1076,7 +1080,7 @@
     DexVm dexVm = ToolHelper.getDexVm();
 
     CompilerUnderTest firstCompilerUnderTest =
-        compilerUnderTest == CompilerUnderTest.R8DEBUG_AFTER_D8
+        compilerUnderTest == CompilerUnderTest.R8_AFTER_D8
             ? CompilerUnderTest.D8
             : compilerUnderTest;
     CompilationMode compilationMode = defaultCompilationMode(compilerUnderTest);
@@ -1164,7 +1168,7 @@
         resultDir);
 
     // second pass if D8_R8Debug
-    if (compilerUnderTest == CompilerUnderTest.R8DEBUG_AFTER_D8) {
+    if (compilerUnderTest == CompilerUnderTest.R8_AFTER_D8) {
       List<String> d8OutputFileNames =
           Files.list(resultDir.toPath())
               .filter(FileUtils::isDexFile)
@@ -1174,7 +1178,7 @@
       compilationMode = CompilationMode.DEBUG;
       expectedOutcome =
           JctfTestSpecifications.getExpectedOutcome(
-              name, CompilerUnderTest.R8DEBUG_AFTER_D8, dexVm, compilationMode);
+              name, CompilerUnderTest.R8_AFTER_D8, dexVm, compilationMode);
       specification = new TestSpecification(name, DexTool.DX, r8ResultDir,
           expectedOutcome == JctfTestSpecifications.Outcome.TIMEOUTS_WITH_ART
               || expectedOutcome == JctfTestSpecifications.Outcome.FLAKY_WITH_ART,
@@ -1259,7 +1263,7 @@
   protected void runArtTest(DexVm version, CompilerUnderTest compilerUnderTest)
       throws Throwable {
     CompilerUnderTest firstCompilerUnderTest =
-        compilerUnderTest == CompilerUnderTest.R8DEBUG_AFTER_D8
+        compilerUnderTest == CompilerUnderTest.R8_AFTER_D8
             ? CompilerUnderTest.D8
             : compilerUnderTest;
 
@@ -1310,10 +1314,10 @@
     runArtTestDoRunOnArt(
         version, firstCompilerUnderTest, specification, fileNames, resultDir, compilationMode);
 
-    if (compilerUnderTest == CompilerUnderTest.R8DEBUG_AFTER_D8) {
+    if (compilerUnderTest == CompilerUnderTest.R8_AFTER_D8) {
       compilationMode = CompilationMode.DEBUG;
       specification =
-          get_tests_map(CompilerUnderTest.R8DEBUG_AFTER_D8, compilationMode)
+          get_tests_map(CompilerUnderTest.R8_AFTER_D8, compilationMode)
               .get(new SpecificationKey(name, DexTool.DX));
 
       if (specification == null) {
diff --git a/src/test/java/com/android/tools/r8/TestCondition.java b/src/test/java/com/android/tools/r8/TestCondition.java
index eabc95e..438fd37 100644
--- a/src/test/java/com/android/tools/r8/TestCondition.java
+++ b/src/test/java/com/android/tools/r8/TestCondition.java
@@ -48,9 +48,13 @@
   }
 
   public static final CompilerSet D8_COMPILER = compilers(CompilerUnderTest.D8);
-  public static final CompilerSet R8_COMPILER = compilers(CompilerUnderTest.R8);
-  public static final CompilerSet R8DEBUG_AFTER_D8_COMPILER =
-      compilers(CompilerUnderTest.R8DEBUG_AFTER_D8);
+  // R8_COMPILER refers to R8 both in the standalone setting and after D8
+  // R8_NOT_AFTER_D8_COMPILER and R8_AFTER_D8_COMPILER refers to the standalone and the combined
+  // settings, respectively
+  public static final CompilerSet R8_COMPILER =
+      compilers(CompilerUnderTest.R8, CompilerUnderTest.R8_AFTER_D8);
+  public static final CompilerSet R8_AFTER_D8_COMPILER = compilers(CompilerUnderTest.R8_AFTER_D8);
+  public static final CompilerSet R8_NOT_AFTER_D8_COMPILER = compilers(CompilerUnderTest.R8);
 
   public static final CompilationModeSet DEBUG_MODE =
       new CompilationModeSet(EnumSet.of(CompilationMode.DEBUG));
@@ -144,13 +148,8 @@
       CompilerUnderTest compilerUnderTest,
       DexVm dexVm,
       CompilationMode compilationMode) {
-    // R8DEBUG_AFTER_D8 will be set in the R8 phase of the D8-then-R8 tests. So R8DEBUG_AFTER_D8
-    // must match both with plain R8 and itself.
-    boolean compilerMatches = compilers.contains(compilerUnderTest)
-        || (compilerUnderTest == CompilerUnderTest.R8DEBUG_AFTER_D8
-            && compilers.contains(CompilerUnderTest.R8));
     return dexTools.contains(dexTool)
-        && compilerMatches
+        && compilers.contains(compilerUnderTest)
         && dexVms.contains(dexVm)
         && compilationModes.contains(compilationMode);
   }
diff --git a/tools/create_art_tests.py b/tools/create_art_tests.py
index 69d2be7..99d64d2 100755
--- a/tools/create_art_tests.py
+++ b/tools/create_art_tests.py
@@ -64,7 +64,7 @@
     class_name = "Art" + dir.replace("-", "_") + "Test"
     for tool in TOOLS:
       if tool == "d8" and toolchain == "none":
-        tool_enum = 'R8DEBUG_AFTER_D8'
+        tool_enum = 'R8_AFTER_D8'
       else:
         tool_enum = upper(tool)
       contents = TEMPLATE.substitute(
diff --git a/tools/create_jctf_tests.py b/tools/create_jctf_tests.py
index 52907fc..ff9d797 100755
--- a/tools/create_jctf_tests.py
+++ b/tools/create_jctf_tests.py
@@ -121,7 +121,7 @@
     assert idx >= 0
     relative_package = package[idx + len(dot_java_dot):]
 
-    generate_test(class_name, 'd8', 'R8DEBUG_AFTER_D8', relative_package)
+    generate_test(class_name, 'd8', 'R8_AFTER_D8', relative_package)
     generate_test(class_name, 'r8', 'R8', relative_package)