Commit 6e41ea00 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a0829645
......@@ -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\nnow: %s\ndiff:\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
}
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment