File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
2828 "runtime"
2929 "strconv"
3030 "strings"
31+ "sync"
3132 "testing"
3233 "time"
3334)
@@ -317,13 +318,16 @@ func TestVmoduleOff(t *testing.T) {
317318func TestSetOutputDataRace (t * testing.T ) {
318319 setFlags ()
319320 defer logging .swap (logging .newBuffers ())
321+ var wg sync.WaitGroup
320322 for i := 1 ; i <= 50 ; i ++ {
321323 go func () {
322324 logging .flushDaemon ()
323325 }()
324326 }
325327 for i := 1 ; i <= 50 ; i ++ {
328+ wg .Add (1 )
326329 go func () {
330+ defer wg .Done ()
327331 SetOutput (ioutil .Discard )
328332 }()
329333 }
@@ -333,7 +337,9 @@ func TestSetOutputDataRace(t *testing.T) {
333337 }()
334338 }
335339 for i := 1 ; i <= 50 ; i ++ {
340+ wg .Add (1 )
336341 go func () {
342+ defer wg .Done ()
337343 SetOutputBySeverity ("INFO" , ioutil .Discard )
338344 }()
339345 }
@@ -342,6 +348,7 @@ func TestSetOutputDataRace(t *testing.T) {
342348 logging .flushDaemon ()
343349 }()
344350 }
351+ wg .Wait ()
345352}
346353
347354// 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