mirror of
https://github.com/rclone/rclone.git
synced 2025-01-11 00:40:03 +01:00
fstest/test_all: adapt to nested test definitions
This commit is contained in:
parent
1bfd07567e
commit
fbab1e55bb
@ -98,15 +98,30 @@ func (r *Run) dumpOutput() {
|
|||||||
log.Println("------------------------------------------------------------")
|
log.Println("------------------------------------------------------------")
|
||||||
}
|
}
|
||||||
|
|
||||||
var failRe = regexp.MustCompile(`(?m)^--- FAIL: (Test\w*) \(`)
|
var failRe = regexp.MustCompile(`(?m)^\s*--- FAIL: (Test.*?) \(`)
|
||||||
|
|
||||||
// findFailures looks for all the tests which failed
|
// findFailures looks for all the tests which failed
|
||||||
func (r *Run) findFailures() {
|
func (r *Run) findFailures() {
|
||||||
oldFailedTests := r.failedTests
|
oldFailedTests := r.failedTests
|
||||||
r.failedTests = nil
|
r.failedTests = nil
|
||||||
|
excludeParents := map[string]struct{}{}
|
||||||
for _, matches := range failRe.FindAllSubmatch(r.output, -1) {
|
for _, matches := range failRe.FindAllSubmatch(r.output, -1) {
|
||||||
r.failedTests = append(r.failedTests, string(matches[1]))
|
failedTest := string(matches[1])
|
||||||
|
r.failedTests = append(r.failedTests, failedTest)
|
||||||
|
// Find all the parents of this test
|
||||||
|
parts := strings.Split(failedTest, "/")
|
||||||
|
for i := len(parts) - 1; i >= 1; i-- {
|
||||||
|
excludeParents[strings.Join(parts[:i], "/")] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Exclude the parents
|
||||||
|
var newTests = r.failedTests[:0]
|
||||||
|
for _, failedTest := range r.failedTests {
|
||||||
|
if _, excluded := excludeParents[failedTest]; !excluded {
|
||||||
|
newTests = append(newTests, failedTest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r.failedTests = newTests
|
||||||
if len(r.failedTests) != 0 {
|
if len(r.failedTests) != 0 {
|
||||||
r.runFlag = "^(" + strings.Join(r.failedTests, "|") + ")$"
|
r.runFlag = "^(" + strings.Join(r.failedTests, "|") + ")$"
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user