[test.go] Add -extra-args flag to pass args to each test.

This commit is contained in:
Anthony Yeh 2015-06-04 15:54:29 -07:00
Родитель e755930b73
Коммит e7feb071ba
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -43,6 +43,8 @@ var (
retryMax = flag.Int("retry", 3, "max number of retries, to detect flaky tests") retryMax = flag.Int("retry", 3, "max number of retries, to detect flaky tests")
logPass = flag.Bool("log-pass", false, "log test output even if it passes") logPass = flag.Bool("log-pass", false, "log test output even if it passes")
timeout = flag.Duration("timeout", 10*time.Minute, "timeout for each test") timeout = flag.Duration("timeout", 10*time.Minute, "timeout for each test")
extraArgs = flag.String("extra-args", "", "extra args to pass to each test")
) )
// Config is the overall object serialized in test/config.json. // Config is the overall object serialized in test/config.json.
@ -62,6 +64,9 @@ type Test struct {
func (t *Test) run(dir string) error { func (t *Test) run(dir string) error {
// Teardown is unnecessary since Docker kills everything. // Teardown is unnecessary since Docker kills everything.
testCmd := fmt.Sprintf("make build && test/%s -v --skip-teardown %s", t.File, t.Args) testCmd := fmt.Sprintf("make build && test/%s -v --skip-teardown %s", t.File, t.Args)
if *extraArgs != "" {
testCmd += " " + *extraArgs
}
dockerCmd := exec.Command(path.Join(dir, "docker/test/run.sh"), *flavor, testCmd) dockerCmd := exec.Command(path.Join(dir, "docker/test/run.sh"), *flavor, testCmd)
dockerCmd.Dir = dir dockerCmd.Dir = dir
t.cmd = dockerCmd t.cmd = dockerCmd