test_all: add ignoretests parameter for skipping certain tests

Use like this for a `backend:` in `config.yaml`

   ignoretests:
     - "fs/operations"
     - "fs/sync"
This commit is contained in:
Nick Craig-Wood 2024-09-25 15:47:30 +01:00
parent cb9f4f8461
commit 84cebb6872

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"slices"
"github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
@ -35,6 +36,7 @@ type Backend struct {
CleanUp bool // when running clean, run cleanup first CleanUp bool // when running clean, run cleanup first
Ignore []string // test names to ignore the failure of Ignore []string // test names to ignore the failure of
Tests []string // paths of tests to run, blank for all Tests []string // paths of tests to run, blank for all
IgnoreTests []string // paths of tests not to run, blank for none
ListRetries int // -list-retries if > 0 ListRetries int // -list-retries if > 0
ExtraTime float64 // factor to multiply the timeout by ExtraTime float64 // factor to multiply the timeout by
} }
@ -42,15 +44,15 @@ type Backend struct {
// includeTest returns true if this backend should be included in this // includeTest returns true if this backend should be included in this
// test // test
func (b *Backend) includeTest(t *Test) bool { func (b *Backend) includeTest(t *Test) bool {
// Is this test ignored
if slices.Contains(b.IgnoreTests, t.Path) {
return false
}
// Empty b.Tests imples do all of them except the ignored
if len(b.Tests) == 0 { if len(b.Tests) == 0 {
return true return true
} }
for _, testPath := range b.Tests { return slices.Contains(b.Tests, t.Path)
if testPath == t.Path {
return true
}
}
return false
} }
// MakeRuns creates Run objects the Backend and Test // MakeRuns creates Run objects the Backend and Test