Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

test_all: allow an env parameter to set environment variables

Nick Craig-Wood7a1813c5310b
diff --git a/fstest/test_all/config.go b/fstest/test_all/config.go
index a9552b5f1..cf299c300 100644
--- a/fstest/test_all/config.go
+++ b/fstest/test_all/config.go
@@ -39,6 +39,7 @@ type Backend struct {
IgnoreTests []string // paths of tests not to run, blank for none
ListRetries int // -list-retries if > 0
ExtraTime float64 // factor to multiply the timeout by
+ Env []string // environment variables to set in form KEY=VALUE
}
// includeTest returns true if this backend should be included in this
@@ -94,6 +95,7 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) {
Ignore: ignore,
ListRetries: b.ListRetries,
ExtraTime: b.ExtraTime,
+ Env: b.Env,
}
if t.AddBackend {
run.Path = path.Join(run.Path, b.Backend)
diff --git a/fstest/test_all/run.go b/fstest/test_all/run.go
index 40560d6e5..ee1a13c98 100644
--- a/fstest/test_all/run.go
+++ b/fstest/test_all/run.go
@@ -45,8 +45,9 @@ type Run struct {
NoBinary bool // set to not build a binary
SizeLimit int64 // maximum test file size
Ignore map[string]struct{}
- ListRetries int // -list-retries if > 0
- ExtraTime float64 // multiply the timeout by this
+ ListRetries int // -list-retries if > 0
+ ExtraTime float64 // multiply the timeout by this
+ Env []string // environment variables in form KEY=VALUE
// Internals
CmdLine []string
CmdString string
@@ -252,6 +253,7 @@ func (r *Run) trial() {
cmd.Stderr = multiOut
cmd.Stdout = multiOut
cmd.Dir = r.Path
+ cmd.Env = append(os.Environ(), r.Env...)
start := time.Now()
r.err = cmd.Run()
r.output = b.Bytes()