-
Notifications
You must be signed in to change notification settings - Fork 101
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
bytes package tests test implementation defined behaviour #37
Comments
ondrejbudai
added a commit
to ondrejbudai/gommon
that referenced
this issue
Aug 26, 2020
8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use the fact that on x86_64 the following expressions holds true: int64(0) - 1 == math.MaxInt64. However, this is not true for other platforms, specifically aarch64, s390x and ppc64le. This commit fixes it by testing the library with 7 exbi. Fixes labstack#37
ondrejbudai
added a commit
to ondrejbudai/gommon
that referenced
this issue
Aug 26, 2020
8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use the fact that on x86_64 the following expressions holds true: int64(0) - 1 == math.MaxInt64. However, this is not true for other platforms, specifically aarch64, s390x and ppc64le. This commit fixes it by testing the library with 7 exbi. Fixes labstack#37
ondrejbudai
added a commit
to ondrejbudai/gommon
that referenced
this issue
Aug 26, 2020
8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use the fact that on x86_64 the following expressions holds true: int64(0) - 1 == math.MaxInt64. However, this is not true for other platforms, specifically aarch64, s390x and ppc64le. This commit fixes it by testing the library with 7 exbi. Fixes labstack#37
ondrejbudai
added a commit
to ondrejbudai/gommon
that referenced
this issue
Aug 26, 2020
8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use the fact that on x86_64 the following expressions holds true: int64(0) - 1 == math.MaxInt64. However, this is not true for other platforms, specifically aarch64, s390x and ppc64le. This commit fixes it by testing the library with 7 exbi. Fixes labstack#37
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As can currently be seen at https://people.canonical.com/~ubuntu-archive/proposed-migration/update_excuses.html#golang-github-labstack-gommon, the tests for the bytes package fail on arm64, ppc64el and s390x architectures. This turns out to be because the tests depend on the conversion of the (just) too large float math.Pow(2, 64) to int64 returning MinInt64. On these platforms it seems the conversion saturates and returns MaxInt64. FWIW the standard says:
so the tests shouldn't depend on this, or if this behaviour is important then the implementation needs to take care to enforce it. I don't really see a reason why the tests need to push the edge of the range of int64 like this so I'll probably patch them in Ubuntu to test smaller values.
The text was updated successfully, but these errors were encountered: