Prevent performance modules in xTS

Bug: 292249899
Test: Unit tests
Change-Id: Ib2652b67a03855513e260c46f00137ec4d5b2c91
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/loading/CommonConfigLoadingTest.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/loading/CommonConfigLoadingTest.java
index 36ee734..b6fdd04 100644
--- a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/loading/CommonConfigLoadingTest.java
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/loading/CommonConfigLoadingTest.java
@@ -66,6 +66,8 @@
 public class CommonConfigLoadingTest {
 
     private static final Pattern TODO_BUG_PATTERN = Pattern.compile(".*TODO\\(b/[0-9]+\\).*", Pattern.DOTALL);
+    private static final String TEST_TYPE_KEY = "test-type";
+    private static final String TEST_TYPE_VALUE_PERFORMANCE = "performance";
 
     /**
      * List of the officially supported runners in CTS, they meet all the interfaces criteria as
@@ -253,6 +255,14 @@
             }
             // Ensure options have been set
             c.validateOptions();
+
+            // Check that no performance test module is included
+            List<String> testTypes = cd.getMetaData(TEST_TYPE_KEY);
+            if (testTypes != null && testTypes.contains(TEST_TYPE_VALUE_PERFORMANCE)) {
+                throw new ConfigurationException(
+                        String.format("config: %s. Performance test modules are not allowed in xTS",
+                                config.getName()));
+            }
         }
     }