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)) { ...@@ -843,6 +843,7 @@ func Verify(t *testing.T, f func(t *T)) {
if len(trace0) < 2 { if len(trace0) < 2 {
return return
} }
streams0 := streamsOfTrace(trace0)
// sort trace0 by time just in case - events migth come from multiple // sort trace0 by time just in case - events migth come from multiple
// CPUs simultaneously, and so for close events they might be added to // 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)) { ...@@ -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++ { for i := 0; i < len(trace0); i++ {
// stream and on-stream sequence number for i'th global event // stream and on-stream sequence number for i'th global event
stream := trace0[i].stream stream := trace0[i].stream
...@@ -875,22 +876,37 @@ func Verify(t *testing.T, f func(t *T)) { ...@@ -875,22 +876,37 @@ func Verify(t *testing.T, f func(t *T)) {
tT := testf(t, map[string]*delayInjectState{ tT := testf(t, map[string]*delayInjectState{
stream: &delayInjectState{ stream: &delayInjectState{
delayAt: istream, 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). // verify that streams are the same from run to run
_ = tT 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))
}
}) })
} }
} }
/* // streamsOfTrace returns sorted list of all streams present in a trace.
// ---- misc ---- func streamsOfTrace(tracev []eventTrace) []string {
streams := make(map[string]struct{})
func panicf(format string, argv ...interface{}) { for _, t := range tracev {
panic(fmt.Sprintf(format, argv...)) 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