1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

test_all: allow an env parameter to set environment variables

This commit is contained in:
Nick Craig-Wood
2025-06-28 10:55:48 +01:00
parent 16e3d1becd
commit 7a1813c531
2 changed files with 6 additions and 2 deletions

View File

@@ -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)

View File

@@ -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()