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
811d83a1
Commit
811d83a1
authored
Jan 03, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
74f8ffcd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
+29
-29
go/internal/xtracing/tracetest/chan.go
go/internal/xtracing/tracetest/chan.go
+1
-1
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+28
-28
No files found.
go/internal/xtracing/tracetest/chan.go
View file @
811d83a1
...
...
@@ -101,5 +101,5 @@ func (m *_Msg) nak(why string) {
// newChan creates new _chan channel.
func
(
t
*
T
)
newChan
(
name
string
)
*
_chan
{
// NOTE T ensures not to create channels with duplicate names.
return
&
_chan
{
t
:
t
,
name
:
name
,
msgq
:
make
(
chan
*
_Msg
),
down
:
make
(
chan
struct
{})
,
}
return
&
_chan
{
t
:
t
,
name
:
name
,
msgq
:
make
(
chan
*
_Msg
),
down
:
make
(
chan
struct
{})}
}
go/internal/xtracing/tracetest/tracetest.go
View file @
811d83a1
...
...
@@ -73,6 +73,34 @@
// See example_test.go for more details.
package
tracetest
// Note on detection of races
//
// Verify injects delays to empirically detect race conditions and if a test
// incorrectly decomposed its system into serial streams: consider unrelated to
// each other events A and B are incorrectly routed to the same channel. It
// could be so happening that the order of checks on the test side is almost
// always correct and so the error is not visible. However
//
// if we add delays to delivery of either A or B
// and test both combinations
//
// we will for sure detect the error as, if A and B are indeed
// unrelated, one of the delay combination will result in events
// delivered to test in different to what it expects order.
//
// the time for delay could be taken as follows:
//
// - run the test without delay; collect δt between events on particular stream
// - take delay = max(δt)·10
//
// to make sure there is indeed no different orderings possible on the
// stream, rerun the test N(event-on-stream) times, and during i'th run
// delay i'th event.
//
// See also on this topic:
// http://www.1024cores.net/home/relacy-race-detector
// http://www.1024cores.net/home/relacy-race-detector/rrd-introduction
import
(
"flag"
"fmt"
...
...
@@ -438,34 +466,6 @@ func Verify(t *testing.T, f func(t *T)) {
tT0
:=
run
(
t
,
f
,
nil
)
// now, if f succeeds, verify f with injected delays.
//
// We inject delays to empirically detect race conditions and if a test
// incorrectly decomposed its system into serial streams: consider
// unrelated to each other events A and B are incorrectly routed to the
// same channel. It could be so happening that the order of checks on
// the test side is almost always correct and so the error is not
// visible. However
//
// if we add delays to delivery of either A or B
// and test both combinations
//
// we will for sure detect the error as, if A and B are indeed
// unrelated, one of the delay combination will result in events
// delivered to test in different to what it expects order.
//
// the time for delay could be taken as follows:
//
// - run the test without delay; collect δt between events on particular stream
// - take delay = max(δt)·10
//
// to make sure there is indeed no different orderings possible on the
// stream, rerun the test N(event-on-stream) times, and during i'th run
// delay i'th event.
//
// See also on this topic:
// http://www.1024cores.net/home/relacy-race-detector
// http://www.1024cores.net/home/relacy-race-detector/rrd-introduction
if
tT0
.
Failed
()
{
return
}
...
...
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