Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
4bce572d
Commit
4bce572d
authored
Mar 31, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re PR go/48242 (gotest needs timeout mechanism)
PR go/48242 libgo: Add timeout for tests. From-SVN: r171803
parent
c9103dde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
+35
-1
libgo/go/testing/testing.go
+24
-0
libgo/testsuite/gotest
+11
-1
No files found.
libgo/go/testing/testing.go
View file @
4bce572d
...
@@ -61,6 +61,7 @@ var (
...
@@ -61,6 +61,7 @@ var (
memProfile
=
flag
.
String
(
"test.memprofile"
,
""
,
"write a memory profile to the named file after execution"
)
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"
)
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"
)
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 seconds"
)
)
)
// Short reports whether the -test.short flag is set.
// Short reports whether the -test.short flag is set.
...
@@ -158,7 +159,9 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe
...
@@ -158,7 +159,9 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe
flag
.
Parse
()
flag
.
Parse
()
before
()
before
()
startAlarm
()
RunTests
(
matchString
,
tests
)
RunTests
(
matchString
,
tests
)
stopAlarm
()
RunBenchmarks
(
matchString
,
benchmarks
)
RunBenchmarks
(
matchString
,
benchmarks
)
after
()
after
()
}
}
...
@@ -241,3 +244,24 @@ func after() {
...
@@ -241,3 +244,24 @@ func after() {
f
.
Close
()
f
.
Close
()
}
}
}
}
var
timer
*
time
.
Timer
// startAlarm starts an alarm if requested.
func
startAlarm
()
{
if
*
timeout
>
0
{
timer
=
time
.
AfterFunc
(
*
timeout
*
1e9
,
alarm
)
}
}
// stopAlarm turns off the alarm.
func
stopAlarm
()
{
if
*
timeout
>
0
{
timer
.
Stop
()
}
}
// alarm is called if the timeout expires.
func
alarm
()
{
panic
(
"test timed out"
)
}
libgo/testsuite/gotest
View file @
4bce572d
...
@@ -32,6 +32,7 @@ loop=true
...
@@ -32,6 +32,7 @@ loop=true
keep
=
false
keep
=
false
prefix
=
prefix
=
dejagnu
=
no
dejagnu
=
no
timeout
=
60
while
$loop
;
do
while
$loop
;
do
case
"x
$1
"
in
case
"x
$1
"
in
x--srcdir
)
x--srcdir
)
...
@@ -83,6 +84,15 @@ while $loop; do
...
@@ -83,6 +84,15 @@ while $loop; do
dejagnu
=
`
echo
$1
| sed
-e
's/^--dejagnu=//'
`
dejagnu
=
`
echo
$1
| sed
-e
's/^--dejagnu=//'
`
shift
shift
;;
;;
x--timeout
)
timeout
=
$2
shift
shift
;;
x--timeout
=
*
)
timeout
=
`
echo
$1
| sed
-e
's/^--timeout=//'
`
shift
;;
x-
*
)
x-
*
)
loop
=
false
loop
=
false
;;
;;
...
@@ -357,7 +367,7 @@ case "x$dejagnu" in
...
@@ -357,7 +367,7 @@ case "x$dejagnu" in
xno
)
xno
)
${
GC
}
-g
-c
_testmain.go
${
GC
}
-g
-c
_testmain.go
${
GL
}
*
.o
${
GOLIBS
}
${
GL
}
*
.o
${
GOLIBS
}
./a.out
-test
.short
"
$@
"
./a.out
-test
.short
-test
.timeout
=
$timeout
"
$@
"
;;
;;
xyes
)
xyes
)
rm
-rf
../testsuite/
*
.o
rm
-rf
../testsuite/
*
.o
...
...
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