Commit 6488b217 authored by Dmitry Vyukov's avatar Dmitry Vyukov

cmd/go: add tracing support

cmd/go part of tracing functionality:
https://docs.google.com/document/u/1/d/1FP5apqzBgr7ahCCgFO-yoVhk4YZrNIDNf9RybngBc14/pub
Full change:
https://codereview.appspot.com/146920043

Change-Id: If346e11b8029c475b01fbf7172ce1c88171fb1b2
Reviewed-on: https://go-review.googlesource.com/1460Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 20004ba8
...@@ -1059,6 +1059,10 @@ control the execution of any test: ...@@ -1059,6 +1059,10 @@ control the execution of any test:
-timeout t -timeout t
If a test runs longer than t, panic. If a test runs longer than t, panic.
-trace trace.out
Write an execution trace to the specified file before exiting.
Writes test binary as -c would.
-v -v
Verbose output: log all tests as they are run. Also print all Verbose output: log all tests as they are run. Also print all
text from Log and Logf calls even if the test succeeds. text from Log and Logf calls even if the test succeeds.
......
...@@ -206,6 +206,10 @@ control the execution of any test: ...@@ -206,6 +206,10 @@ control the execution of any test:
-timeout t -timeout t
If a test runs longer than t, panic. If a test runs longer than t, panic.
-trace trace.out
Write an execution trace to the specified file before exiting.
Writes test binary as -c would.
-v -v
Verbose output: log all tests as they are run. Also print all Verbose output: log all tests as they are run. Also print all
text from Log and Logf calls even if the test succeeds. text from Log and Logf calls even if the test succeeds.
......
...@@ -42,6 +42,7 @@ var usageMessage = `Usage of go test: ...@@ -42,6 +42,7 @@ var usageMessage = `Usage of go test:
-run="": passes -test.run to test -run="": passes -test.run to test
-short=false: passes -test.short to test -short=false: passes -test.short to test
-timeout=0: passes -test.timeout to test -timeout=0: passes -test.timeout to test
-trace="": passes -test.trace to test
-v=false: passes -test.v to test -v=false: passes -test.v to test
` `
...@@ -103,6 +104,7 @@ var testFlagDefn = []*testFlagSpec{ ...@@ -103,6 +104,7 @@ var testFlagDefn = []*testFlagSpec{
{name: "run", passToTest: true}, {name: "run", passToTest: true},
{name: "short", boolVar: new(bool), passToTest: true}, {name: "short", boolVar: new(bool), passToTest: true},
{name: "timeout", passToTest: true}, {name: "timeout", passToTest: true},
{name: "trace", passToTest: true},
{name: "v", boolVar: &testV, passToTest: true}, {name: "v", boolVar: &testV, passToTest: true},
} }
...@@ -192,7 +194,7 @@ func testFlags(args []string) (packageNames, passToTest []string) { ...@@ -192,7 +194,7 @@ func testFlags(args []string) (packageNames, passToTest []string) {
testBench = true testBench = true
case "timeout": case "timeout":
testTimeout = value testTimeout = value
case "blockprofile", "cpuprofile", "memprofile": case "blockprofile", "cpuprofile", "memprofile", "trace":
testProfile = true testProfile = true
testNeedBinary = true testNeedBinary = true
case "coverpkg": case "coverpkg":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment