Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
aa64f2b3
Commit
aa64f2b3
authored
Dec 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ae125f96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
18 deletions
+37
-18
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+37
-18
No files found.
go/internal/xtracing/tracetest/tracetest.go
View file @
aa64f2b3
...
...
@@ -636,7 +636,6 @@ func (t *T) xget1(stream string, eventp interface{}) *Msg {
// ok
case
<-
time
.
After
(
*
deadTime
)
:
//t.deadlock(stream, eventp)
t
.
Fatalf
(
"%s: recv: deadlock waiting for %T
\n
"
,
stream
,
eventp
)
}
...
...
@@ -673,6 +672,26 @@ func (t *T) fatalfInNonMain(format string, argv ...interface{}) {
// T overrides FailNow/Fatal/Fatalf to also cancel all in-progress sends.
func
(
t
*
T
)
FailNow
()
{
t
.
Helper
()
_
=
t
.
closeStreamTab
()
t
.
TB
.
FailNow
()
}
func
(
t
*
T
)
Fatal
(
argv
...
interface
{})
{
t
.
Helper
()
t
.
Log
(
argv
...
)
t
.
FailNow
()
}
func
(
t
*
T
)
Fatalf
(
format
string
,
argv
...
interface
{})
{
t
.
Helper
()
t
.
Logf
(
format
,
argv
...
)
t
.
FailNow
()
}
// closeStreamTab prints details about pending event on streamTab, naks them
// and closes all channels. It returns the number of naked messages.
func
(
t
*
T
)
closeStreamTab
()
(
nnak
int
)
{
t
.
Helper
()
// mark streamTab no longer operational
t
.
streamTabMu
.
Lock
()
...
...
@@ -680,6 +699,10 @@ func (t *T) FailNow() {
t
.
streamTab
=
nil
t
.
streamTabMu
.
Unlock
()
if
streamTab
==
nil
{
return
// already closed
}
// print details about pending events and all streams
type
sendInfo
struct
{
ch
Chan
;
msg
*
Msg
}
var
sendv
[]
sendInfo
// sends are pending here
...
...
@@ -719,27 +742,19 @@ func (t *T) FailNow() {
t
.
Log
(
pending
)
for
_
,
__
:=
range
t
.
nakq
{
__
.
msg
.
nak
(
__
.
why
)
nnak
++
}
t
.
nakq
=
nil
for
_
,
__
:=
range
sendv
{
__
.
msg
.
nak
(
"canceled (test failed)"
)
nnak
++
}
// in any case close channel where future Sends may arrive so that they will "panic" too.
for
_
,
ch
:=
range
streamTab
{
ch
.
Close
()
}
t
.
TB
.
FailNow
()
}
func
(
t
*
T
)
Fatal
(
argv
...
interface
{})
{
t
.
Helper
()
t
.
Log
(
argv
...
)
t
.
FailNow
()
}
func
(
t
*
T
)
Fatalf
(
format
string
,
argv
...
interface
{})
{
t
.
Helper
()
t
.
Logf
(
format
,
argv
...
)
t
.
FailNow
()
return
nnak
}
...
...
@@ -759,13 +774,17 @@ func Verify(t testing.TB, f func(t *T)) {
tT
:=
&
T
{
TB
:
t
,
streamTab
:
make
(
map
[
string
]
Chan
)}
// XXX
// XXX not here
/*
// verify in the end that no events are left unchecked / unconsumed
// (e.g. sent to RxEvent, but not received). Nak them if they are ... XXX
// verify in the end that no events are left unchecked / unconsumed,
// e.g. sent to RxEvent, but not received. Nak them if they are and fail.
//
// NOTE this complements T.Fatal and friends, because a test might
// think it completes successfully, but leaves unconsumed events behind it.
defer
func
()
{
nnak
:=
tT
.
closeStreamTab
()
if
nnak
!=
0
{
t
.
Fatal
()
}
}()
*/
f
(
tT
)
...
...
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