Merge "Exclude mcts tests from cts based on the env config." into android13-tests-dev am: b4a761670b

Original change: https://android-review.googlesource.com/c/platform/build/+/3164466

Change-Id: Iacbd646afa215fbd741a84921c81ccc548457f6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/core/base_rules.mk b/core/base_rules.mk
index ddbfe3f..893091a 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -735,6 +735,14 @@
 
 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
 
+ifeq ($(EXCLUDE_MCTS),true)
+  ifneq (,$(test_config))
+    ifneq (,$(filter mcts-%,$(LOCAL_COMPATIBILITY_SUITE)))
+      LOCAL_COMPATIBILITY_SUITE := $(filter-out cts,$(LOCAL_COMPATIBILITY_SUITE))
+    endif
+  endif
+endif
+
 # If we are building a native test or benchmark and its stem variants are not defined,
 # separate the multiple architectures into subdirectories of the testcase folder.
 arch_dir :=