"math"
"math/big"
"os"
- "os/exec"
"regexp"
"runtime"
"runtime/debug"
func testCPUProfile(t *testing.T, matches profileMatchFunc, f func(dur time.Duration)) *profile.Profile {
switch runtime.GOOS {
case "darwin":
- out, err := exec.Command("uname", "-a").CombinedOutput()
+ out, err := testenv.Command(t, "uname", "-a").CombinedOutput()
if err != nil {
t.Fatal(err)
}
func TestCPUProfileWithFork(t *testing.T) {
testenv.MustHaveExec(t)
+ exe, err := os.Executable()
+ if err != nil {
+ t.Fatal(err)
+ }
+
heap := 1 << 30
if runtime.GOOS == "android" {
// Use smaller size for Android to avoid crash.
defer StopCPUProfile()
for i := 0; i < 10; i++ {
- exec.Command(os.Args[0], "-h").CombinedOutput()
+ testenv.Command(t, exe, "-h").CombinedOutput()
}
}