2016-08-08 18:55:36 -04:00
|
|
|
// +build !coverage
|
|
|
|
|
|
|
|
package scenarios
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BuildV2Ray() error {
|
2016-08-09 16:13:16 -04:00
|
|
|
binaryPath := GetTestBinaryPath()
|
2016-08-08 18:55:36 -04: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 16:13:16 -04:00
|
|
|
binaryPath := GetTestBinaryPath()
|
|
|
|
proc := exec.Command(binaryPath, "-config", configFile)
|
2016-08-08 18:55:36 -04:00
|
|
|
proc.Stderr = os.Stderr
|
|
|
|
proc.Stdout = os.Stdout
|
|
|
|
|
|
|
|
return proc
|
|
|
|
}
|