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
de6e50fc
Commit
de6e50fc
authored
Apr 25, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ef3e9d73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
32 deletions
+6
-32
go/xcommon/xtracing/tracetest/tracetest.go
go/xcommon/xtracing/tracetest/tracetest.go
+6
-32
No files found.
go/xcommon/xtracing/tracetest/tracetest.go
View file @
de6e50fc
...
@@ -78,6 +78,7 @@
...
@@ -78,6 +78,7 @@
package
tracetest
package
tracetest
import
(
import
(
"flag"
"fmt"
"fmt"
"sort"
"sort"
"strings"
"strings"
...
@@ -88,6 +89,8 @@ import (
...
@@ -88,6 +89,8 @@ import (
"github.com/kylelemons/godebug/pretty"
"github.com/kylelemons/godebug/pretty"
)
)
var
chatty
=
flag
.
Bool
(
"tracetest.v"
,
false
,
"verbose: print events as they are sent on trace channels"
)
// SyncChan provides synchronous channel with additional property that send
// SyncChan provides synchronous channel with additional property that send
// blocks until receiving side explicitly acknowledges message was received and
// blocks until receiving side explicitly acknowledges message was received and
// processed.
// processed.
...
@@ -104,6 +107,9 @@ type SyncChan struct {
...
@@ -104,6 +107,9 @@ type SyncChan struct {
//
//
// if main testing goroutine detects any problem Send panics. XXX
// if main testing goroutine detects any problem Send panics. XXX
func
(
ch
*
SyncChan
)
Send
(
event
interface
{})
{
func
(
ch
*
SyncChan
)
Send
(
event
interface
{})
{
if
*
chatty
{
fmt
.
Printf
(
"%s <- %T %v
\n
"
,
ch
.
name
,
event
,
event
)
}
ack
:=
make
(
chan
bool
)
ack
:=
make
(
chan
bool
)
ch
.
msgq
<-
&
SyncMsg
{
event
,
ack
}
ch
.
msgq
<-
&
SyncMsg
{
event
,
ack
}
ok
:=
<-
ack
ok
:=
<-
ack
...
@@ -285,38 +291,6 @@ func (evc *EventChecker) deadlock(eventp interface{}) {
...
@@ -285,38 +291,6 @@ func (evc *EventChecker) deadlock(eventp interface{}) {
evc
.
t
.
Fatal
(
bad
)
evc
.
t
.
Fatal
(
bad
)
}
}
// XXX goes away? (if there is no happens-before for events - just check them one by one in dedicated goroutines ?)
/*
// ExpectPar asks checker to expect next series of events to be from eventExpectV in no particular order
// XXX naming
func (tc *TraceChecker) ExpectPar(eventExpectV ...interface{}) {
tc.t.Helper()
loop:
for len(eventExpectV) > 0 {
msg := tc.st.Get1()
for i, eventExpect := range eventExpectV {
if !reflect.DeepEqual(msg.Event, eventExpect) {
continue
}
// found matching event - good
eventExpectV = append(eventExpectV[:i], eventExpectV[i+1:]...)
msg.Ack() // XXX -> send ack for all only when all collected?
continue loop
}
// matching event not found - bad
strv := []string{}
for _, e := range eventExpectV {
strv = append(strv, fmt.Sprintf("%T %v", e, e))
}
tc.t.Fatalf("expect:\nhave: %T %v\nwant: [%v]", msg.Event, msg.Event, strings.Join(strv, " | "))
}
}
*/
// ----------------------------------------
// ----------------------------------------
...
...
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