csuite: validate test name prefixes
Add check validating all suite tests start with a known test prefix.
BUG=b:326427918
TEST=validated error thrown for missing prefix
Change-Id: I4f058950c57f8333a4d1cf05d10c08cc0948fd21
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/5318992
Reviewed-by: Brett Brotherton <bbrotherton@google.com>
Tested-by: Jack Gelinas <jackgelinas@google.com>
Commit-Queue: Jack Gelinas <jackgelinas@google.com>
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
diff --git a/src/chromiumos/test/python/src/tools/suite_set_utils.py b/src/chromiumos/test/python/src/tools/suite_set_utils.py
index a002516..5286e76 100644
--- a/src/chromiumos/test/python/src/tools/suite_set_utils.py
+++ b/src/chromiumos/test/python/src/tools/suite_set_utils.py
@@ -44,6 +44,7 @@
_CONFIG_INTERNAL_PROTO_DIR = os.path.join(
_CROS_SRC, "config-internal", "test", "suite_sets", "generated"
)
+_TEST_PREFIXES = ["tast.", "tauto.", "crosier."]
class Suite(NamedTuple):
@@ -248,6 +249,17 @@
if not suite_proto.tests:
return f"Suite must contain at least one test: {suite_str}"
+ invalid_tests = []
+ for test in suite_proto.tests:
+ test_name = test.value
+ if not any(test_name.startswith(prefix) for prefix in _TEST_PREFIXES):
+ invalid_tests.append(test_name)
+ if invalid_tests:
+ return (
+ "Follwing tests don't start with a known test prefix "
+ f"({_TEST_PREFIXES}): {invalid_tests}"
+ )
+
def _validate_suite_set(
suite_set_proto: suite_set_pb2.SuiteSet,