mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-06-29 02:35:23 +00:00
30 lines
644 B
Go
30 lines
644 B
Go
|
// +build coverage
|
||
|
|
||
|
package scenarios
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/exec"
|
||
|
)
|
||
|
|
||
|
func BuildV2Ray() error {
|
||
|
if _, err := os.Stat(binaryPath); err == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
if err := FillBinaryPath(); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
cmd := exec.Command("go", "test", "-tags", "json coverage coveragemain", "-coverpkg", "github.com/v2ray/v2ray-core/...", "-c", "-o", binaryPath, GetSourcePath())
|
||
|
return cmd.Run()
|
||
|
}
|
||
|
|
||
|
func RunV2Ray(configFile string) *exec.Cmd {
|
||
|
proc := exec.Command(binaryPath, "-config="+configFile, "-test.run=TestRunMainForCoverage", "-test.coverprofile=coversingle.out")
|
||
|
proc.Stderr = os.Stderr
|
||
|
proc.Stdout = os.Stdout
|
||
|
|
||
|
return proc
|
||
|
}
|