mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: remove unnecessary loop variable copies in tests
Copying the loop variable is no longer necessary since Go 1.22. Change-Id: Iebb21dac44a20ec200567f1d786f105a4ee4999d Reviewed-on: https://go-review.googlesource.com/c/go/+/711640 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
5137c473b6
commit
b5aefe07e5
58 changed files with 0 additions and 99 deletions
|
|
@ -1213,7 +1213,6 @@ func TestFS(t *testing.T) {
|
||||||
[]string{"a/b/c"},
|
[]string{"a/b/c"},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.file, func(t *testing.T) {
|
t.Run(test.file, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
z, err := OpenReader(test.file)
|
z, err := OpenReader(test.file)
|
||||||
|
|
@ -1247,7 +1246,6 @@ func TestFSWalk(t *testing.T) {
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.file, func(t *testing.T) {
|
t.Run(test.file, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
z, err := OpenReader(test.file)
|
z, err := OpenReader(test.file)
|
||||||
|
|
|
||||||
|
|
@ -838,7 +838,6 @@ func TestCause(t *testing.T) {
|
||||||
cause: parentCause,
|
cause: parentCause,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
ctx := test.ctx()
|
ctx := test.ctx()
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,6 @@ func TestCTR_AES_multiblock_random_IV(t *testing.T) {
|
||||||
const Size = 100
|
const Size = 100
|
||||||
|
|
||||||
for _, keySize := range []int{16, 24, 32} {
|
for _, keySize := range []int{16, 24, 32} {
|
||||||
keySize := keySize
|
|
||||||
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
||||||
key := randBytes(t, r, keySize)
|
key := randBytes(t, r, keySize)
|
||||||
aesBlock, err := aes.NewCipher(key)
|
aesBlock, err := aes.NewCipher(key)
|
||||||
|
|
@ -164,10 +163,8 @@ func TestCTR_AES_multiblock_random_IV(t *testing.T) {
|
||||||
// individually using multiblock implementation to catch edge cases.
|
// individually using multiblock implementation to catch edge cases.
|
||||||
|
|
||||||
for part1 := 0; part1 <= Size; part1++ {
|
for part1 := 0; part1 <= Size; part1++ {
|
||||||
part1 := part1
|
|
||||||
t.Run(fmt.Sprintf("part1=%d", part1), func(t *testing.T) {
|
t.Run(fmt.Sprintf("part1=%d", part1), func(t *testing.T) {
|
||||||
for part2 := 0; part2 <= Size-part1; part2++ {
|
for part2 := 0; part2 <= Size-part1; part2++ {
|
||||||
part2 := part2
|
|
||||||
t.Run(fmt.Sprintf("part2=%d", part2), func(t *testing.T) {
|
t.Run(fmt.Sprintf("part2=%d", part2), func(t *testing.T) {
|
||||||
_, multiblockCtr := makeTestingCiphers(aesBlock, iv)
|
_, multiblockCtr := makeTestingCiphers(aesBlock, iv)
|
||||||
multiblockCiphertext := make([]byte, len(plaintext))
|
multiblockCiphertext := make([]byte, len(plaintext))
|
||||||
|
|
@ -216,7 +213,6 @@ func TestCTR_AES_multiblock_overflow_IV(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, keySize := range []int{16, 24, 32} {
|
for _, keySize := range []int{16, 24, 32} {
|
||||||
keySize := keySize
|
|
||||||
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
||||||
for _, iv := range ivs {
|
for _, iv := range ivs {
|
||||||
key := randBytes(t, r, keySize)
|
key := randBytes(t, r, keySize)
|
||||||
|
|
@ -227,7 +223,6 @@ func TestCTR_AES_multiblock_overflow_IV(t *testing.T) {
|
||||||
|
|
||||||
t.Run(fmt.Sprintf("iv=%s", hex.EncodeToString(iv)), func(t *testing.T) {
|
t.Run(fmt.Sprintf("iv=%s", hex.EncodeToString(iv)), func(t *testing.T) {
|
||||||
for _, offset := range []int{0, 1, 16, 1024} {
|
for _, offset := range []int{0, 1, 16, 1024} {
|
||||||
offset := offset
|
|
||||||
t.Run(fmt.Sprintf("offset=%d", offset), func(t *testing.T) {
|
t.Run(fmt.Sprintf("offset=%d", offset), func(t *testing.T) {
|
||||||
genericCtr, multiblockCtr := makeTestingCiphers(aesBlock, iv)
|
genericCtr, multiblockCtr := makeTestingCiphers(aesBlock, iv)
|
||||||
|
|
||||||
|
|
@ -260,7 +255,6 @@ func TestCTR_AES_multiblock_XORKeyStreamAt(t *testing.T) {
|
||||||
plaintext := randBytes(t, r, Size)
|
plaintext := randBytes(t, r, Size)
|
||||||
|
|
||||||
for _, keySize := range []int{16, 24, 32} {
|
for _, keySize := range []int{16, 24, 32} {
|
||||||
keySize := keySize
|
|
||||||
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) {
|
||||||
key := randBytes(t, r, keySize)
|
key := randBytes(t, r, keySize)
|
||||||
iv := randBytes(t, r, aesBlockSize)
|
iv := randBytes(t, r, aesBlockSize)
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,6 @@ func TestEverything(t *testing.T) {
|
||||||
max = 2048
|
max = 2048
|
||||||
}
|
}
|
||||||
for size := min; size <= max; size++ {
|
for size := min; size <= max; size++ {
|
||||||
size := size
|
|
||||||
t.Run(fmt.Sprintf("%d", size), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%d", size), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
priv, err := GenerateKey(rand.Reader, size)
|
priv, err := GenerateKey(rand.Reader, size)
|
||||||
|
|
|
||||||
|
|
@ -2693,7 +2693,6 @@ func TestTLS13OnlyClientHelloCipherSuite(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tls13Tests {
|
for _, tt := range tls13Tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testTLS13OnlyClientHelloCipherSuite(t, tt.ciphers)
|
testTLS13OnlyClientHelloCipherSuite(t, tt.ciphers)
|
||||||
|
|
|
||||||
|
|
@ -1880,7 +1880,6 @@ func testVerifyCertificates(t *testing.T, version uint16) {
|
||||||
rootCAs.AddCert(issuer)
|
rootCAs.AddCert(issuer)
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,6 @@ func TestPlatformVerifier(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
parent := testRoot
|
parent := testRoot
|
||||||
|
|
|
||||||
|
|
@ -2939,7 +2939,6 @@ func TestConnExpiresFreshOutOfPool(t *testing.T) {
|
||||||
db.SetMaxOpenConns(1)
|
db.SetMaxOpenConns(1)
|
||||||
|
|
||||||
for _, ec := range execCases {
|
for _, ec := range execCases {
|
||||||
ec := ec
|
|
||||||
name := fmt.Sprintf("expired=%t,badReset=%t", ec.expired, ec.badReset)
|
name := fmt.Sprintf("expired=%t,badReset=%t", ec.expired, ec.badReset)
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
db.clearAllConns(t)
|
db.clearAllConns(t)
|
||||||
|
|
|
||||||
|
|
@ -238,16 +238,13 @@ func TestReadFile(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range platforms {
|
for _, p := range platforms {
|
||||||
p := p
|
|
||||||
t.Run(p.goos+"_"+p.goarch, func(t *testing.T) {
|
t.Run(p.goos+"_"+p.goarch, func(t *testing.T) {
|
||||||
if p != runtimePlatform && !*flagAll {
|
if p != runtimePlatform && !*flagAll {
|
||||||
t.Skipf("skipping platforms other than %s_%s because -all was not set", runtimePlatform.goos, runtimePlatform.goarch)
|
t.Skipf("skipping platforms other than %s_%s because -all was not set", runtimePlatform.goos, runtimePlatform.goarch)
|
||||||
}
|
}
|
||||||
for _, mode := range buildModes {
|
for _, mode := range buildModes {
|
||||||
mode := mode
|
|
||||||
t.Run(mode, func(t *testing.T) {
|
t.Run(mode, func(t *testing.T) {
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
name := tc.build(t, p.goos, p.goarch, mode)
|
name := tc.build(t, p.goos, p.goarch, mode)
|
||||||
|
|
|
||||||
|
|
@ -1040,7 +1040,6 @@ var relocationTests = []relocationTest{
|
||||||
|
|
||||||
func TestDWARFRelocations(t *testing.T) {
|
func TestDWARFRelocations(t *testing.T) {
|
||||||
for _, test := range relocationTests {
|
for _, test := range relocationTests {
|
||||||
test := test
|
|
||||||
t.Run(test.file, func(t *testing.T) {
|
t.Run(test.file, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
f, err := Open(test.file)
|
f, err := Open(test.file)
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,6 @@ func TestBufferTooBigWithOverflow(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
value, n := Uvarint(tt.in)
|
value, n := Uvarint(tt.in)
|
||||||
if g, w := n, tt.wantN; g != w {
|
if g, w := n, tt.wantN; g != w {
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,6 @@ func TestBaseIndent(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for indent := 0; indent < 4; indent++ {
|
for indent := 0; indent < 4; indent++ {
|
||||||
indent := indent
|
|
||||||
t.Run(fmt.Sprint(indent), func(t *testing.T) {
|
t.Run(fmt.Sprint(indent), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
|
||||||
|
|
@ -2432,7 +2432,6 @@ type K = Nested[string]
|
||||||
)
|
)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
i := i
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
@ -2613,7 +2612,6 @@ func fn() {
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
if got := len(idents[test.name]); got != 1 {
|
if got := len(idents[test.name]); got != 1 {
|
||||||
t.Fatalf("found %d identifiers named %s, want 1", got, test.name)
|
t.Fatalf("found %d identifiers named %s, want 1", got, test.name)
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,6 @@ func main() {
|
||||||
func TestGCSizes(t *testing.T) {
|
func TestGCSizes(t *testing.T) {
|
||||||
types.DefPredeclaredTestFuncs()
|
types.DefPredeclaredTestFuncs()
|
||||||
for _, tc := range gcSizesTests {
|
for _, tc := range gcSizesTests {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
conf := types.Config{
|
conf := types.Config{
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ func TestStdlib(t *testing.T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for dir := range dirFiles {
|
for dir := range dirFiles {
|
||||||
dir := dir
|
|
||||||
|
|
||||||
cpulimit <- struct{}{}
|
cpulimit <- struct{}{}
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,6 @@ func BenchmarkMarshalCorpusFile(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for sz := 1; sz <= len(buf); sz <<= 1 {
|
for sz := 1; sz <= len(buf); sz <<= 1 {
|
||||||
sz := sz
|
|
||||||
b.Run(strconv.Itoa(sz), func(b *testing.B) {
|
b.Run(strconv.Itoa(sz), func(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
b.SetBytes(int64(sz))
|
b.SetBytes(int64(sz))
|
||||||
|
|
@ -280,7 +279,6 @@ func BenchmarkUnmarshalCorpusFile(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for sz := 1; sz <= len(buf); sz <<= 1 {
|
for sz := 1; sz <= len(buf); sz <<= 1 {
|
||||||
sz := sz
|
|
||||||
data := marshalCorpusFile(buf[:sz])
|
data := marshalCorpusFile(buf[:sz])
|
||||||
b.Run(strconv.Itoa(sz), func(b *testing.B) {
|
b.Run(strconv.Itoa(sz), func(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,6 @@ func TestMinimizeInput(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
ws := &workerServer{
|
ws := &workerServer{
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,6 @@ func BenchmarkWorkerMinimize(b *testing.B) {
|
||||||
bytes := make([]byte, 1024)
|
bytes := make([]byte, 1024)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
for sz := 1; sz <= len(bytes); sz <<= 1 {
|
for sz := 1; sz <= len(bytes); sz <<= 1 {
|
||||||
sz := sz
|
|
||||||
input := []any{bytes[:sz]}
|
input := []any{bytes[:sz]}
|
||||||
encodedVals := marshalCorpusFile(input...)
|
encodedVals := marshalCorpusFile(input...)
|
||||||
mem = <-ws.memMu
|
mem = <-ws.memMu
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ func TestMirrorWithReflect(t *testing.T) {
|
||||||
{".", "reflectlite", rl},
|
{".", "reflectlite", rl},
|
||||||
{reflectDir, "reflect", r},
|
{reflectDir, "reflect", r},
|
||||||
} {
|
} {
|
||||||
tc := tc
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ func TestReaderGolden(t *testing.T) {
|
||||||
t.Fatalf("failed to glob for tests: %v", err)
|
t.Fatalf("failed to glob for tests: %v", err)
|
||||||
}
|
}
|
||||||
for _, testPath := range matches {
|
for _, testPath := range matches {
|
||||||
testPath := testPath
|
|
||||||
testName, err := filepath.Rel("./testdata", testPath)
|
testName, err := filepath.Rel("./testdata", testPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to relativize testdata path: %v", err)
|
t.Fatalf("failed to relativize testdata path: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ func TestTraceV1(t *testing.T) {
|
||||||
}
|
}
|
||||||
var testedUserRegions bool
|
var testedUserRegions bool
|
||||||
for _, p := range traces {
|
for _, p := range traces {
|
||||||
p := p
|
|
||||||
testName, err := filepath.Rel("./internal/tracev1/testdata", p)
|
testName, err := filepath.Rel("./internal/tracev1/testdata", p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to relativize testdata path: %s", err)
|
t.Fatalf("failed to relativize testdata path: %s", err)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ func TestPredefinedTables(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
var r Reader
|
var r Reader
|
||||||
table := make([]fseEntry, 1<<test.tableBits)
|
table := make([]fseEntry, 1<<test.tableBits)
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,6 @@ var tests = []struct {
|
||||||
|
|
||||||
func TestSamples(t *testing.T) {
|
func TestSamples(t *testing.T) {
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
r := NewReader(strings.NewReader(test.compressed))
|
r := NewReader(strings.NewReader(test.compressed))
|
||||||
got, err := io.ReadAll(r)
|
got, err := io.ReadAll(r)
|
||||||
|
|
@ -131,7 +130,6 @@ func TestReset(t *testing.T) {
|
||||||
input := strings.NewReader("")
|
input := strings.NewReader("")
|
||||||
r := NewReader(input)
|
r := NewReader(input)
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
input.Reset(test.compressed)
|
input.Reset(test.compressed)
|
||||||
r.Reset(input)
|
r.Reset(input)
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,6 @@ func TestWithSimulated(t *testing.T) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
tr := tr
|
|
||||||
t.Run(tr, func(t *testing.T) {
|
t.Run(tr, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ func TestDefaultRace(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
i := i
|
|
||||||
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestDefaultRace$")
|
cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestDefaultRace$")
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ const someTimeout = 1 * time.Hour
|
||||||
|
|
||||||
func TestConnAndListener(t *testing.T) {
|
func TestConnAndListener(t *testing.T) {
|
||||||
for i, network := range []string{"tcp", "unix", "unixpacket"} {
|
for i, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
i, network := i, network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("skipping %s test", network)
|
t.Skipf("skipping %s test", network)
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,6 @@ func TestDialParallel(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tt := range testCases {
|
for i, tt := range testCases {
|
||||||
i, tt := i, tt
|
|
||||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||||
dialTCP := func(ctx context.Context, network string, laddr, raddr *TCPAddr) (*TCPConn, error) {
|
dialTCP := func(ctx context.Context, network string, laddr, raddr *TCPAddr) (*TCPConn, error) {
|
||||||
n := "tcp6"
|
n := "tcp6"
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,6 @@ func TestDialError(t *testing.T) {
|
||||||
|
|
||||||
d := Dialer{Timeout: someTimeout}
|
d := Dialer{Timeout: someTimeout}
|
||||||
for i, tt := range dialErrorTests {
|
for i, tt := range dialErrorTests {
|
||||||
i, tt := i, tt
|
|
||||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||||
c, err := d.Dial(tt.network, tt.address)
|
c, err := d.Dial(tt.network, tt.address)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
||||||
|
|
@ -1540,7 +1540,6 @@ func testServeFileRejectsInvalidSuffixLengths(t *testing.T, mode testMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.r, func(t *testing.T) {
|
t.Run(tt.r, func(t *testing.T) {
|
||||||
req, err := NewRequest("GET", cst.URL+"/index.html", nil)
|
req, err := NewRequest("GET", cst.URL+"/index.html", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,6 @@ func TestRecorderPanicsOnNonXXXStatusCode(t *testing.T) {
|
||||||
-100, 0, 99, 1000, 20000,
|
-100, 0, 99, 1000, 20000,
|
||||||
}
|
}
|
||||||
for _, badCode := range badCodes {
|
for _, badCode := range badCodes {
|
||||||
badCode := badCode
|
|
||||||
t.Run(fmt.Sprintf("Code=%d", badCode), func(t *testing.T) {
|
t.Run(fmt.Sprintf("Code=%d", badCode), func(t *testing.T) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r == nil {
|
if r := recover(); r == nil {
|
||||||
|
|
|
||||||
|
|
@ -6701,7 +6701,6 @@ func testTimeoutHandlerSuperfluousLogs(t *testing.T, mode testMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
exitHandler := make(chan bool, 1)
|
exitHandler := make(chan bool, 1)
|
||||||
defer close(exitHandler)
|
defer close(exitHandler)
|
||||||
|
|
|
||||||
|
|
@ -4526,7 +4526,6 @@ func TestTransportContentEncodingCaseInsensitive(t *testing.T) {
|
||||||
}
|
}
|
||||||
func testTransportContentEncodingCaseInsensitive(t *testing.T, mode testMode) {
|
func testTransportContentEncodingCaseInsensitive(t *testing.T, mode testMode) {
|
||||||
for _, ce := range []string{"gzip", "GZIP"} {
|
for _, ce := range []string{"gzip", "GZIP"} {
|
||||||
ce := ce
|
|
||||||
t.Run(ce, func(t *testing.T) {
|
t.Run(ce, func(t *testing.T) {
|
||||||
const encodedString = "Hello Gopher"
|
const encodedString = "Hello Gopher"
|
||||||
ts := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) {
|
ts := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ func TestCloseRead(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
@ -83,7 +82,6 @@ func TestCloseWrite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
@ -185,7 +183,6 @@ func TestCloseWrite(t *testing.T) {
|
||||||
func TestConnClose(t *testing.T) {
|
func TestConnClose(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
@ -227,7 +224,6 @@ func TestConnClose(t *testing.T) {
|
||||||
func TestListenerClose(t *testing.T) {
|
func TestListenerClose(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
@ -265,7 +261,6 @@ func TestListenerClose(t *testing.T) {
|
||||||
func TestPacketConnClose(t *testing.T) {
|
func TestPacketConnClose(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, network := range []string{"udp", "unixgram"} {
|
for _, network := range []string{"udp", "unixgram"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
@ -349,7 +344,6 @@ func TestAcceptIgnoreAbortedConnRequest(t *testing.T) {
|
||||||
func TestZeroByteRead(t *testing.T) {
|
func TestZeroByteRead(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
for _, network := range []string{"tcp", "unix", "unixpacket"} {
|
||||||
network := network
|
|
||||||
t.Run(network, func(t *testing.T) {
|
t.Run(network, func(t *testing.T) {
|
||||||
if !testableNetwork(network) {
|
if !testableNetwork(network) {
|
||||||
t.Skipf("network %s is not testable on the current platform", network)
|
t.Skipf("network %s is not testable on the current platform", network)
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,6 @@ var udpServerTests = []struct {
|
||||||
|
|
||||||
func TestUDPServer(t *testing.T) {
|
func TestUDPServer(t *testing.T) {
|
||||||
for i, tt := range udpServerTests {
|
for i, tt := range udpServerTests {
|
||||||
i, tt := i, tt
|
|
||||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||||
if !testableListenArgs(tt.snet, tt.saddr, tt.taddr) {
|
if !testableListenArgs(tt.snet, tt.saddr, tt.taddr) {
|
||||||
t.Skipf("skipping %s %s<-%s test", tt.snet, tt.saddr, tt.taddr)
|
t.Skipf("skipping %s %s<-%s test", tt.snet, tt.saddr, tt.taddr)
|
||||||
|
|
@ -340,7 +339,6 @@ func TestUnixgramServer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tt := range unixgramServerTests {
|
for i, tt := range unixgramServerTests {
|
||||||
i, tt := i, tt
|
|
||||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||||
if !testableListenArgs("unixgram", tt.saddr, "") {
|
if !testableListenArgs("unixgram", tt.saddr, "") {
|
||||||
t.Skipf("skipping unixgram %s<-%s test", tt.saddr, tt.caddr)
|
t.Skipf("skipping unixgram %s<-%s test", tt.saddr, tt.caddr)
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ func TestAcceptTimeout(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, timeout := range timeouts {
|
for _, timeout := range timeouts {
|
||||||
timeout := timeout
|
|
||||||
t.Run(fmt.Sprintf("%v", timeout), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%v", timeout), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,6 @@ func TestUnixConnLocalAndRemoteNames(t *testing.T) {
|
||||||
|
|
||||||
handler := func(ls *localServer, ln Listener) {}
|
handler := func(ls *localServer, ln Listener) {}
|
||||||
for _, laddr := range []string{"", testUnixAddr(t)} {
|
for _, laddr := range []string{"", testUnixAddr(t)} {
|
||||||
laddr := laddr
|
|
||||||
taddr := testUnixAddr(t)
|
taddr := testUnixAddr(t)
|
||||||
ta, err := ResolveUnixAddr("unix", taddr)
|
ta, err := ResolveUnixAddr("unix", taddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -306,7 +305,6 @@ func TestUnixgramConnLocalAndRemoteNames(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, laddr := range []string{"", testUnixAddr(t)} {
|
for _, laddr := range []string{"", testUnixAddr(t)} {
|
||||||
laddr := laddr
|
|
||||||
taddr := testUnixAddr(t)
|
taddr := testUnixAddr(t)
|
||||||
ta, err := ResolveUnixAddr("unixgram", taddr)
|
ta, err := ResolveUnixAddr("unixgram", taddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,6 @@ func TestImplicitPWD(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
@ -242,7 +241,6 @@ func TestExplicitPWD(t *testing.T) {
|
||||||
// contain symlinks preserved from the PWD value in the test's environment.
|
// contain symlinks preserved from the PWD value in the test's environment.
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,6 @@ func TestStop(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, sig := range sigs {
|
for _, sig := range sigs {
|
||||||
sig := sig
|
|
||||||
t.Run(fmt.Sprint(sig), func(t *testing.T) {
|
t.Run(fmt.Sprint(sig), func(t *testing.T) {
|
||||||
// When calling Notify with a specific signal,
|
// When calling Notify with a specific signal,
|
||||||
// independent signals should not interfere with each other,
|
// independent signals should not interfere with each other,
|
||||||
|
|
@ -441,7 +440,6 @@ func TestNohup(t *testing.T) {
|
||||||
subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output.
|
subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output.
|
||||||
}
|
}
|
||||||
for i := 1; i <= 2; i++ {
|
for i := 1; i <= 2; i++ {
|
||||||
i := i
|
|
||||||
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
@ -484,7 +482,6 @@ func TestNohup(t *testing.T) {
|
||||||
subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output.
|
subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output.
|
||||||
}
|
}
|
||||||
for i := 1; i <= 2; i++ {
|
for i := 1; i <= 2; i++ {
|
||||||
i := i
|
|
||||||
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
@ -743,7 +740,6 @@ func TestNotifyContextNotifications(t *testing.T) {
|
||||||
{"multiple", 10},
|
{"multiple", 10},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -936,7 +936,6 @@ func TestWalkSymlinkRoot(t *testing.T) {
|
||||||
buggyGOOS: []string{"darwin", "ios"}, // https://go.dev/issue/59586
|
buggyGOOS: []string{"darwin", "ios"}, // https://go.dev/issue/59586
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.desc, func(t *testing.T) {
|
t.Run(tt.desc, func(t *testing.T) {
|
||||||
var walked []string
|
var walked []string
|
||||||
err := filepath.Walk(tt.root, func(path string, info fs.FileInfo, err error) error {
|
err := filepath.Walk(tt.root, func(path string, info fs.FileInfo, err error) error {
|
||||||
|
|
|
||||||
|
|
@ -7515,7 +7515,6 @@ func TestTypeStrings(t *testing.T) {
|
||||||
func TestOffsetLock(t *testing.T) {
|
func TestOffsetLock(t *testing.T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
i := i
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
for j := 0; j < 50; j++ {
|
for j := 0; j < 50; j++ {
|
||||||
|
|
@ -8535,7 +8534,6 @@ func TestClear(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
if !tc.testFunc(tc.value) {
|
if !tc.testFunc(tc.value) {
|
||||||
|
|
@ -8569,7 +8567,6 @@ func TestValuePointerAndUnsafePointer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
if got := tc.val.Pointer(); got != uintptr(tc.wantUnsafePointer) {
|
if got := tc.val.Pointer(); got != uintptr(tc.wantUnsafePointer) {
|
||||||
t.Errorf("unexpected uintptr result, got %#x, want %#x", got, uintptr(tc.wantUnsafePointer))
|
t.Errorf("unexpected uintptr result, got %#x, want %#x", got, uintptr(tc.wantUnsafePointer))
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,6 @@ type Rec2 struct {
|
||||||
|
|
||||||
func TestFields(t *testing.T) {
|
func TestFields(t *testing.T) {
|
||||||
for _, test := range fieldsTests {
|
for _, test := range fieldsTests {
|
||||||
test := test
|
|
||||||
t.Run(test.testName, func(t *testing.T) {
|
t.Run(test.testName, func(t *testing.T) {
|
||||||
typ := TypeOf(test.val)
|
typ := TypeOf(test.val)
|
||||||
fields := VisibleFields(typ)
|
fields := VisibleFields(typ)
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,6 @@ func TestSelfSelect(t *testing.T) {
|
||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
c := make(chan int, chanCap)
|
c := make(chan int, chanCap)
|
||||||
for p := 0; p < 2; p++ {
|
for p := 0; p < 2; p++ {
|
||||||
p := p
|
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for i := 0; i < 1000; i++ {
|
for i := 0; i < 1000; i++ {
|
||||||
|
|
@ -359,7 +358,6 @@ func TestSelectStress(t *testing.T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(10)
|
wg.Add(10)
|
||||||
for k := 0; k < 4; k++ {
|
for k := 0; k < 4; k++ {
|
||||||
k := k
|
|
||||||
go func() {
|
go func() {
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
c[k] <- 0
|
c[k] <- 0
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ func TestCheckPtr(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.cmd, func(t *testing.T) {
|
t.Run(tc.cmd, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
got, err := testenv.CleanCmdEnv(exec.Command(exe, tc.cmd)).CombinedOutput()
|
got, err := testenv.CleanCmdEnv(exec.Command(exe, tc.cmd)).CombinedOutput()
|
||||||
|
|
@ -88,7 +87,6 @@ func TestCheckPtr2(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.cmd, func(t *testing.T) {
|
t.Run(tc.cmd, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
got, err := testenv.CleanCmdEnv(exec.Command(exe, tc.cmd)).CombinedOutput()
|
got, err := testenv.CleanCmdEnv(exec.Command(exe, tc.cmd)).CombinedOutput()
|
||||||
|
|
|
||||||
|
|
@ -752,8 +752,6 @@ func TestSegv(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range []string{"Segv", "SegvInCgo", "TgkillSegv", "TgkillSegvInCgo"} {
|
for _, test := range []string{"Segv", "SegvInCgo", "TgkillSegv", "TgkillSegvInCgo"} {
|
||||||
test := test
|
|
||||||
|
|
||||||
// The tgkill variants only run on Linux.
|
// The tgkill variants only run on Linux.
|
||||||
if runtime.GOOS != "linux" && strings.HasPrefix(test, "Tgkill") {
|
if runtime.GOOS != "linux" && strings.HasPrefix(test, "Tgkill") {
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,6 @@ func BenchmarkMapInterfacePtr(b *testing.B) {
|
||||||
m := map[any]bool{}
|
m := map[any]bool{}
|
||||||
|
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
i := i
|
|
||||||
m[&i] = true
|
m[&i] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,8 +221,6 @@ func TestMemmoveAtomicity(t *testing.T) {
|
||||||
|
|
||||||
for _, backward := range []bool{true, false} {
|
for _, backward := range []bool{true, false} {
|
||||||
for _, n := range []int{3, 4, 5, 6, 7, 8, 9, 10, 15, 25, 49} {
|
for _, n := range []int{3, 4, 5, 6, 7, 8, 9, 10, 15, 25, 49} {
|
||||||
n := n
|
|
||||||
|
|
||||||
// test copying [N]*int.
|
// test copying [N]*int.
|
||||||
sz := uintptr(n * PtrSize)
|
sz := uintptr(n * PtrSize)
|
||||||
name := fmt.Sprint(sz)
|
name := fmt.Sprint(sz)
|
||||||
|
|
|
||||||
|
|
@ -603,7 +603,6 @@ func TestGcPacer(t *testing.T) {
|
||||||
// However, it is still possible to trigger this case if something exceptional
|
// However, it is still possible to trigger this case if something exceptional
|
||||||
// happens between calls to revise; the framework just doesn't support this yet.
|
// happens between calls to revise; the framework just doesn't support this yet.
|
||||||
} {
|
} {
|
||||||
e := e
|
|
||||||
t.Run(e.name, func(t *testing.T) {
|
t.Run(e.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,6 @@ func TestPallocDataFindScavengeCandidate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := makePallocData(v.alloc, v.scavenged)
|
b := makePallocData(v.alloc, v.scavenged)
|
||||||
start, size := b.FindScavengeCandidate(PallocChunkPages-1, v.min, v.max)
|
start, size := b.FindScavengeCandidate(PallocChunkPages-1, v.min, v.max)
|
||||||
|
|
@ -447,7 +446,6 @@ func TestPageAllocScavenge(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := NewPageAlloc(v.beforeAlloc, v.beforeScav)
|
b := NewPageAlloc(v.beforeAlloc, v.beforeScav)
|
||||||
defer FreePageAlloc(b)
|
defer FreePageAlloc(b)
|
||||||
|
|
@ -811,7 +809,6 @@ func TestScavengeIndex(t *testing.T) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run("Bg/"+test.name, func(t *testing.T) {
|
t.Run("Bg/"+test.name, func(t *testing.T) {
|
||||||
mark, find, nextGen := setup(t, false)
|
mark, find, nextGen := setup(t, false)
|
||||||
test.mark(mark)
|
test.mark(mark)
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,6 @@ func TestPageAllocGrow(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
// By creating a new pageAlloc, we will
|
// By creating a new pageAlloc, we will
|
||||||
// grow it for each chunk defined in x.
|
// grow it for each chunk defined in x.
|
||||||
|
|
@ -678,7 +677,6 @@ func TestPageAllocAlloc(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := NewPageAlloc(v.before, v.scav)
|
b := NewPageAlloc(v.before, v.scav)
|
||||||
defer FreePageAlloc(b)
|
defer FreePageAlloc(b)
|
||||||
|
|
@ -705,7 +703,6 @@ func TestPageAllocExhaust(t *testing.T) {
|
||||||
t.Skip("skipping because virtual memory is limited; see #36210")
|
t.Skip("skipping because virtual memory is limited; see #36210")
|
||||||
}
|
}
|
||||||
for _, npages := range []uintptr{1, 2, 3, 4, 5, 8, 16, 64, 1024, 1025, 2048, 2049} {
|
for _, npages := range []uintptr{1, 2, 3, 4, 5, 8, 16, 64, 1024, 1025, 2048, 2049} {
|
||||||
npages := npages
|
|
||||||
t.Run(fmt.Sprintf("%d", npages), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%d", npages), func(t *testing.T) {
|
||||||
// Construct b.
|
// Construct b.
|
||||||
bDesc := make(map[ChunkIdx][]BitRange)
|
bDesc := make(map[ChunkIdx][]BitRange)
|
||||||
|
|
@ -973,7 +970,6 @@ func TestPageAllocFree(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := NewPageAlloc(v.before, nil)
|
b := NewPageAlloc(v.before, nil)
|
||||||
defer FreePageAlloc(b)
|
defer FreePageAlloc(b)
|
||||||
|
|
@ -1028,7 +1024,6 @@ func TestPageAllocAllocAndFree(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := NewPageAlloc(v.init, nil)
|
b := NewPageAlloc(v.init, nil)
|
||||||
defer FreePageAlloc(b)
|
defer FreePageAlloc(b)
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,6 @@ func TestPageCacheAlloc(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
c := test.cache
|
c := test.cache
|
||||||
for i, h := range test.hits {
|
for i, h := range test.hits {
|
||||||
|
|
@ -407,7 +406,6 @@ func TestPageAllocAllocToCache(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := NewPageAlloc(v.beforeAlloc, v.beforeScav)
|
b := NewPageAlloc(v.beforeAlloc, v.beforeScav)
|
||||||
defer FreePageAlloc(b)
|
defer FreePageAlloc(b)
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,6 @@ func TestMallocBitsPopcntRange(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := makePallocBits(v.init)
|
b := makePallocBits(v.init)
|
||||||
for _, h := range v.tests {
|
for _, h := range v.tests {
|
||||||
|
|
@ -291,7 +290,6 @@ func TestPallocBitsSummarize(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := makePallocBits(v.free)
|
b := makePallocBits(v.free)
|
||||||
// In the PallocBits we create 1's represent free spots, but in our actual
|
// In the PallocBits we create 1's represent free spots, but in our actual
|
||||||
|
|
@ -436,7 +434,6 @@ func TestPallocBitsAlloc(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := makePallocBits(v.before)
|
b := makePallocBits(v.before)
|
||||||
for iter, i := range v.hits {
|
for iter, i := range v.hits {
|
||||||
|
|
@ -498,7 +495,6 @@ func TestPallocBitsFree(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for name, v := range tests {
|
for name, v := range tests {
|
||||||
v := v
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
b := makePallocBits(v.beforeInv)
|
b := makePallocBits(v.beforeInv)
|
||||||
invertPallocBits(b)
|
invertPallocBits(b)
|
||||||
|
|
|
||||||
|
|
@ -696,7 +696,6 @@ func BenchmarkCreateGoroutinesCapture(b *testing.B) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(N)
|
wg.Add(N)
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
i := i
|
|
||||||
go func() {
|
go func() {
|
||||||
if i >= N {
|
if i >= N {
|
||||||
b.Logf("bad") // just to capture b
|
b.Logf("bad") // just to capture b
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ func TestValueSwapConcurrent(t *testing.T) {
|
||||||
n = 1000
|
n = 1000
|
||||||
}
|
}
|
||||||
for i := uint64(0); i < m*n; i += n {
|
for i := uint64(0); i < m*n; i += n {
|
||||||
i := i
|
|
||||||
g.Add(1)
|
g.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
var c uint64
|
var c uint64
|
||||||
|
|
@ -256,7 +255,6 @@ func TestValueCompareAndSwapConcurrent(t *testing.T) {
|
||||||
n = 100
|
n = 100
|
||||||
}
|
}
|
||||||
for i := 0; i < m; i++ {
|
for i := 0; i < m; i++ {
|
||||||
i := i
|
|
||||||
w.Add(1)
|
w.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
for j := i; j < m*n; runtime.Gosched() {
|
for j := i; j < m*n; runtime.Gosched() {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ func whoamiNEWUSER(t *testing.T, uid, gid int, setgroups bool) *exec.Cmd {
|
||||||
|
|
||||||
func TestCloneNEWUSERAndRemap(t *testing.T) {
|
func TestCloneNEWUSERAndRemap(t *testing.T) {
|
||||||
for _, setgroups := range []bool{false, true} {
|
for _, setgroups := range []bool{false, true} {
|
||||||
setgroups := setgroups
|
|
||||||
t.Run(fmt.Sprintf("setgroups=%v", setgroups), func(t *testing.T) {
|
t.Run(fmt.Sprintf("setgroups=%v", setgroups), func(t *testing.T) {
|
||||||
uid := os.Getuid()
|
uid := os.Getuid()
|
||||||
gid := os.Getgid()
|
gid := os.Getgid()
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ func TestFlag(t *testing.T) {
|
||||||
testenv.MustHaveExec(t)
|
testenv.MustHaveExec(t)
|
||||||
|
|
||||||
for _, flag := range []string{"", "-test.v", "-test.v=test2json"} {
|
for _, flag := range []string{"", "-test.v", "-test.v=test2json"} {
|
||||||
flag := flag
|
|
||||||
t.Run(flag, func(t *testing.T) {
|
t.Run(flag, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
cmd := exec.Command(testenv.Executable(t), "-test.run=^TestFlag$", "-test_flag_arg="+flag)
|
cmd := exec.Command(testenv.Executable(t), "-test.run=^TestFlag$", "-test_flag_arg="+flag)
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ func TestPanicHelper(t *testing.T) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
i := i
|
|
||||||
t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
|
||||||
chosen := t.Name() == *testPanicTest
|
chosen := t.Name() == *testPanicTest
|
||||||
if chosen && *testPanicCleanup {
|
if chosen && *testPanicCleanup {
|
||||||
|
|
|
||||||
|
|
@ -988,7 +988,6 @@ func TestConcurrentCleanup(t *T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
i := i
|
|
||||||
go func() {
|
go func() {
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
// Although the calls to Cleanup are concurrent, the functions passed
|
// Although the calls to Cleanup are concurrent, the functions passed
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,6 @@ func BenchmarkParallelTimerLatency(b *testing.B) {
|
||||||
wg.Add(timerCount)
|
wg.Add(timerCount)
|
||||||
atomic.StoreInt32(&count, 0)
|
atomic.StoreInt32(&count, 0)
|
||||||
for j := 0; j < timerCount; j++ {
|
for j := 0; j < timerCount; j++ {
|
||||||
j := j
|
|
||||||
expectedWakeup := Now().Add(delay)
|
expectedWakeup := Now().Add(delay)
|
||||||
AfterFunc(delay, func() {
|
AfterFunc(delay, func() {
|
||||||
late := Since(expectedWakeup)
|
late := Since(expectedWakeup)
|
||||||
|
|
@ -1011,7 +1010,6 @@ func BenchmarkStaggeredTickerLatency(b *testing.B) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(tickerCount)
|
wg.Add(tickerCount)
|
||||||
for j := 0; j < tickerCount; j++ {
|
for j := 0; j < tickerCount; j++ {
|
||||||
j := j
|
|
||||||
doWork(delay / Duration(gmp))
|
doWork(delay / Duration(gmp))
|
||||||
expectedWakeup := Now().Add(delay)
|
expectedWakeup := Now().Add(delay)
|
||||||
ticker := NewTicker(delay)
|
ticker := NewTicker(delay)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue