testplans: Add exclude_patterns field to FilePattern.
- A file matches iff it matches pattern and doesn't match any
of exclude_patterns.
- Came up in the context of only running tests for Tast
categories touched by a Tast CL, but will be general behavior
in test planner that can fit other use cases.
BUG=b:175811037
TEST=CQ
Change-Id: I389a95575a083d7cc71f34e0b033c0b8c139aad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2639938
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Commit-Queue: Andrew Lamb <andrewlamb@chromium.org>
diff --git a/go/testplans/common.pb.go b/go/testplans/common.pb.go
index 315f31b..dcf6e78 100644
--- a/go/testplans/common.pb.go
+++ b/go/testplans/common.pb.go
@@ -69,7 +69,16 @@
// **/OWNERS to match any OWNERS file
// **/*.md to match any .md file
// src/somefile.java to match a specific file
- Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ // Bash patterns that exclude files in the chromiumos checkout from a match.
+ //
+ // A file in the chromiumos checkout is considered a match iff:
+ // 1. It matches pattern.
+ // 2. It doesn't match any of exclude_patterns.
+ //
+ // The matching rules of exclude_patterns are the same as patterns, e.g.
+ // globstar is allowed.
+ ExcludePatterns []string `protobuf:"bytes,2,rep,name=exclude_patterns,json=excludePatterns,proto3" json:"exclude_patterns,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -107,6 +116,13 @@
return ""
}
+func (m *FilePattern) GetExcludePatterns() []string {
+ if m != nil {
+ return m.ExcludePatterns
+ }
+ return nil
+}
+
func init() {
proto.RegisterType((*ProtoBytes)(nil), "testplans.ProtoBytes")
proto.RegisterType((*FilePattern)(nil), "testplans.FilePattern")
@@ -115,16 +131,17 @@
func init() { proto.RegisterFile("testplans/common.proto", fileDescriptor_a516c54fffa1af30) }
var fileDescriptor_a516c54fffa1af30 = []byte{
- // 164 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2b, 0x49, 0x2d, 0x2e,
- 0x29, 0xc8, 0x49, 0xcc, 0x2b, 0xd6, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0x2b, 0x28, 0xca,
- 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x8b, 0x2b, 0x99, 0x73, 0x71, 0x05, 0x80, 0xc4, 0x9c, 0x2a, 0x4b,
- 0x52, 0x8b, 0x85, 0x34, 0xb9, 0x04, 0x8a, 0x53, 0x8b, 0x32, 0x13, 0x73, 0x32, 0xab, 0x52, 0x53,
- 0xe2, 0xc1, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0xf8, 0x11, 0xe2, 0x60, 0xf5, 0x4a,
- 0xea, 0x5c, 0xdc, 0x6e, 0x99, 0x39, 0xa9, 0x01, 0x89, 0x25, 0x25, 0xa9, 0x45, 0x79, 0x42, 0x12,
- 0x5c, 0xec, 0x05, 0x10, 0x26, 0x58, 0x03, 0x67, 0x10, 0x8c, 0xeb, 0x64, 0x1a, 0x65, 0x9c, 0x9e,
- 0xaf, 0x97, 0x9c, 0x51, 0x94, 0x9f, 0x9b, 0x59, 0x9a, 0xab, 0x97, 0x5f, 0x94, 0xae, 0x0f, 0xe3,
- 0xe4, 0x17, 0xeb, 0x67, 0xe6, 0xa5, 0x15, 0x25, 0xea, 0x83, 0x6d, 0xd2, 0x4f, 0xcf, 0xd7, 0x87,
- 0x3b, 0x2c, 0x89, 0x0d, 0x2c, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xac, 0x82, 0xc9,
- 0xc4, 0x00, 0x00, 0x00,
+ // 190 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0xcf, 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src/testplans/common.proto b/src/testplans/common.proto
index e4bc221..0f97e87 100644
--- a/src/testplans/common.proto
+++ b/src/testplans/common.proto
@@ -23,4 +23,14 @@
// **/*.md to match any .md file
// src/somefile.java to match a specific file
string pattern = 1;
+
+ // Bash patterns that exclude files in the chromiumos checkout from a match.
+ //
+ // A file in the chromiumos checkout is considered a match iff:
+ // 1. It matches pattern.
+ // 2. It doesn't match any of exclude_patterns.
+ //
+ // The matching rules of exclude_patterns are the same as patterns, e.g.
+ // globstar is allowed.
+ repeated string exclude_patterns = 2;
}