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
ae125f96
Commit
ae125f96
authored
Dec 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
99931c46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
66 deletions
+4
-66
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+4
-66
No files found.
go/internal/xtracing/tracetest/tracetest.go
View file @
ae125f96
...
@@ -530,7 +530,7 @@ func (t *T) RxEvent(event interface{}) {
...
@@ -530,7 +530,7 @@ func (t *T) RxEvent(event interface{}) {
t
.
streamTabMu
.
Unlock
()
t
.
streamTabMu
.
Unlock
()
if
ch
==
nil
{
if
ch
==
nil
{
t
.
fatalfInNonMain
(
"%s: send: canceled (test failed)"
,
stream
)
t
.
fatalfInNonMain
(
"%s:
(pre)
send: canceled (test failed)"
,
stream
)
}
}
// TODO it is possible to empirically detect here if a test incorrectly
// TODO it is possible to empirically detect here if a test incorrectly
...
@@ -652,68 +652,6 @@ func (t *T) xget1(stream string, eventp interface{}) *Msg {
...
@@ -652,68 +652,6 @@ func (t *T) xget1(stream string, eventp interface{}) *Msg {
return
msg
return
msg
}
}
/*
// deadlock reports diagnostic when retrieving event from stream times out.
//
// Timing out on recv means there is a deadlock either if no event was sent at
// all, or some other event was sent to another channel/checker.
//
// Report the full picture - what was expected and what was sent where.
func (t *T) deadlock(stream string, eventp interface{}) {
t.Helper()
// mark streamTab no longer operational XXX ok?
t.streamTabMu.Lock()
streamTab := t.streamTab
t.streamTab = nil
t.streamTabMu.Unlock()
bad := fmt.Sprintf("%s: deadlock waiting for %T\n", stream, eventp)
type sendInfo struct{ch Chan; msg *Msg}
var sendv []sendInfo
for _, ch := range streamTab {
// check whether someone is sending on a dst 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:
}
// XXX panic triggering disabled because if sender panics we have no chance to continue
// TODO retest this
// in any case close channel where future Sends may arrive so that will panic too.
//close(dst.msgq)
}
// order channels by name
sort.Slice(sendv, func(i, j int) bool {
return strings.Compare(sendv[i].ch.name(), sendv[j].ch.name()) < 0
})
if len(sendv) == 0 {
bad += fmt.Sprintf("noone is sending\n")
} else {
bad += fmt.Sprintf("there are %d pending sender(s) on other channel(s):\n", len(sendv))
for _, __ := range sendv {
bad += fmt.Sprintf("%s:\t%T %v\n", __.ch.name(), __.msg.Event, __.msg.Event)
}
}
// log the deadlock details and nak all senders.
// nak them only after deadlock printout, so that the deadlock text
// comes first, and their "panics" don't get intermixed with it.
t.Log(bad)
for _, __ := range sendv {
__.msg.nak("deadlock")
}
t.FailNow()
}
*/
// fatalfInNonMain should be called for fatal cases in non-main goroutines instead of panic.
// fatalfInNonMain should be called for fatal cases in non-main goroutines instead of panic.
//
//
// we don't panic because it will stop the process and prevent the main
// we don't panic because it will stop the process and prevent the main
...
@@ -815,9 +753,9 @@ func (t *T) Fatalf(format string, argv ...interface{}) {
...
@@ -815,9 +753,9 @@ func (t *T) Fatalf(format string, argv ...interface{}) {
// - main func to run the system
// - main func to run the system
// - testf (serial) func to verify events that comes from channels
// - testf (serial) func to verify events that comes from channels
// Verify verifies a system.
// Verify verifies a
test
system.
// XXX
// XXX
func
Verify
(
t
testing
.
TB
,
test
f
func
(
t
*
T
))
{
func
Verify
(
t
testing
.
TB
,
f
func
(
t
*
T
))
{
tT
:=
&
T
{
TB
:
t
,
streamTab
:
make
(
map
[
string
]
Chan
)}
tT
:=
&
T
{
TB
:
t
,
streamTab
:
make
(
map
[
string
]
Chan
)}
// XXX
// XXX
...
@@ -829,7 +767,7 @@ func Verify(t testing.TB, testf func(t *T)) {
...
@@ -829,7 +767,7 @@ func Verify(t testing.TB, testf func(t *T)) {
}()
}()
*/
*/
test
f
(
tT
)
f
(
tT
)
// XXX in the end: verify that streams are the same from run to run (if completed successfully).
// XXX in the end: verify that streams are the same from run to run (if completed successfully).
...
...
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