Put 5% of ART run-tests in `TEST_MAPPING` group `mainline-presubmit`.

Include more ART run-tests into the `mainline-presubmit` test
group. This progressive rollout is to make sure introducing ART
run-tests to this test group won't disturb/break Android
presubmits.

Output of `art/test/utils/regen-test-files`:

  $ art/test/utils/regen-test-files
  Generated Blueprint files for 621 ART run-tests out of 918 (67%).
  Generated TEST_MAPPING entries for 256 ART run-tests out of 918 (27%):
    12 tests (5%) in `mainline-presubmit` test group.
    128 tests (50%) in `presubmit` test group.
    128 tests (50%) in `postsubmit` test group.

Also make some stylistic changes (e.g. use list comprehensions instead
of `map()` and `lambda`; use parentheses for implied line continuation
instead of escaping line breaks with backslashes).

Test: atest --test-mapping art:mainline-presubmit
Bug: 178703264
Bug: 152374989
Change-Id: I25950b02fbd3a1cbd4193a5f7b87f8b3867bd16b
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 0b198ee..6935bb4 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -3,6 +3,39 @@
   "mainline-presubmit": [
     {
       "name": "art-run-test-001-HelloWorld[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-001-Main[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-002-sleep[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-004-InterfaceTest[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-006-args[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-007-count10[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-009-instanceof[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-010-instance[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-011-array-copy[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-012-math[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-013-math2[com.google.android.art.apex]"
+    },
+    {
+      "name": "art-run-test-014-math3[com.google.android.art.apex]"
     }
   ],
   "presubmit": [
diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files
index 303e03a..e55e0ba 100755
--- a/test/utils/regen-test-files
+++ b/test/utils/regen-test-files
@@ -283,6 +283,11 @@
 # This value has to be a number between 0 and 100.
 presubmit_tests_percentage = 50
 
+# Percentage of ART run-tests (among the ones expected to succeed) to include in
+# the `mainline-presubmit` test group in `TEST_MAPPING` file.
+# This value has to be a number between 0 and 100.
+mainline_presubmit_tests_percentage = 5
+
 
 # Is `run_test` a Checker test (i.e. a test containing Checker
 # assertions)?
@@ -305,9 +310,9 @@
     self.art_test_dir = os.path.join(art_dir, TESTS_DIR)
 
   def enumerate_run_tests(self):
-    return sorted(
-        [run_test for \
-         run_test in os.listdir(self.art_test_dir) if re.match("^[0-9]{3,}-", run_test)])
+    return sorted([run_test
+                   for run_test in os.listdir(self.art_test_dir)
+                   if re.match("^[0-9]{3,}-", run_test)])
 
   # Is building `run_test` supported?
   # TODO(b/147814778): Add build support for more tests.
@@ -408,17 +413,17 @@
       }}
       """))
 
-  def regen_test_mapping_file(self, art_run_tests, num_presubmit_run_tests):
+  def regen_test_mapping_file(self, art_run_tests, num_presubmit_run_tests,
+                              num_mainline_presubmit_run_tests):
     """Regenerate ART's `TEST_MAPPING`."""
 
-    run_test_module_names = list(map(lambda t: "art-run-test-" + t, art_run_tests))
+    run_test_module_names = ["art-run-test-" + t for t in art_run_tests]
 
     # Mainline presubmits.
-    # TODO(rpl): Progressively add more tests to this test group.
-    mainline_presubmit_tests = [
-        "art-run-test-001-HelloWorld[com.google.android.art.apex]",
-    ]
-    mainline_presubmit_tests_dict = [{"name": t} for t in mainline_presubmit_tests]
+    mainline_presubmit_run_tests = [t + "[com.google.android.art.apex]"
+                                    for t
+                                    in run_test_module_names[0:num_mainline_presubmit_run_tests]]
+    mainline_presubmit_tests_dict = [{"name": t} for t in mainline_presubmit_run_tests]
 
     # Presubmits.
     other_presubmit_tests = [
@@ -487,21 +492,29 @@
     # Android presubmits when the whole set of supported ART run-tests
     # was included in one go (b/169310621). This progressive rollout
     # allows us to better monitor future potential presubmit failures.
+    #
+    # Likewise for tests in the `mainline-presubmit` group.
     num_presubmit_run_tests = int(len(expected_succeeding_tests) * presubmit_tests_percentage / 100)
-    self.regen_test_mapping_file(expected_succeeding_tests, num_presubmit_run_tests)
+    num_mainline_presubmit_run_tests = int(
+        len(expected_succeeding_tests) * mainline_presubmit_tests_percentage / 100)
+    self.regen_test_mapping_file(
+        expected_succeeding_tests, num_presubmit_run_tests, num_mainline_presubmit_run_tests)
 
-    expected_succeeding_tests_percentage = int(len(expected_succeeding_tests) * 100 /
-                                               len(run_tests))
+    expected_succeeding_tests_percentage = int(
+        len(expected_succeeding_tests) * 100 / len(run_tests))
 
     num_postsubmit_tests = len(expected_succeeding_tests) - num_presubmit_run_tests
     postsubmit_tests_percentage = 100 - presubmit_tests_percentage
 
     print(f"Generated TEST_MAPPING entries for {len(expected_succeeding_tests)} ART run-tests out"
           f" of {len(run_tests)} ({expected_succeeding_tests_percentage}%):")
-    print(f"  {num_presubmit_run_tests} tests ({presubmit_tests_percentage}%) in `presubmit` test"
-          f" group;")
-    print(f"  {num_postsubmit_tests} tests ({postsubmit_tests_percentage}%) in `postsubmit` test"
-          f" group.")
+    for (num_tests, tests_percentage, test_group_name) in [
+        (num_mainline_presubmit_run_tests, mainline_presubmit_tests_percentage,
+         "mainline-presubmit"),
+        (num_presubmit_run_tests, presubmit_tests_percentage, "presubmit"),
+        (num_postsubmit_tests, postsubmit_tests_percentage, "postsubmit"),
+    ]:
+      print(f"  {num_tests} tests ({tests_percentage}%) in `{test_group_name}` test group.")
 
 
 def main():