1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-12 15:27:16 -05:00
v2fly/testing/scenarios/common_regular.go

33 lines
614 B
Go
Raw Normal View History

//go:build !coverage
2016-08-08 18:55:36 -04:00
// +build !coverage
package scenarios
import (
2016-12-16 15:39:00 -05:00
"bytes"
2016-11-17 18:01:37 -05:00
"fmt"
2016-08-08 18:55:36 -04:00
"os"
"os/exec"
)
func BuildV2Ray() error {
2017-03-31 11:12:33 -04:00
genTestBinaryPath()
2016-11-17 18:01:37 -05:00
if _, err := os.Stat(testBinaryPath); err == nil {
2016-08-08 18:55:36 -04:00
return nil
}
2016-11-21 18:19:51 -05:00
fmt.Printf("Building V2Ray into path (%s)\n", testBinaryPath)
cmd := exec.Command("go", "build", "-o="+testBinaryPath, GetSourcePath())
2016-08-08 18:55:36 -04:00
return cmd.Run()
}
2016-12-16 15:39:00 -05:00
func RunV2RayProtobuf(config []byte) *exec.Cmd {
2017-03-31 11:12:33 -04:00
genTestBinaryPath()
proc := exec.Command(testBinaryPath, "run", "-format=pb")
2016-12-16 15:39:00 -05:00
proc.Stdin = bytes.NewBuffer(config)
proc.Stderr = os.Stderr
proc.Stdout = os.Stdout
return proc
}