testplans: introduce test group concept

The proximate need for this is to support the wifi pre-cq. For those
tests, we want to run a specific test suite, but only when some code
patterns are matched in a CQ run.

In this new way, we'll have

source_rule("chromite/**", only_test_group = ["chromite"])

test("reef", groups = ["chromite"])
test("coral", groups = ["coral"])

BUG=chromium:1062039,chromium:1012480
TEST=regen

Change-Id: I786d2218c032384134ee9a27d9307006c7cfe933
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2113138
Tested-by: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: Dhanya Ganesh <dhanyaganesh@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
diff --git a/go/testplans/source_tree_test_config.pb.go b/go/testplans/source_tree_test_config.pb.go
index fabac3c..21e1069 100644
--- a/go/testplans/source_tree_test_config.pb.go
+++ b/go/testplans/source_tree_test_config.pb.go
@@ -31,10 +31,16 @@
 	// A subset of CQ builders for which testing should be performed.
 	// If this is nonempty, hw/vm tests will *only* be done for the provided
 	// list of build targets.
-	CqOnlyTestBuilders   []*TestRestriction_OnlyTestBuilder `protobuf:"bytes,6,rep,name=cq_only_test_builders,json=cqOnlyTestBuilders,proto3" json:"cq_only_test_builders,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}                           `json:"-"`
-	XXX_unrecognized     []byte                             `json:"-"`
-	XXX_sizecache        int32                              `json:"-"`
+	// SOON TO BE DEPRECATED: this concept will be replaced with CqTestWhen
+	// rules, as below.
+	CqOnlyTestBuilders []*TestRestriction_OnlyTestBuilder `protobuf:"bytes,6,rep,name=cq_only_test_builders,json=cqOnlyTestBuilders,proto3" json:"cq_only_test_builders,omitempty"`
+	// Types that are valid to be assigned to CqTestWhen:
+	//	*TestRestriction_CqOnlyTestGroup
+	//	*TestRestriction_CqAlsoTestGroup
+	CqTestWhen           isTestRestriction_CqTestWhen `protobuf_oneof:"CqTestWhen"`
+	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
+	XXX_unrecognized     []byte                       `json:"-"`
+	XXX_sizecache        int32                        `json:"-"`
 }
 
 func (m *TestRestriction) Reset()         { *m = TestRestriction{} }
@@ -90,6 +96,51 @@
 	return nil
 }
 
+type isTestRestriction_CqTestWhen interface {
+	isTestRestriction_CqTestWhen()
+}
+
+type TestRestriction_CqOnlyTestGroup struct {
+	CqOnlyTestGroup string `protobuf:"bytes,7,opt,name=cq_only_test_group,json=cqOnlyTestGroup,proto3,oneof"`
+}
+
+type TestRestriction_CqAlsoTestGroup struct {
+	CqAlsoTestGroup string `protobuf:"bytes,8,opt,name=cq_also_test_group,json=cqAlsoTestGroup,proto3,oneof"`
+}
+
+func (*TestRestriction_CqOnlyTestGroup) isTestRestriction_CqTestWhen() {}
+
+func (*TestRestriction_CqAlsoTestGroup) isTestRestriction_CqTestWhen() {}
+
+func (m *TestRestriction) GetCqTestWhen() isTestRestriction_CqTestWhen {
+	if m != nil {
+		return m.CqTestWhen
+	}
+	return nil
+}
+
+func (m *TestRestriction) GetCqOnlyTestGroup() string {
+	if x, ok := m.GetCqTestWhen().(*TestRestriction_CqOnlyTestGroup); ok {
+		return x.CqOnlyTestGroup
+	}
+	return ""
+}
+
+func (m *TestRestriction) GetCqAlsoTestGroup() string {
+	if x, ok := m.GetCqTestWhen().(*TestRestriction_CqAlsoTestGroup); ok {
+		return x.CqAlsoTestGroup
+	}
+	return ""
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*TestRestriction) XXX_OneofWrappers() []interface{} {
+	return []interface{}{
+		(*TestRestriction_CqOnlyTestGroup)(nil),
+		(*TestRestriction_CqAlsoTestGroup)(nil),
+	}
+}
+
 type TestRestriction_OnlyTestBuilder struct {
 	BuilderName          string   `protobuf:"bytes,1,opt,name=builder_name,json=builderName,proto3" json:"builder_name,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -233,30 +284,33 @@
 }
 
 var fileDescriptor_9aed450ade7161bc = []byte{
-	// 393 bytes of a gzipped FileDescriptorProto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 0x7c, 0xca, 0x23, 0x49, 0x7c,
-	0xf3, 0x07, 0xfd, 0x58, 0xf8, 0xa7, 0x5d, 0x8b, 0x9a, 0xd1, 0xc6, 0x6f, 0x01, 0x00, 0x00, 0xff,
-	0xff, 0x7c, 0x8f, 0xb0, 0x61, 0xe5, 0x02, 0x00, 0x00,
+	// 440 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xd1, 0x8b, 0xd3, 0x40,
+	0x10, 0xc6, 0xcd, 0xb5, 0x77, 0xb6, 0xdb, 0x62, 0x6b, 0xc4, 0xd2, 0x2b, 0x3e, 0xd4, 0x22, 0x58,
+	0x04, 0x13, 0xb8, 0xea, 0x83, 0x8f, 0xf6, 0x50, 0x8f, 0x7b, 0x38, 0x25, 0x16, 0x05, 0x41, 0xc2,
+	0x36, 0x37, 0x49, 0x17, 0x36, 0x3b, 0xed, 0xce, 0xd6, 0xe3, 0xfc, 0x6f, 0xc4, 0x7f, 0x54, 0xb2,
+	0x49, 0x9b, 0x34, 0xd2, 0xc7, 0x7c, 0xf3, 0xfb, 0x66, 0xf2, 0xcd, 0x2c, 0x7b, 0x69, 0x80, 0xcc,
+	0x5a, 0x72, 0x45, 0x3e, 0xe1, 0x56, 0x47, 0x10, 0x1a, 0x0d, 0x10, 0x66, 0x6a, 0x18, 0xa1, 0x8a,
+	0x45, 0xe2, 0xad, 0x35, 0x1a, 0x74, 0xdb, 0x7b, 0x70, 0x34, 0x28, 0x3d, 0x11, 0xa6, 0x29, 0xaa,
+	0x1c, 0x99, 0xfc, 0x69, 0xb0, 0xde, 0x02, 0xc8, 0x04, 0x40, 0x46, 0x8b, 0xc8, 0x08, 0x54, 0xee,
+	0x94, 0xf5, 0x6f, 0x05, 0xf1, 0xa5, 0x84, 0x70, 0x75, 0x67, 0xdb, 0xd2, 0xd0, 0x19, 0x3b, 0xd3,
+	0x56, 0xf0, 0xa8, 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 0x95, 0xdd, 0x7c, 0x14, 0x12, 0xbe, 0xe4, 0xd5, 0xa0,
+	0x13, 0x97, 0x1f, 0xee, 0x07, 0xd6, 0xb7, 0x49, 0x74, 0xd9, 0x6e, 0x78, 0x62, 0xed, 0xa3, 0xe3,
+	0xab, 0x0d, 0x7a, 0xe6, 0x50, 0xb8, 0x6e, 0xb6, 0x9c, 0xfe, 0xc9, 0xe4, 0x37, 0x7b, 0x7c, 0xf8,
+	0x93, 0x97, 0x71, 0xe2, 0x02, 0x7b, 0xf6, 0xdf, 0x13, 0xad, 0x4e, 0x73, 0xec, 0x21, 0x5f, 0x54,
+	0xa6, 0x1d, 0x0d, 0x1a, 0x9c, 0xd3, 0xb1, 0xd2, 0xfc, 0xed, 0x8f, 0x59, 0x82, 0x5e, 0xb4, 0xd2,
+	0x98, 0x8a, 0x6d, 0xea, 0xa1, 0x4e, 0xfc, 0xdd, 0x07, 0x92, 0x2f, 0x54, 0xac, 0xb9, 0x6f, 0xdf,
+	0xbb, 0x9f, 0xa0, 0xbf, 0x9f, 0xb5, 0x3c, 0xb3, 0xda, 0xec, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff,
+	0xd8, 0x50, 0xd0, 0x58, 0x51, 0x03, 0x00, 0x00,
 }
diff --git a/go/testplans/target_test_requirements_config.pb.go b/go/testplans/target_test_requirements_config.pb.go
index a1c4d9e..99a3b6f 100644
--- a/go/testplans/target_test_requirements_config.pb.go
+++ b/go/testplans/target_test_requirements_config.pb.go
@@ -53,10 +53,16 @@
 	// Human-readable consistent name for a build target, test type pair.
 	DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
 	// Whether or not the test suite is considered critical.
-	Critical             *wrappers.BoolValue `protobuf:"bytes,2,opt,name=critical,proto3" json:"critical,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
-	XXX_unrecognized     []byte              `json:"-"`
-	XXX_sizecache        int32               `json:"-"`
+	Critical *wrappers.BoolValue `protobuf:"bytes,2,opt,name=critical,proto3" json:"critical,omitempty"`
+	// A list of groups to which this test suite belongs.
+	// This is a key into other testingconfig modules.
+	TestSuiteGroups []*TestSuiteCommon_TestSuiteGroup `protobuf:"bytes,3,rep,name=test_suite_groups,json=testSuiteGroups,proto3" json:"test_suite_groups,omitempty"`
+	// Whether this suite should be disabled by default. It will only be enabled
+	// if some other rule forces it to be put into the test plan.
+	DisableByDefault     bool     `protobuf:"varint,4,opt,name=disable_by_default,json=disableByDefault,proto3" json:"disable_by_default,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
 }
 
 func (m *TestSuiteCommon) Reset()         { *m = TestSuiteCommon{} }
@@ -98,6 +104,59 @@
 	return nil
 }
 
+func (m *TestSuiteCommon) GetTestSuiteGroups() []*TestSuiteCommon_TestSuiteGroup {
+	if m != nil {
+		return m.TestSuiteGroups
+	}
+	return nil
+}
+
+func (m *TestSuiteCommon) GetDisableByDefault() bool {
+	if m != nil {
+		return m.DisableByDefault
+	}
+	return false
+}
+
+type TestSuiteCommon_TestSuiteGroup struct {
+	TestSuiteGroup       string   `protobuf:"bytes,1,opt,name=test_suite_group,json=testSuiteGroup,proto3" json:"test_suite_group,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *TestSuiteCommon_TestSuiteGroup) Reset()         { *m = TestSuiteCommon_TestSuiteGroup{} }
+func (m *TestSuiteCommon_TestSuiteGroup) String() string { return proto.CompactTextString(m) }
+func (*TestSuiteCommon_TestSuiteGroup) ProtoMessage()    {}
+func (*TestSuiteCommon_TestSuiteGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_4af54ecd79c6f0f9, []int{0, 0}
+}
+
+func (m *TestSuiteCommon_TestSuiteGroup) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_TestSuiteCommon_TestSuiteGroup.Unmarshal(m, b)
+}
+func (m *TestSuiteCommon_TestSuiteGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_TestSuiteCommon_TestSuiteGroup.Marshal(b, m, deterministic)
+}
+func (m *TestSuiteCommon_TestSuiteGroup) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_TestSuiteCommon_TestSuiteGroup.Merge(m, src)
+}
+func (m *TestSuiteCommon_TestSuiteGroup) XXX_Size() int {
+	return xxx_messageInfo_TestSuiteCommon_TestSuiteGroup.Size(m)
+}
+func (m *TestSuiteCommon_TestSuiteGroup) XXX_DiscardUnknown() {
+	xxx_messageInfo_TestSuiteCommon_TestSuiteGroup.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_TestSuiteCommon_TestSuiteGroup proto.InternalMessageInfo
+
+func (m *TestSuiteCommon_TestSuiteGroup) GetTestSuiteGroup() string {
+	if m != nil {
+		return m.TestSuiteGroup
+	}
+	return ""
+}
+
 type HwTestCfg struct {
 	HwTest               []*HwTestCfg_HwTest `protobuf:"bytes,1,rep,name=hw_test,json=hwTest,proto3" json:"hw_test,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
@@ -724,6 +783,7 @@
 func init() {
 	proto.RegisterEnum("testplans.HwTestCfg_HwTestSuiteType", HwTestCfg_HwTestSuiteType_name, HwTestCfg_HwTestSuiteType_value)
 	proto.RegisterType((*TestSuiteCommon)(nil), "testplans.TestSuiteCommon")
+	proto.RegisterType((*TestSuiteCommon_TestSuiteGroup)(nil), "testplans.TestSuiteCommon.TestSuiteGroup")
 	proto.RegisterType((*HwTestCfg)(nil), "testplans.HwTestCfg")
 	proto.RegisterType((*HwTestCfg_HwTest)(nil), "testplans.HwTestCfg.HwTest")
 	proto.RegisterType((*MoblabVmTestCfg)(nil), "testplans.MoblabVmTestCfg")
@@ -743,57 +803,62 @@
 }
 
 var fileDescriptor_4af54ecd79c6f0f9 = []byte{
-	// 830 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcd, 0x8e, 0xe3, 0x44,
-	0x10, 0x5e, 0x27, 0xd9, 0x8c, 0x5d, 0xce, 0x9f, 0xcc, 0x4a, 0x24, 0x59, 0x58, 0x05, 0x2f, 0x48,
-	0x91, 0x90, 0x1c, 0x29, 0x1b, 0xb8, 0x4f, 0x42, 0x96, 0x99, 0x41, 0x3b, 0x0c, 0x8e, 0x67, 0x11,
-	0x5c, 0x2c, 0xc7, 0xe9, 0x38, 0x16, 0x76, 0xda, 0xb4, 0x3b, 0x33, 0x93, 0x2b, 0x8f, 0x83, 0xc4,
-	0x85, 0x13, 0x27, 0x1e, 0x81, 0x77, 0xe0, 0x4d, 0x90, 0xbb, 0x3b, 0x76, 0x27, 0x99, 0xc0, 0x70,
-	0x72, 0xf7, 0xd7, 0x55, 0x5d, 0x5f, 0x7d, 0xd5, 0x55, 0x86, 0x01, 0x45, 0x29, 0x4d, 0x22, 0x6f,
-	0x9d, 0x0e, 0xa8, 0x47, 0x02, 0x44, 0xdd, 0x0c, 0x70, 0x09, 0xfa, 0x79, 0x13, 0x12, 0x14, 0xa3,
-	0x35, 0x4d, 0x5d, 0x1f, 0xaf, 0x97, 0x61, 0x60, 0x25, 0x04, 0x53, 0x6c, 0x68, 0xb9, 0x43, 0xf7,
-	0x55, 0x80, 0x71, 0x10, 0xa1, 0x01, 0x3b, 0x98, 0x6f, 0x96, 0x83, 0x7b, 0xe2, 0x25, 0x09, 0x22,
-	0x29, 0x37, 0x35, 0x23, 0x68, 0x3a, 0x28, 0xa5, 0xb3, 0x4d, 0x48, 0xd1, 0x04, 0xc7, 0x31, 0x5e,
-	0x1b, 0x9f, 0x40, 0x6d, 0x11, 0xa6, 0x49, 0xe4, 0x6d, 0xdd, 0xb5, 0x17, 0xa3, 0xb6, 0xd2, 0x53,
-	0xfa, 0x9a, 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xa1, 0x25, 0x77, 0x15,
-	0x73, 0xad, 0x32, 0xd7, 0xf6, 0xa9, 0x17, 0x68, 0xd7, 0xe9, 0x5e, 0x63, 0x5e, 0xc3, 0x87, 0x8b,
-	0x90, 0x20, 0x9f, 0xba, 0x47, 0x37, 0x9d, 0xfd, 0xc7, 0x4d, 0x1f, 0x70, 0xc7, 0x3d, 0x50, 0x0c,
-	0x80, 0x5f, 0x14, 0xe8, 0x3c, 0x5e, 0xac, 0x2c, 0x26, 0x82, 0x8f, 0x12, 0x44, 0xdc, 0x53, 0x7f,
-	0x42, 0xf1, 0xd4, 0xe5, 0x89, 0x7c, 0xb2, 0xf6, 0x76, 0x27, 0x39, 0x75, 0x34, 0xfe, 0xe2, 0xc7,
-	0x37, 0x01, 0xb6, 0xfc, 0x15, 0xc1, 0x71, 0xb8, 0x89, 0x2d, 0x4c, 0x82, 0xc1, 0x6e, 0x83, 0xd3,
-	0x41, 0xb8, 0x5e, 0x12, 0x8f, 0xff, 0x54, 0x07, 0x01, 0x2e, 0x7e, 0xd0, 0xf3, 0x2a, 0xc3, 0xde,
-	0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x55, 0x31, 0x94, 0xb4, 0x07, 0x00, 0x00,
+	// 908 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4f, 0x8f, 0xdb, 0x44,
+	0x14, 0xaf, 0x93, 0x34, 0x6b, 0x3f, 0x67, 0x13, 0x33, 0x54, 0xc2, 0x9b, 0x42, 0x15, 0x5c, 0x90,
+	0x82, 0x40, 0x89, 0x94, 0x2e, 0x1c, 0xb8, 0x6d, 0xb6, 0x69, 0x77, 0x17, 0x75, 0x59, 0x1c, 0xa7,
+	0x08, 0x2e, 0x96, 0xed, 0x4c, 0x1c, 0x0b, 0x3b, 0x36, 0xe3, 0xc9, 0x6e, 0x73, 0xe5, 0xe3, 0x20,
+	0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,
+	0xee, 0x5d, 0x5f, 0xc4, 0x2a, 0xb7, 0x79, 0xd4, 0x19, 0x68, 0xe5, 0xae, 0x62, 0xa1, 0x4d, 0x16,
+	0xaa, 0x1f, 0x7a, 0x81, 0xe6, 0x31, 0xad, 0x34, 0xe6, 0x35, 0x7c, 0x34, 0x0f, 0x08, 0xf6, 0xa8,
+	0xbd, 0x77, 0xd2, 0xd1, 0xff, 0x9c, 0xf4, 0x21, 0x0f, 0xac, 0x80, 0x62, 0x00, 0xfc, 0x26, 0xc1,
+	0xc9, 0xbb, 0x8b, 0x95, 0xdd, 0x89, 0xe1, 0xe3, 0x04, 0x13, 0xfb, 0xd0, 0x7f, 0xb9, 0x78, 0xea,
+	0xe5, 0x89, 0x7c, 0xb0, 0xf6, 0xe6, 0x49, 0x72, 0x68, 0x6b, 0xfc, 0xf5, 0xcf, 0xcf, 0xfc, 0x78,
+	0xe0, 0x2d, 0x49, 0x1c, 0x05, 0xeb, 0x68, 0x10, 0x13, 0x7f, 0xb8, 0x35, 0xe2, 0x74, 0x18, 0xac,
+	0x16, 0xc4, 0xe1, 0x9f, 0x05, 0x43, 0x3f, 0x2e, 0x3e, 0x31, 0xdc, 0x26, 0xc3, 0x9e, 0xfd, 0x1b,
+	0x00, 0x00, 0xff, 0xff, 0xb5, 0x30, 0xb7, 0x83, 0x76, 0x08, 0x00, 0x00,
 }
diff --git a/src/testplans/source_tree_test_config.proto b/src/testplans/source_tree_test_config.proto
index e12a12b..ec73129 100644
--- a/src/testplans/source_tree_test_config.proto
+++ b/src/testplans/source_tree_test_config.proto
@@ -26,8 +26,21 @@
   // A subset of CQ builders for which testing should be performed.
   // If this is nonempty, hw/vm tests will *only* be done for the provided
   // list of build targets.
+  // SOON TO BE DEPRECATED: this concept will be replaced with CqTestWhen
+  // rules, as below.
   repeated OnlyTestBuilder cq_only_test_builders = 6;
 
+  oneof CqTestWhen {
+    // Indicates a set of test suites to run, to the exclusion of all others.
+    // This is a key into target_test_requirements.
+    string cq_only_test_group = 7;
+
+    // Indicates a set of test suites that should also be run, especially
+    // if they're suites that wouldn't be run by default.
+    // This is a key into target_test_requirements.
+    string cq_also_test_group = 8;
+  }
+
   reserved 4;
 }
 
diff --git a/src/testplans/target_test_requirements_config.proto b/src/testplans/target_test_requirements_config.proto
index 875d1ba..7c3bedc 100644
--- a/src/testplans/target_test_requirements_config.proto
+++ b/src/testplans/target_test_requirements_config.proto
@@ -16,6 +16,17 @@
 
   // Whether or not the test suite is considered critical.
   google.protobuf.BoolValue critical = 2;
+
+  message TestSuiteGroup {
+    string test_suite_group = 1;
+  }
+  // A list of groups to which this test suite belongs.
+  // This is a key into other testingconfig modules.
+  repeated TestSuiteGroup test_suite_groups = 3;
+
+  // Whether this suite should be disabled by default. It will only be enabled
+  // if some other rule forces it to be put into the test plan.
+  bool disable_by_default = 4;
 }
 
 message HwTestCfg {