summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TEST_MAPPING3
-rwxr-xr-xtest/utils/regen-test-files127
2 files changed, 39 insertions, 91 deletions
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 0d3b945ae2..245369ec70 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -15,11 +15,9 @@
{
"name": "ArtServiceTests"
},
- // ART gtests.
{
"name": "ArtGtestsTarget"
},
- // ART run-tests.
{
"name": "art-run-test-001-HelloWorld"
},
@@ -214,7 +212,6 @@
}
],
"postsubmit": [
- // ART run-tests.
{
"name": "art-run-test-093-serialization"
},
diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files
index 6083c629de..931aa2ccad 100755
--- a/test/utils/regen-test-files
+++ b/test/utils/regen-test-files
@@ -19,6 +19,8 @@
# This script handles only a subset of ART run-tests at the moment; additional
# cases will be added later.
+import collections
+import json
import logging
import os
import re
@@ -278,7 +280,7 @@ known_failing_tests = frozenset([
# Percentage of ART run-tests (among the ones expected to succeed) to include in
# the `presubmit` test group in `TEST_MAPPING` file -- the rest will be included
# in `postsubmit` test group.
-# Currently, this value has to be a number between 1 and 99.
+# This value has to be a number between 0 and 100.
presubmit_tests_percentage = 25
@@ -296,19 +298,6 @@ def is_checker_test(run_test):
def is_expected_succeeding(run_test):
return run_test not in known_failing_tests and not is_checker_test(run_test)
-def pretty_print_test_list(test_list, indent_level, print_trailer):
- """Helper returning a JSON representation of a list of tests suitable
- for a `TEST_MAPPING` file.
- """
- separator = ",\n"
- output = separator.join(
- map(lambda t: reindent(f"""\
- {{
- "name": "{t}"
- }}""", indent_level), test_list))
- output += separator if print_trailer else "\n"
- return output;
-
class Generator:
def __init__(self, art_dir):
@@ -422,83 +411,45 @@ class Generator:
def regen_test_mapping_file(self, art_run_tests, num_presubmit_run_tests):
"""Regenerate ART's `TEST_MAPPING`."""
- assert 0 < num_presubmit_run_tests
- assert num_presubmit_run_tests < len(art_run_tests)
+ run_test_module_names = list(map(lambda t: "art-run-test-" + t, 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]
+
+ # Presubmits.
+ other_presubmit_tests = [
+ "CtsJdwpTestCases",
+ "BootImageProfileTest",
+ "ArtServiceTests",
+ ]
+ art_gtests = [
+ "ArtGtestsTarget",
+ ]
+ presubmit_run_tests = run_test_module_names[0:num_presubmit_run_tests]
+ presubmit_tests = other_presubmit_tests + art_gtests + presubmit_run_tests
+ presubmit_tests_dict = [{"name": t} for t in presubmit_tests]
+
+ # Postsubmits.
+ postsubmit_run_tests = run_test_module_names[num_presubmit_run_tests:]
+ postsubmit_tests_dict = [{"name": t} for t in postsubmit_run_tests]
+
+ # Use an `OrderedDict` container to preserve the order in which items are inserted.
+ test_mapping_dict = collections.OrderedDict([
+ ("mainline-presubmit", mainline_presubmit_tests_dict),
+ ("presubmit", presubmit_tests_dict),
+ ("postsubmit", postsubmit_tests_dict),
+ ])
+ test_mapping_contents = json.dumps(test_mapping_dict, indent = INDENT)
test_mapping_file = os.path.join(self.art_dir, "TEST_MAPPING")
-
with open(test_mapping_file, "w") as f:
- # Prologue.
- f.write(reindent(f"""\
- // Generated by `{me}`. Do not edit manually.
- {{
- """))
-
- # 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_str = pretty_print_test_list(mainline_presubmit_tests, 2, False)
-
- f.write(reindent("""\
- "mainline-presubmit": [
- """, 1) +
- mainline_presubmit_tests_str +
- reindent("""\
- ],
- """, 1))
-
- # Presubmits.
- other_presubmit_tests = [
- "CtsJdwpTestCases",
- "BootImageProfileTest",
- "ArtServiceTests",
- ]
- other_presubmit_tests_str = pretty_print_test_list(other_presubmit_tests, 2, True)
-
- art_gtests = [
- "ArtGtestsTarget",
- ]
- art_gtests_str = pretty_print_test_list(art_gtests, 2, True)
-
- run_test_module_names = list(map(lambda t: "art-run-test-" + t, art_run_tests))
- presubmit_run_tests_str = \
- pretty_print_test_list(run_test_module_names[0:num_presubmit_run_tests], 2, False)
-
- f.write(reindent("""\
- "presubmit": [
- """, 1) +
- other_presubmit_tests_str +
- reindent("""\
- // ART gtests.
- """, 2) +
- art_gtests_str +
- reindent("""\
- // ART run-tests.
- """, 2) +
- presubmit_run_tests_str +
- reindent("""\
- ],
- """, 1))
-
- # Postsubmits.
- postsubmit_run_tests = \
- pretty_print_test_list(run_test_module_names[num_presubmit_run_tests:], 2, False)
-
- f.write(reindent("""\
- "postsubmit": [
- // ART run-tests.
- """, 1) +
- postsubmit_run_tests +
- reindent("""\
- ]
- """, 1))
-
- # Epilogue.
- f.write(reindent("""\
- }
- """))
+ f.write(f"// Generated by `{me}`. Do not edit manually.\n")
+ f.write(test_mapping_contents)
+ f.write("\n")
def regen_test_files(self):
run_tests = self.enumerate_run_tests()