From deba3ee07f2a5730fbf4f4bfebf28514c1b58d84 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Sep 28 2019 08:54:09 +0000 Subject: update to 1.8.4 (#1742049) backport upstream patch for 32-bit arches increase zstd encoder_test timeout (times out on ARM) --- diff --git a/.gitignore b/.gitignore index 4c7af03..7a5f7e0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /compress-1.5.0.tar.gz /compress-1.7.0.tar.gz /compress-1.7.2.tar.gz +/compress-1.8.4.tar.gz diff --git a/0001-Fix-32-bit-system-test-runs.patch b/0001-Fix-32-bit-system-test-runs.patch new file mode 100644 index 0000000..6657ff0 --- /dev/null +++ b/0001-Fix-32-bit-system-test-runs.patch @@ -0,0 +1,126 @@ +From b999e7024499cc5228e176cd41f9646aa185f7a9 Mon Sep 17 00:00:00 2001 +From: Klaus Post +Date: Fri, 27 Sep 2019 09:53:13 -0700 +Subject: [PATCH] Fix 32 bit system test runs + +Fixes #163 +--- + .travis.yml | 2 +- + s2/encode.go | 3 ++- + s2/s2.go | 2 +- + s2/s2_test.go | 18 +++++++++++++----- + zstd/encoder_options_test.go | 1 - + 5 files changed, 17 insertions(+), 9 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index 332adc6..4afed80 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -22,7 +22,7 @@ script: + - go test -cpu=2 -tags=noasm ./... + - go test -cpu=1,4 -short -race ./... + - go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d && s2c s2c && s2d s2c.s2 && rm s2c && rm s2d && rm s2c.s2 +- - GOOS=linux GOARCH=386 go install ./... ++ - GOOS=linux GOARCH=386 go test -short ./... + + matrix: + allow_failures: +diff --git a/s2/encode.go b/s2/encode.go +index d8aff0e..fc82889 100644 +--- a/s2/encode.go ++++ b/s2/encode.go +@@ -161,6 +161,7 @@ const MaxBlockSize = math.MaxUint32 - binary.MaxVarintLen32 - 5 + // uncompressed length. + // + // It will return a negative value if srcLen is too large to encode. ++// 32 bit platforms will have lower thresholds for rejecting big content. + func MaxEncodedLen(srcLen int) int { + n := uint64(srcLen) + if n > 0xffffffff { +@@ -171,7 +172,7 @@ func MaxEncodedLen(srcLen int) int { + n = n + uint64((bits.Len64(n)+7)/7) + + // Add maximum size of encoding block as literals. +- n += uint64(literalExtraSize(srcLen)) ++ n += uint64(literalExtraSize(int64(srcLen))) + if n > 0xffffffff { + return -1 + } +diff --git a/s2/s2.go b/s2/s2.go +index f0ed32a..c98da6c 100644 +--- a/s2/s2.go ++++ b/s2/s2.go +@@ -110,7 +110,7 @@ func crc(b []byte) uint32 { + + // literalExtraSize returns the extra size of encoding n literals. + // n should be >= 0 and <= math.MaxUint32. +-func literalExtraSize(n int) int { ++func literalExtraSize(n int64) int64 { + if n == 0 { + return 0 + } +diff --git a/s2/s2_test.go b/s2/s2_test.go +index fbc461a..d90c21c 100644 +--- a/s2/s2_test.go ++++ b/s2/s2_test.go +@@ -24,6 +24,9 @@ import ( + "github.com/klauspost/compress/snappy" + ) + ++const maxUint = ^uint(0) ++const maxInt = int(maxUint >> 1) ++ + var ( + download = flag.Bool("download", false, "If true, download any missing files before running benchmarks") + testdataDir = flag.String("testdataDir", "testdata", "Directory containing the test data") +@@ -32,10 +35,10 @@ var ( + + func TestMaxEncodedLen(t *testing.T) { + testSet := []struct { +- in, out int ++ in, out int64 + }{ + {in: 0, out: 1}, +- {in: 1 << 24, out: 1<<24 + binary.PutVarint([]byte{binary.MaxVarintLen32: 0}, int64(1<<24)) + literalExtraSize(1<<24)}, ++ {in: 1 << 24, out: 1<<24 + int64(binary.PutVarint([]byte{binary.MaxVarintLen32: 0}, int64(1<<24))) + literalExtraSize(1<<24)}, + {in: MaxBlockSize, out: math.MaxUint32}, + {in: math.MaxUint32 - binary.MaxVarintLen32 - literalExtraSize(math.MaxUint32), out: math.MaxUint32}, + {in: math.MaxUint32 - 9, out: -1}, +@@ -51,14 +54,19 @@ func TestMaxEncodedLen(t *testing.T) { + {in: -1, out: -1}, + {in: -2, out: -1}, + } ++ // 32 bit platforms have a different threshold. ++ if maxInt == math.MaxInt32 { ++ testSet[2].out = -1 ++ testSet[3].out = -1 ++ } + // Test all sizes up to maxBlockSize. +- for i := 0; i < maxBlockSize; i++ { +- testSet = append(testSet, struct{ in, out int }{in: i, out: i + binary.PutVarint([]byte{binary.MaxVarintLen32: 0}, int64(i)) + literalExtraSize(i)}) ++ for i := int64(0); i < maxBlockSize; i++ { ++ testSet = append(testSet, struct{ in, out int64 }{in: i, out: i + int64(binary.PutVarint([]byte{binary.MaxVarintLen32: 0}, i)) + literalExtraSize(i)}) + } + for i := range testSet { + tt := testSet[i] + want := tt.out +- got := MaxEncodedLen(tt.in) ++ got := int64(MaxEncodedLen(int(tt.in))) + if got != want { + t.Fatalf("input: %d, want: %d, got: %d", tt.in, want, got) + } +diff --git a/zstd/encoder_options_test.go b/zstd/encoder_options_test.go +index f691405..23db3da 100644 +--- a/zstd/encoder_options_test.go ++++ b/zstd/encoder_options_test.go +@@ -132,7 +132,6 @@ func TestWindowSize(t *testing.T) { + {(1 << 10) + 1, true}, + {(1 << 10) * 3, true}, + {1 << 30, false}, +- {1 << 31, true}, + } + for _, tt := range tests { + t.Run(strconv.Itoa(tt.windowSize), func(t *testing.T) { +-- +2.21.0 + diff --git a/golang-github-klauspost-compress-timeout.patch b/golang-github-klauspost-compress-timeout.patch new file mode 100644 index 0000000..e4b0dc3 --- /dev/null +++ b/golang-github-klauspost-compress-timeout.patch @@ -0,0 +1,12 @@ +diff -up compress-1.8.4/zstd/encoder_test.go.timeout compress-1.8.4/zstd/encoder_test.go +--- compress-1.8.4/zstd/encoder_test.go.timeout 2019-09-18 00:41:01.000000000 +0000 ++++ compress-1.8.4/zstd/encoder_test.go 2019-09-14 19:48:15.523420380 +0000 +@@ -97,7 +97,7 @@ func TestEncoder_EncodeAllEncodeXML(t *t + } + + func TestEncoderRegression(t *testing.T) { +- defer timeout(30 * time.Second)() ++ defer timeout(35 * time.Second)() + data, err := ioutil.ReadFile("testdata/comp-crashers.zip") + if err != nil { + t.Fatal(err) diff --git a/golang-github-klauspost-compress.spec b/golang-github-klauspost-compress.spec index e76d40b..dc1cb77 100644 --- a/golang-github-klauspost-compress.spec +++ b/golang-github-klauspost-compress.spec @@ -5,7 +5,7 @@ # https://github.com/klauspost/compress %global goipath github.com/klauspost/compress -Version: 1.7.2 +Version: 1.8.4 %gometa @@ -30,6 +30,10 @@ Summary: Optimized compression packages License: BSD URL: %{gourl} Source0: %{gosource} +# https://github.com/klauspost/compress/issues/163 +Patch0: 0001-Fix-32-bit-system-test-runs.patch +# https://github.com/klauspost/compress/issues/165 +Patch1: %{name}-timeout.patch BuildRequires: golang(github.com/cespare/xxhash) BuildRequires: golang(github.com/klauspost/cpuid) @@ -47,6 +51,8 @@ BuildRequires: golang(github.com/google/go-cmp/cmp) %prep %goprep +%patch0 -p1 -b .i163 +%patch1 -p1 -b .timeout %install %gopkginstall @@ -59,6 +65,11 @@ BuildRequires: golang(github.com/google/go-cmp/cmp) %gopkgfiles %changelog +* Fri Sep 27 2019 Dominik Mierzejewski - 1.8.4-1 +- update to 1.8.4 (#1742049) +- backport upstream patch for 32-bit arches +- increase zstd encoder_test timeout (times out on ARM) + * Wed Jul 24 23:24:20 CEST 2019 Robert-André Mauchin - 1.7.2-1 - Release 1.7.2 diff --git a/sources b/sources index 569ffd2..7a27dd0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (compress-1.7.2.tar.gz) = d0bf183fb867ea3a2eb47f1913ba79afa004b729f89f82b5990080d5e139c81e79ff97c72f8ab8caec8b3b4163cb5bd7d873bd12b24e62e8fccb2bd975d665e3 +SHA512 (compress-1.8.4.tar.gz) = 2027941437e6da52e0c132b072e9c50ad74cb1731934b57ceff753800eb202049bd8bbf1af76304aa214142aa05967c6b30803e148f8b8da61e3b520e5b4a9d5