From b6a726222a8ef3bfe46402a46b15d79c6b19b6d6 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 6 Dec 2021 14:04:30 +0200 Subject: gnu: go-github-com-golang-snappy: Adjust test-suite on 32-bit systems. * gnu/packages/syncthing.scm (go-github-com-golang-snappy)[source]: Add patch to skip a test on 32-bit systems. * gnu/packages/patches/go-github-com-golang-snappy-32bit-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + .../go-github-com-golang-snappy-32bit-test.patch | 53 ++++++++++++++++++++++ gnu/packages/syncthing.scm | 3 +- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/go-github-com-golang-snappy-32bit-test.patch diff --git a/gnu/local.mk b/gnu/local.mk index e61e825ba3..b91d6eaa62 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1196,6 +1196,7 @@ dist_patch_DATA = \ %D%/packages/patches/gobject-introspection-cc.patch \ %D%/packages/patches/gobject-introspection-girepository.patch \ %D%/packages/patches/go-fix-script-tests.patch \ + %D%/packages/patches/go-github-com-golang-snappy-32bit-test.patch \ %D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \ %D%/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch \ %D%/packages/patches/go-skip-gc-test.patch \ diff --git a/gnu/packages/patches/go-github-com-golang-snappy-32bit-test.patch b/gnu/packages/patches/go-github-com-golang-snappy-32bit-test.patch new file mode 100644 index 0000000000..95b5819cdb --- /dev/null +++ b/gnu/packages/patches/go-github-com-golang-snappy-32bit-test.patch @@ -0,0 +1,53 @@ +https://salsa.debian.org/go-team/packages/golang-github-golang-snappy/-/raw/debian/0.0.2-2/debian/patches/0002-Skip-failed-test-on-32bit-system.patch + +From: Shengjing Zhu +Date: Sun, 31 Jan 2021 22:41:42 +0800 +Subject: Skip failed test on 32bit system + +The test doesn't pass on old version too, not a regression. + +Bug: https://github.com/golang/snappy/issues/58 +--- + snappy_test.go | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/snappy_test.go b/snappy_test.go +index d7c3ea6..c310ba1 100644 +--- a/snappy_test.go ++++ b/snappy_test.go +@@ -19,6 +19,7 @@ import ( + "runtime" + "strings" + "testing" ++ "unsafe" + ) + + var ( +@@ -316,13 +317,22 @@ func TestDecode(t *testing.T) { + "\x06" + "\x0cabcd" + "\x07\x03\x00\x00\x00", + "abcdbc", + nil, +- }, { +- `decodedLen=0; tagCopy4, 4 extra length|offset bytes; with msb set (0x93); discovered by go-fuzz`, +- "\x00\xfc000\x93", +- "", +- ErrCorrupt, + }} + ++ if unsafe.Sizeof(int(0)) == 8 { ++ testCases = append(testCases, struct { ++ desc string ++ input string ++ want string ++ wantErr error ++ }{ ++ `decodedLen=0; tagCopy4, 4 extra length|offset bytes; with msb set (0x93); discovered by go-fuzz`, ++ "\x00\xfc000\x93", ++ "", ++ ErrCorrupt, ++ }) ++ } ++ + const ( + // notPresentXxx defines a range of byte values [0xa0, 0xc5) that are + // not present in either the input or the output. It is written to dBuf diff --git a/gnu/packages/syncthing.scm b/gnu/packages/syncthing.scm index 4deb60bee2..aa718e5e2d 100644 --- a/gnu/packages/syncthing.scm +++ b/gnu/packages/syncthing.scm @@ -412,7 +412,8 @@ processes.") (file-name (git-file-name name version)) (sha256 (base32 - "004cw699yz3pdpawhjhpa0y94c4w479nw1rf39zj6h6027kpwv2j")))) + "004cw699yz3pdpawhjhpa0y94c4w479nw1rf39zj6h6027kpwv2j")) + (patches (search-patches "go-github-com-golang-snappy-32bit-test.patch")))) (build-system go-build-system) (arguments `(#:import-path "github.com/golang/snappy")) -- cgit v1.2.3