fstest/test_all: add oneonly flag to only run one test per backend if required
This commit is contained in:
parent
f97c4c8d9d
commit
1bfd07567e
3 changed files with 22 additions and 0 deletions
|
@ -28,6 +28,7 @@ type Backend struct {
|
||||||
Remote string // name of the test remote
|
Remote string // name of the test remote
|
||||||
SubDir bool // set to test with -sub-dir
|
SubDir bool // set to test with -sub-dir
|
||||||
FastList bool // set to test with -fast-list
|
FastList bool // set to test with -fast-list
|
||||||
|
OneOnly bool // set to run only one backend test at once
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeRuns creates Run objects the Backend and Test
|
// MakeRuns creates Run objects the Backend and Test
|
||||||
|
@ -52,6 +53,7 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) {
|
||||||
SubDir: subdir,
|
SubDir: subdir,
|
||||||
FastList: fastlist,
|
FastList: fastlist,
|
||||||
NoRetries: t.NoRetries,
|
NoRetries: t.NoRetries,
|
||||||
|
OneOnly: b.OneOnly,
|
||||||
}
|
}
|
||||||
if t.AddBackend {
|
if t.AddBackend {
|
||||||
run.Path = path.Join(run.Path, b.Backend)
|
run.Path = path.Join(run.Path, b.Backend)
|
||||||
|
|
|
@ -77,6 +77,7 @@ backends:
|
||||||
remote: "TestQingStor:"
|
remote: "TestQingStor:"
|
||||||
subdir: false
|
subdir: false
|
||||||
fastlist: false
|
fastlist: false
|
||||||
|
oneonly: true
|
||||||
- backend: "azureblob"
|
- backend: "azureblob"
|
||||||
remote: "TestAzureBlob:"
|
remote: "TestAzureBlob:"
|
||||||
subdir: true
|
subdir: true
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ncw/rclone/fs"
|
"github.com/ncw/rclone/fs"
|
||||||
|
@ -21,6 +22,12 @@ import (
|
||||||
|
|
||||||
const testBase = "github.com/ncw/rclone/"
|
const testBase = "github.com/ncw/rclone/"
|
||||||
|
|
||||||
|
// Control concurrency per backend if required
|
||||||
|
var (
|
||||||
|
oneOnlyMu sync.Mutex
|
||||||
|
oneOnly = map[string]*sync.Mutex{}
|
||||||
|
)
|
||||||
|
|
||||||
// Run holds info about a running test
|
// Run holds info about a running test
|
||||||
//
|
//
|
||||||
// A run just runs one command line, but it can be run multiple times
|
// A run just runs one command line, but it can be run multiple times
|
||||||
|
@ -33,6 +40,7 @@ type Run struct {
|
||||||
SubDir bool // add -sub-dir to tests
|
SubDir bool // add -sub-dir to tests
|
||||||
FastList bool // add -fast-list to tests
|
FastList bool // add -fast-list to tests
|
||||||
NoRetries bool // don't retry if set
|
NoRetries bool // don't retry if set
|
||||||
|
OneOnly bool // only run test for this backend at once
|
||||||
// Internals
|
// Internals
|
||||||
cmdLine []string
|
cmdLine []string
|
||||||
cmdString string
|
cmdString string
|
||||||
|
@ -300,6 +308,17 @@ func (r *Run) FailedTests() string {
|
||||||
|
|
||||||
// Run runs all the trials for this test
|
// Run runs all the trials for this test
|
||||||
func (r *Run) Run(logDir string, result chan<- *Run) {
|
func (r *Run) Run(logDir string, result chan<- *Run) {
|
||||||
|
if r.OneOnly {
|
||||||
|
oneOnlyMu.Lock()
|
||||||
|
mu := oneOnly[r.Backend]
|
||||||
|
if mu == nil {
|
||||||
|
mu = new(sync.Mutex)
|
||||||
|
oneOnly[r.Backend] = mu
|
||||||
|
}
|
||||||
|
oneOnlyMu.Unlock()
|
||||||
|
mu.Lock()
|
||||||
|
defer mu.Unlock()
|
||||||
|
}
|
||||||
r.Init()
|
r.Init()
|
||||||
r.logDir = logDir
|
r.logDir = logDir
|
||||||
for r.try = 1; r.try <= *maxTries; r.try++ {
|
for r.try = 1; r.try <= *maxTries; r.try++ {
|
||||||
|
|
Loading…
Add table
Reference in a new issue