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
2bfd4d5f
Commit
2bfd4d5f
authored
Dec 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6d0aae55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+27
-19
No files found.
go/internal/xtracing/tracetest/tracetest.go
View file @
2bfd4d5f
...
...
@@ -749,56 +749,64 @@ func (t *T) fatalfInNonMain(format string, argv ...interface{}) {
runtime
.
Goexit
()
}
// T overrides FailNow/Fatal/Fatalf to also
nak
all in-progress sends.
// T overrides FailNow/Fatal/Fatalf to also
cancel
all in-progress sends.
func
(
t
*
T
)
FailNow
()
{
t
.
Helper
()
// mark streamTab no longer operational
XXX ok?
// mark streamTab no longer operational
t
.
streamTabMu
.
Lock
()
streamTab
:=
t
.
streamTab
t
.
streamTab
=
nil
t
.
streamTabMu
.
Unlock
()
type
sendInfo
struct
{
ch
Chan
;
msg
*
Msg
}
var
sendv
[]
sendInfo
for
_
,
ch
:=
range
streamTab
{
var
sendv
[]
sendInfo
// sends are pending here
var
quietv
[]
Chan
// this channels are quiet
// order channels by name
var
streams
[]
string
for
__
:=
range
streamTab
{
streams
=
append
(
streams
,
__
)
}
sort
.
Slice
(
streams
,
func
(
i
,
j
int
)
bool
{
return
strings
.
Compare
(
streams
[
i
],
streams
[
j
])
<
0
})
for
_
,
stream
:=
range
streams
{
ch
:=
streamTab
[
stream
]
// check whether someone is sending on channels without blocking.
// if yes - report to sender there is a problem - so it can cancel its task.
select
{
case
msg
:=
<-
ch
.
_rxq
()
:
sendv
=
append
(
sendv
,
sendInfo
{
ch
,
msg
})
default
:
quietv
=
append
(
quietv
,
ch
)
}
}
// order channels by name
sort
.
Slice
(
sendv
,
func
(
i
,
j
int
)
bool
{
return
strings
.
Compare
(
sendv
[
i
]
.
ch
.
name
(),
sendv
[
j
]
.
ch
.
name
())
<
0
})
bad
:=
""
if
len
(
sendv
)
==
0
{
bad
+=
fmt
.
Sprintf
(
"no
one is sending
\n
"
)
bad
+=
fmt
.
Sprintf
(
"no
pending events
\n
"
)
}
else
{
bad
+=
fmt
.
Sprintf
(
"there are %d pending sender(s) on other channel(s):
\n
"
,
len
(
sendv
))
//bad += fmt.Sprintf("the following send(s) are pending:\n"
bad
+=
fmt
.
Sprintf
(
"%d pending event(s):
\n
"
,
len
(
sendv
))
for
_
,
__
:=
range
sendv
{
bad
+=
fmt
.
Sprintf
(
"%s
\t
<- %T %v
\n
"
,
__
.
ch
.
name
(),
__
.
msg
.
Event
,
__
.
msg
.
Event
)
}
}
for
_
,
ch
:=
range
quietv
{
bad
+=
fmt
.
Sprintf
(
"# %s
\n
"
,
ch
.
name
())
}
// log the de
adlock de
tails and nak senders that we received from.
// nak them only after de
adlock printout, so that the deadlock text
//
comes first,
and their "panics" don't get intermixed with it.
// log the details and nak senders that we received from.
// nak them only after de
tails printout, so that our text comes first,
// and their "panics" don't get intermixed with it.
t
.
Log
(
bad
)
for
_
,
__
:=
range
t
.
nakq
{
__
.
msg
.
nak
(
__
.
why
)
}
for
_
,
__
:=
range
sendv
{
__
.
msg
.
nak
(
"canceled (test failed)"
)
// XXX reason can be custom / different
__
.
msg
.
nak
(
"canceled (test failed)"
)
}
// in any case close channel where future Sends may arrive so that will "panic" too.
// in any case close channel where future Sends may arrive so that
they
will "panic" too.
for
_
,
ch
:=
range
streamTab
{
ch
.
Close
()
}
...
...
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