Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
57c9bb4a
Commit
57c9bb4a
authored
Dec 25, 2011
by
David Symonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing: use flag.Duration for -timeout flag.
R=golang-dev, gustavo, r CC=golang-dev
https://golang.org/cl/5498077
parent
d5e45e3a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
Make.pkg
src/Make.pkg
+1
-1
test.go
src/cmd/go/test.go
+2
-2
doc.go
src/cmd/gotest/doc.go
+2
-2
testing.go
src/pkg/testing/testing.go
+2
-2
No files found.
src/Make.pkg
View file @
57c9bb4a
...
...
@@ -65,7 +65,7 @@ test:
gotest
testshort:
gotest -test.short -test.timeout=
120
gotest -test.short -test.timeout=
2m
bench:
gotest -test.bench=. -test.run="Do not run tests"
...
...
src/cmd/go/test.go
View file @
57c9bb4a
...
...
@@ -118,8 +118,8 @@ The resulting test binary, called test.out, has its own flags:
the Go tree can run a sanity check but not spend time running
exhaustive tests.
-test.timeout
n
If a test runs longer than
n seconds
, panic.
-test.timeout
t
If a test runs longer than
t
, panic.
-test.benchtime n
Run enough iterations of each benchmark to take n seconds.
...
...
src/cmd/gotest/doc.go
View file @
57c9bb4a
...
...
@@ -75,7 +75,7 @@ Usage:
[-test.cpuprofile=cpu.out] \
[-test.memprofile=mem.out] [-test.memprofilerate=1] \
[-test.parallel=$GOMAXPROCS] \
[-test.timeout=10] [-test.short] \
[-test.timeout=10
s
] [-test.short] \
[-test.benchtime=3] [-test.cpu=1,2,3,4]
The -test.v flag causes the tests to be logged as they run. The
...
...
@@ -117,7 +117,7 @@ time. It is off by default but set by all.bash so installations of
the Go tree can do a sanity check but not spend time running
exhaustive tests.
The -test.timeout flag sets a timeout for the test
in seconds
. If the
The -test.timeout flag sets a timeout for the test. If the
test runs for longer than that, it will panic, dumping a stack trace
of all existing goroutines.
...
...
src/pkg/testing/testing.go
View file @
57c9bb4a
...
...
@@ -63,7 +63,7 @@ var (
memProfile
=
flag
.
String
(
"test.memprofile"
,
""
,
"write a memory profile to the named file after execution"
)
memProfileRate
=
flag
.
Int
(
"test.memprofilerate"
,
0
,
"if >=0, sets runtime.MemProfileRate"
)
cpuProfile
=
flag
.
String
(
"test.cpuprofile"
,
""
,
"write a cpu profile to the named file during execution"
)
timeout
=
flag
.
Int64
(
"test.timeout"
,
0
,
"if > 0, sets time limit for tests in second
s"
)
timeout
=
flag
.
Duration
(
"test.timeout"
,
0
,
"if positive, sets an aggregate time limit for all test
s"
)
cpuListStr
=
flag
.
String
(
"test.cpu"
,
""
,
"comma-separated list of number of CPUs to use for each test"
)
parallel
=
flag
.
Int
(
"test.parallel"
,
runtime
.
GOMAXPROCS
(
0
),
"maximum test parallelism"
)
...
...
@@ -346,7 +346,7 @@ var timer *time.Timer
// startAlarm starts an alarm if requested.
func
startAlarm
()
{
if
*
timeout
>
0
{
timer
=
time
.
AfterFunc
(
time
.
Duration
(
*
timeout
)
*
time
.
Second
,
alarm
)
timer
=
time
.
AfterFunc
(
*
timeout
,
alarm
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment