Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
5a3f6a12
Commit
5a3f6a12
authored
Dec 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f15263d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
go/internal/xtracing/tracetest/example_test.go
go/internal/xtracing/tracetest/example_test.go
+8
-7
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+7
-3
No files found.
go/internal/xtracing/tracetest/example_test.go
View file @
5a3f6a12
...
...
@@ -140,6 +140,7 @@ func Test2ThreadsOK(t *testing.T) {
}
// TestDeadlock demonstrates deadlock detection.
// XXX also test for wrong decomposition XXX or is it also covered by this test as well?
func
TestDeadlock
(
t
*
testing
.
T
)
{
verify
(
t
,
func
(
t
*
tracetest
.
T
)
{
var
wg
sync
.
WaitGroup
...
...
@@ -296,8 +297,8 @@ var testExpectMap = map[string]testExpect{
"TestDeadlock"
:
{
1
,
`--- FAIL: TestDeadlock (<TIME>)
example_test.go:15
6
: t2: recv: deadlock waiting for *tracetest_test.eventHi
example_test.go:15
6
: test shutdown: #streams: 2, #(pending events): 1
example_test.go:15
7
: t2: recv: deadlock waiting for *tracetest_test.eventHi
example_test.go:15
7
: test shutdown: #streams: 2, #(pending events): 1
t1 <- tracetest_test.eventHi T1·A
# t2
...
...
@@ -306,7 +307,7 @@ var testExpectMap = map[string]testExpect{
"TestRace"
:
{
1
,
` --- FAIL: TestRace/delay@0(=x:0) (<TIME>)
example_test.go:18
2
: x: expect: tracetest_test.eventHi:
example_test.go:18
3
: x: expect: tracetest_test.eventHi:
want: x·A
have: x·B
diff:
...
...
@@ -316,8 +317,8 @@ var testExpectMap = map[string]testExpect{
"TestExpectType"
:
{
1
,
`--- FAIL: TestExpectType (<TIME>)
example_test.go:20
2
: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:20
2
: test shutdown: #streams: 1, #(pending events): 0
example_test.go:20
3
: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:20
3
: test shutdown: #streams: 1, #(pending events): 0
# t1
tracetest.go:<LINE>: t1: send: unexpected event type
...
...
@@ -325,14 +326,14 @@ var testExpectMap = map[string]testExpect{
"TestExpectValue"
:
{
1
,
`--- FAIL: TestExpectValue (<TIME>)
example_test.go:21
8
: t1: expect: tracetest_test.eventHi:
example_test.go:21
9
: t1: expect: tracetest_test.eventHi:
want: T1·B
have: T1·A
diff:
-"T1·B"
+"T1·A"
example_test.go:21
8
: test shutdown: #streams: 1, #(pending events): 0
example_test.go:21
9
: test shutdown: #streams: 1, #(pending events): 0
# t1
tracetest.go:<LINE>: t1: send: unexpected event data
...
...
go/internal/xtracing/tracetest/tracetest.go
View file @
5a3f6a12
...
...
@@ -99,6 +99,8 @@ var (
deadTime
=
flag
.
Duration
(
"tracetest.deadtime"
,
3
*
time
.
Second
,
"time after which no events activity is considered to be a deadlock"
)
)
// XXX hide Chan from public API
// Chan provides synchronous channel with additional property that send
// blocks until receiving side explicitly acknowledges message was received and
// processed.
...
...
@@ -529,6 +531,7 @@ func (t *T) queuenak(msg *Msg, why string) {
// XXX doc; naming
// XXX document routeEvent requirements
func
(
t
*
T
)
SetEventRouter
(
routeEvent
func
(
event
interface
{})
(
stream
string
))
{
t
.
mu
.
Lock
()
defer
t
.
mu
.
Unlock
()
...
...
@@ -544,11 +547,14 @@ func (t *T) SetEventRouter(routeEvent func(event interface{}) (stream string)) {
// XXX pass events in not via t (via something dedicated)?
func
(
t
*
T
)
RxEvent
(
event
interface
{})
{
t0
:=
time
.
Now
()
stream
:=
"
default
"
stream
:=
""
t
.
mu
.
Lock
()
if
t
.
routeEvent
!=
nil
{
stream
=
t
.
routeEvent
(
event
)
}
if
stream
==
""
{
stream
=
"default"
}
t
.
tracev
=
append
(
t
.
tracev
,
eventTrace
{
t0
,
stream
,
event
})
ch
:=
t
.
chanForStream
(
stream
)
...
...
@@ -885,8 +891,6 @@ func Verify(t *testing.T, f func(t *T)) {
return
}
streams
:=
streamsOfTrace
(
tT
.
tracev
)
fmt
.
Printf
(
"streams0: %v
\n
"
,
streams0
)
fmt
.
Printf
(
"streams: %v
\n
"
,
streams
)
if
!
reflect
.
DeepEqual
(
streams
,
streams0
)
{
tT
.
Fatalf
(
"streams are not the same as in the first run:
\n
"
+
"first: %s
\n
now: %s
\n
diff:
\n
%s
\n\n
"
,
...
...
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