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
6e41ea00
Commit
6e41ea00
authored
Dec 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a0829645
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+27
-11
No files found.
go/internal/xtracing/tracetest/tracetest.go
View file @
6e41ea00
...
...
@@ -843,6 +843,7 @@ func Verify(t *testing.T, f func(t *T)) {
if
len
(
trace0
)
<
2
{
return
}
streams0
:=
streamsOfTrace
(
trace0
)
// sort trace0 by time just in case - events migth come from multiple
// CPUs simultaneously, and so for close events they might be added to
...
...
@@ -860,7 +861,7 @@ func Verify(t *testing.T, f func(t *T)) {
}
}
// retest f with 10·δtMax
injected at i'th event
// retest f with 10·δtMax
delay injected at i'th event XXX 10x is too much?
for
i
:=
0
;
i
<
len
(
trace0
);
i
++
{
// stream and on-stream sequence number for i'th global event
stream
:=
trace0
[
i
]
.
stream
...
...
@@ -875,22 +876,37 @@ func Verify(t *testing.T, f func(t *T)) {
tT
:=
testf
(
t
,
map
[
string
]
*
delayInjectState
{
stream
:
&
delayInjectState
{
delayAt
:
istream
,
delayT
:
10
*
δtMax
,
//
XXX
make sure it < deadTime
delayT
:
10
*
δtMax
,
//
TODO
make sure it < deadTime
},
})
// XXX in the end: verify that streams are the same from run to run (if completed successfully).
_
=
tT
// verify that streams are the same from run to run
if
tT
.
Failed
()
{
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
"
,
streams0
,
streams
,
pretty
.
Compare
(
streams0
,
streams
))
}
})
}
}
/*
// ---- misc ----
func panicf(format string, argv ...interface{}) {
panic(fmt.Sprintf(format, argv...))
// streamsOfTrace returns sorted list of all streams present in a trace.
func
streamsOfTrace
(
tracev
[]
eventTrace
)
[]
string
{
streams
:=
make
(
map
[
string
]
struct
{})
for
_
,
t
:=
range
tracev
{
streams
[
t
.
stream
]
=
struct
{}{}
}
streamv
:=
[]
string
{}
for
stream
:=
range
streams
{
streamv
=
append
(
streamv
,
stream
)
}
sort
.
Strings
(
streamv
)
return
streamv
}
*/
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