2016-08-08 22:55:36 +00:00
|
|
|
// +build !coverage
|
|
|
|
|
|
|
|
package scenarios
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BuildV2Ray() error {
|
2016-08-09 20:13:16 +00:00
|
|
|
binaryPath := GetTestBinaryPath()
|
2016-08-08 22:55:36 +00:00
|
|
|
if _, err := os.Stat(binaryPath); err == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := exec.Command("go", "build", "-tags=json", "-o="+binaryPath, GetSourcePath())
|
|
|
|
return cmd.Run()
|
|
|
|
}
|
|
|
|
|
|
|
|
func RunV2Ray(configFile string) *exec.Cmd {
|
2016-08-09 20:13:16 +00:00
|
|
|
binaryPath := GetTestBinaryPath()
|
|
|
|
proc := exec.Command(binaryPath, "-config", configFile)
|
2016-08-08 22:55:36 +00:00
|
|
|
proc.Stderr = os.Stderr
|
|
|
|
proc.Stdout = os.Stdout
|
|
|
|
|
|
|
|
return proc
|
|
|
|
}
|