Can run integration tests between different versions

This commit is contained in:
Jakob Borg 2015-01-11 09:28:45 +01:00
parent d4d391b34f
commit dbcac37d91
1 changed files with 13 additions and 1 deletions

View File

@ -57,7 +57,19 @@ func (p *syncthingProcess) start() error {
p.logfd = logfd
}
cmd := exec.Command("../bin/syncthing", p.argv...)
binary := "../bin/syncthing"
// We check to see if there's an instance specific binary we should run,
// for example if we are running integration tests between different
// versions. If there isn't, we just go with the default.
if _, err := os.Stat(binary + "-" + p.instance); err == nil {
binary = binary + "-" + p.instance
}
if _, err := os.Stat(binary + "-" + p.instance + ".exe"); err == nil {
binary = binary + "-" + p.instance + ".exe"
}
cmd := exec.Command(binary, p.argv...)
cmd.Stdout = p.logfd
cmd.Stderr = p.logfd
cmd.Env = append(os.Environ(), env...)