aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authormiller <millerresearch@gmail.com>2023-05-18 11:25:48 +0100
committerGopher Robot <gobot@golang.org>2023-08-03 19:23:26 +0000
commit873f76d27bc403c266df25a4d74e10276fd42c8d (patch)
treefa7cc10ae6b9147871794f419175905aad0bc194 /src/encoding
parent976a84b1ff14ca3bcd6b31001c25d0c552dd50d0 (diff)
downloadgo-873f76d27bc403c266df25a4d74e10276fd42c8d.tar.xz
encoding/gob: skip TestLargeSlice on machines with small address space
The encoding/gob.TestLargeSlice test needs too much virtual memory to run reliably on machines with a small address space, for example the plan9-arm builders where user processes only have 1 gigabyte. Fixes #60284 Change-Id: Ied88630e5ec6685e14d2060ae316abca1619f9b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/496138 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: David du Colombier <0intro@gmail.com> Run-TryBot: David du Colombier <0intro@gmail.com>
Diffstat (limited to 'src/encoding')
-rw-r--r--src/encoding/gob/codec_test.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/encoding/gob/codec_test.go b/src/encoding/gob/codec_test.go
index 28cd6088af..11a38f5f58 100644
--- a/src/encoding/gob/codec_test.go
+++ b/src/encoding/gob/codec_test.go
@@ -14,6 +14,7 @@ import (
"strings"
"testing"
"time"
+ "unsafe"
)
var doFuzzTests = flag.Bool("gob.fuzz", false, "run the fuzz tests, which are large and very slow")
@@ -1566,7 +1567,9 @@ func testEncodeDecode(t *testing.T, in, out any) {
func TestLargeSlice(t *testing.T) {
t.Run("byte", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel() // Only run in parallel in a large address space
+ }
s := make([]byte, 10<<21)
for i := range s {
s[i] = byte(i)
@@ -1576,7 +1579,9 @@ func TestLargeSlice(t *testing.T) {
testEncodeDecode(t, st, rt)
})
t.Run("int8", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]int8, 10<<21)
for i := range s {
s[i] = int8(i)
@@ -1586,7 +1591,9 @@ func TestLargeSlice(t *testing.T) {
testEncodeDecode(t, st, rt)
})
t.Run("struct", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]StringPair, 1<<21)
for i := range s {
s[i].A = string(rune(i))
@@ -1597,7 +1604,9 @@ func TestLargeSlice(t *testing.T) {
testEncodeDecode(t, st, rt)
})
t.Run("string", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]string, 1<<21)
for i := range s {
s[i] = string(rune(i))