@@ -11,6 +11,7 @@ import (
11
11
"context"
12
12
"io"
13
13
"runtime/trace"
14
+ "slices"
14
15
"sync"
15
16
"sync/atomic"
16
17
"testing"
@@ -196,7 +197,6 @@ func TestFlightRecorderLog(t *testing.T) {
196
197
}
197
198
198
199
func TestFlightRecorderOneGeneration (t * testing.T ) {
199
- t .Skip ("requires update for Go 1.25's additional Sync event, go.dev/issue/73558" )
200
200
test := func (t * testing.T , fr * FlightRecorder ) {
201
201
tr := testFlightRecorder (t , fr , func (snapshot func ()) {
202
202
// Sleep to let a few generations pass.
@@ -210,8 +210,9 @@ func TestFlightRecorderOneGeneration(t *testing.T) {
210
210
t .Fatalf ("unexpected error creating trace reader: %v" , err )
211
211
}
212
212
213
- // Make sure there's only exactly one Sync event.
214
- sync := 0
213
+ // Make sure there are exactly two Sync events: at the start and end.
214
+ var syncs []int
215
+ evs := 0
215
216
for {
216
217
ev , err := r .ReadEvent ()
217
218
if err == io .EOF {
@@ -221,11 +222,13 @@ func TestFlightRecorderOneGeneration(t *testing.T) {
221
222
t .Fatalf ("unexpected error reading trace: %v" , err )
222
223
}
223
224
if ev .Kind () == EventSync {
224
- sync ++
225
+ syncs = append ( syncs , evs )
225
226
}
227
+ evs ++
226
228
}
227
- if sync != 1 {
228
- t .Errorf ("expected one sync event, found %d" , sync )
229
+ if ends := []int {0 , evs - 1 }; ! slices .Equal (syncs , ends ) {
230
+ t .Errorf ("expected two sync events (one at each end of the trace), found %d at %d instead of %d" ,
231
+ len (syncs ), syncs [:min (len (syncs ), 5 )], ends )
229
232
}
230
233
}
231
234
t .Run ("SetPeriod" , func (t * testing.T ) {
0 commit comments