@@ -1108,6 +1108,7 @@ func TestGoroutineLeakGC(t *testing.T) {
1108
1108
// Repetitions are used to amortize flakiness in some tests.
1109
1109
type testCase struct {
1110
1110
name string
1111
+ simple bool
1111
1112
expectedLeaks map [* regexp.Regexp ]bool
1112
1113
1113
1114
// flakyLeaks are goroutine leaks that are too flaky to be reliably detected.
@@ -1235,6 +1236,13 @@ func TestGoroutineLeakGC(t *testing.T) {
1235
1236
makeTest ("NoLeakGlobal" ),
1236
1237
}
1237
1238
1239
+ // Set all micro tests to simple so that they are executed serially.
1240
+ // This reduces scheduling pressure on the test runner, and improves
1241
+ // reliability.
1242
+ for i := range microTests {
1243
+ microTests [i ].simple = true
1244
+ }
1245
+
1238
1246
// Common goroutine leak patterns.
1239
1247
// Extracted from "Unveiling and Vanquishing Goroutine Leaks in Enterprise Microservices: A Dynamic Analysis Approach"
1240
1248
// doi:10.1109/CGO57630.2024.10444835
@@ -1255,6 +1263,13 @@ func TestGoroutineLeakGC(t *testing.T) {
1255
1263
`timeout\.func1.* \[chan send\]` ),
1256
1264
}
1257
1265
1266
+ // Set all pattern tests to simple so that they are executed serially.
1267
+ // This reduces scheduling pressure on the test runner, and improves
1268
+ // reliability.
1269
+ for i := range patternTestCases {
1270
+ patternTestCases [i ].simple = true
1271
+ }
1272
+
1258
1273
// GoKer tests from "GoBench: A Benchmark Suite of Real-World Go Concurrency Bugs".
1259
1274
// White paper found at https://lujie.ac.cn/files/papers/GoBench.pdf
1260
1275
// doi:10.1109/CGO51591.2021.9370317.
@@ -1518,8 +1533,11 @@ func TestGoroutineLeakGC(t *testing.T) {
1518
1533
1519
1534
for _ , tcase := range testCases {
1520
1535
t .Run (tcase .name , func (t * testing.T ) {
1521
- // Run tests in parallel.
1522
- t .Parallel ()
1536
+ if ! tcase .simple {
1537
+ // Run complex tests in parallel. Do this because such tests
1538
+ // are flaky and we do not necessarily care about their output.
1539
+ t .Parallel ()
1540
+ }
1523
1541
1524
1542
// Run program and get output trace.
1525
1543
output := runBuiltTestProg (t , exe , tcase .name , "GODEBUG=asyncpreemptoff=1" )
0 commit comments