File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
28
28
"runtime"
29
29
"strconv"
30
30
"strings"
31
+ "sync"
31
32
"testing"
32
33
"time"
33
34
)
@@ -317,13 +318,16 @@ func TestVmoduleOff(t *testing.T) {
317
318
func TestSetOutputDataRace (t * testing.T ) {
318
319
setFlags ()
319
320
defer logging .swap (logging .newBuffers ())
321
+ var wg sync.WaitGroup
320
322
for i := 1 ; i <= 50 ; i ++ {
321
323
go func () {
322
324
logging .flushDaemon ()
323
325
}()
324
326
}
325
327
for i := 1 ; i <= 50 ; i ++ {
328
+ wg .Add (1 )
326
329
go func () {
330
+ defer wg .Done ()
327
331
SetOutput (ioutil .Discard )
328
332
}()
329
333
}
@@ -333,7 +337,9 @@ func TestSetOutputDataRace(t *testing.T) {
333
337
}()
334
338
}
335
339
for i := 1 ; i <= 50 ; i ++ {
340
+ wg .Add (1 )
336
341
go func () {
342
+ defer wg .Done ()
337
343
SetOutputBySeverity ("INFO" , ioutil .Discard )
338
344
}()
339
345
}
@@ -342,6 +348,7 @@ func TestSetOutputDataRace(t *testing.T) {
342
348
logging .flushDaemon ()
343
349
}()
344
350
}
351
+ wg .Wait ()
345
352
}
346
353
347
354
// vGlobs are patterns that match/don't match this file at V=2.
You can’t perform that action at this time.
0 commit comments