Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests error on aarch64, ppc64le, s390x #20

Closed
eclipseo opened this issue Jul 1, 2019 · 2 comments
Closed

Tests error on aarch64, ppc64le, s390x #20

eclipseo opened this issue Jul 1, 2019 · 2 comments

Comments

@eclipseo
Copy link

eclipseo commented Jul 1, 2019

Golang 1.12.6 on aarch64, ppc64le, s390x:

Testing    in: /builddir/build/BUILD/gift-1.2.0/_build/src
         PATH: /builddir/build/BUILD/gift-1.2.0/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/gift-1.2.0/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X github.com/disintegration/gift/version=1.2.0 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: github.com/disintegration/gift
github.com/disintegration/gift
--- FAIL: TestBrightness (0.00s)
    colors_test.go:434: test [brightness (-30)] failed: image.Rectangle{Min:image.Point{X:0, Y:0}, Max:image.Point{X:5, Y:3}}, []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x64, 0x54, 0x64, 0x14, 0x0, 0x34, 0x0, 0x34, 0x0}
--- FAIL: TestGolden (0.61s)
    gift_test.go:593: resulting image differs from golden: contrast_increase
    gift_test.go:593: resulting image differs from golden: saturation_decrease
    gift_test.go:593: resulting image differs from golden: saturation_increase
    gift_test.go:593: resulting image differs from golden: hue_rotate
FAIL
@disintegration
Copy link
Owner

Thank you for the report! It should be fixed now.

The Go compiler now implements a fused multiply and add (FMA) instruction on some architectures, which leads to floating-point rounding differences compared to amd64.

https://golang.org/ref/spec#Floating_point_operators

I've modified the golden tests by adding a tolerance when comparing two images on architectures other than amd64. As for for brightness test, I've adjusted the input to avoid rounding differences.

@disintegration
Copy link
Owner

I'm closing the issue now. Feel free to reopen if needed.

anthonyfok added a commit to anthonyfok/hugo that referenced this issue Oct 7, 2019
In TestImageOperationsGolden, tolerate slight floating-point rounding
differences due to the use or non-use of "fused multiply and add" (FMA)
instruction on different architectures.

Special thanks to @disintegration for the solution in goldenEqual();
see disintegration/gift#20

Fixes gohugoio#6387
bep pushed a commit to gohugoio/hugo that referenced this issue Oct 7, 2019
In TestImageOperationsGolden, tolerate slight floating-point rounding
differences due to the use or non-use of "fused multiply and add" (FMA)
instruction on different architectures.

Special thanks to @disintegration for the solution in goldenEqual();
see disintegration/gift#20

Fixes #6387
prashantkhoje added a commit to prashantkhoje/geo that referenced this issue Jul 27, 2022
This was exposed while testing CockroachDB.
Following tests from pkg/sql/opt/exec/execbuilder fail due to floating point precision differences caused by FMA:
- TestExecBuild/local/geospatial
- TestExecBuild/local-vec-off/geospatial
- TestExecBuild/local-spec-planning/geospatial
- TestExecBuild/fakedist/geospatial
- TestExecBuild/fakedist-vec-off/geospatial
- TestExecBuild/fakedist-metadata/geospatial
- TestExecBuild/fakedist-disk/geospatial
- TestExecBuild/fakedist-spec-planning/geospatial

With explicit casts in this patch, these failures are resolved.

References:
https://go.dev/ref/spec#Floating_point_operators
golang/go#53297
golang/go#48145
disintegration/gift#20 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants