Regres: Recursively load chunked mustpass lists
Bug: b/189334760
Change-Id: I27d8e54d20a534ffd5f7b0deb8d0c55c05baabdc
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/54588
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/tests/regres/testlist/testlist.go b/tests/regres/testlist/testlist.go
index 04c8eee..e1fabc8 100644
--- a/tests/regres/testlist/testlist.go
+++ b/tests/regres/testlist/testlist.go
@@ -50,13 +50,22 @@
// Load loads the test list file and appends all tests to the Group.
func (g *Group) Load() error {
- tests, err := ioutil.ReadFile(g.File)
+ return g.LoadFile(g.File)
+}
+
+func (g *Group) LoadFile(file string) error {
+ dir, _ := filepath.Split(file)
+ tests, err := ioutil.ReadFile(file)
if err != nil {
- return cause.Wrap(err, "Couldn't read '%s'", tests)
+ return cause.Wrap(err, "Couldn't read '%s'", file)
}
for _, line := range strings.Split(string(tests), "\n") {
line = strings.TrimSpace(line)
- if line != "" && !strings.HasPrefix(line, "#") {
+ // The test list file can contain references to other .txt files
+ // containing the individual tests.
+ if strings.HasSuffix(line, ".txt") {
+ g.LoadFile(filepath.Join(dir, line))
+ } else if line != "" && !strings.HasPrefix(line, "#") {
g.Tests = append(g.Tests, line)
}
}