Do not produce an entry for a Test Mapping test group if it is empty.

Test: Set `presubmit_tests_percentage` in
      `art/test/utils/regen-test-files` and check the generated
      `TEST_MAPPING` output
Bug: 152374989
Change-Id: I62431dbbfd65d02067d8fd24f137a5cd0a5ca0ce
diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files
index fe4534a..01cd0ee 100755
--- a/test/utils/regen-test-files
+++ b/test/utils/regen-test-files
@@ -558,10 +558,16 @@
     postsubmit_tests_dict = [{"name": t} for t in postsubmit_run_tests]
 
     # Use an `OrderedDict` container to preserve the order in which items are inserted.
+    # Do not produce an entry for a test group if it is empty.
     test_mapping_dict = collections.OrderedDict([
-        ("mainline-presubmit", mainline_presubmit_tests_dict),
-        ("presubmit", presubmit_tests_dict),
-        ("postsubmit", postsubmit_tests_dict),
+        (test_group_name, test_group_dict)
+        for (test_group_name, test_group_dict)
+        in [
+            ("mainline-presubmit", mainline_presubmit_tests_dict),
+            ("presubmit", presubmit_tests_dict),
+            ("postsubmit", postsubmit_tests_dict),
+        ]
+        if test_group_dict
     ])
     test_mapping_contents = json.dumps(test_mapping_dict, indent = INDENT)