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:
@@ -39,6 +39,7 @@ type Backend struct {
|
|||||||
IgnoreTests []string // paths of tests not to run, blank for none
|
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
|
||||||
|
Env []string // environment variables to set in form KEY=VALUE
|
||||||
}
|
}
|
||||||
|
|
||||||
// includeTest returns true if this backend should be included in this
|
// 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,
|
Ignore: ignore,
|
||||||
ListRetries: b.ListRetries,
|
ListRetries: b.ListRetries,
|
||||||
ExtraTime: b.ExtraTime,
|
ExtraTime: b.ExtraTime,
|
||||||
|
Env: b.Env,
|
||||||
}
|
}
|
||||||
if t.AddBackend {
|
if t.AddBackend {
|
||||||
run.Path = path.Join(run.Path, b.Backend)
|
run.Path = path.Join(run.Path, b.Backend)
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ type Run struct {
|
|||||||
NoBinary bool // set to not build a binary
|
NoBinary bool // set to not build a binary
|
||||||
SizeLimit int64 // maximum test file size
|
SizeLimit int64 // maximum test file size
|
||||||
Ignore map[string]struct{}
|
Ignore map[string]struct{}
|
||||||
ListRetries int // -list-retries if > 0
|
ListRetries int // -list-retries if > 0
|
||||||
ExtraTime float64 // multiply the timeout by this
|
ExtraTime float64 // multiply the timeout by this
|
||||||
|
Env []string // environment variables in form KEY=VALUE
|
||||||
// Internals
|
// Internals
|
||||||
CmdLine []string
|
CmdLine []string
|
||||||
CmdString string
|
CmdString string
|
||||||
@@ -252,6 +253,7 @@ func (r *Run) trial() {
|
|||||||
cmd.Stderr = multiOut
|
cmd.Stderr = multiOut
|
||||||
cmd.Stdout = multiOut
|
cmd.Stdout = multiOut
|
||||||
cmd.Dir = r.Path
|
cmd.Dir = r.Path
|
||||||
|
cmd.Env = append(os.Environ(), r.Env...)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
r.err = cmd.Run()
|
r.err = cmd.Run()
|
||||||
r.output = b.Bytes()
|
r.output = b.Bytes()
|
||||||
|
|||||||
Reference in New Issue
Block a user