Commit d9bf68cc by Nicolas Capens Committed by Nicolas Capens

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: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 5d449d4f
...@@ -50,13 +50,22 @@ type Group struct { ...@@ -50,13 +50,22 @@ type Group struct {
// Load loads the test list file and appends all tests to the Group. // Load loads the test list file and appends all tests to the Group.
func (g *Group) Load() error { 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 { 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") { for _, line := range strings.Split(string(tests), "\n") {
line = strings.TrimSpace(line) 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) g.Tests = append(g.Tests, line)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment