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

Adding ppc64le specific fixes for tests "expression/builtin_math_test.go" and "store/tikv/lock_test.go" #3477

Merged
merged 9 commits into from
Jun 19, 2017

Conversation

YugandhaD
Copy link
Contributor

@YugandhaD YugandhaD commented Jun 14, 2017

Changes made in: I have changed two test cases.

The changes were required because of the different behavior of some casting and exponential operations on ppc64le platform.

Two tests “github.com/pingcap/tidb/store/tikv”, and “github.com/pingcap/tidb/expression”, are failing on ppc64le platform.

• For “github.com/pingcap/tidb/store/tikv”:
This tests is failing as its subtest “lock_test.go” fails. The test fails with assertion error, which is due to the casting operation in the test where float is casted to a signed int. However, on ppc64le, all integers are unsigned integers by default, so we need to do the casting separately. I have updated it in the patch and changes I made are ppc64le specific.

• For “github.com/pingcap/tidb/expression”:
This test case was also failing with assertion error for builtin_math_test.go. The main cause of the assertion error here was an exponential operation being performed. For math.Exp(1), both x86 and ppc64le shows up different values. For x86 the value is 2.718281828459045 and for ppc64le the value is 2.7182818284590455 where we can see a single digit precision difference. I have changed the test case accordingly in case of ppc64le.

I have raised a github issue for above test failure: #3376

@ngaut
Copy link
Member

ngaut commented Jun 14, 2017

Good job.

@shenli
Copy link
Member

shenli commented Jun 14, 2017

@YugandhaD CI failed. Please make sure you could pass make check.

@YugandhaD
Copy link
Contributor Author

Yes, I am looking into it to fix this.
Thanks.

Copy link
Contributor

@tiancaiamao tiancaiamao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

c.Assert(err, t.err)
c.Assert(v, testutil.DatumEquals, types.NewDatum(t.ret))
if runtime.GOARCH == "ppc64le" {
for _, t := range []struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testcases := []struct {...} {...}
for _, t := range testcases {
}

c.Assert(v, testutil.DatumEquals, types.NewDatum(t.ret))
}
} else {
for _, t := range []struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

. "github.com/pingcap/check"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/store/tikv/tikvrpc"
goctx "golang.org/x/net/context"
"math"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put Go standard packages first, then third-part packages, split with a newline.

@YugandhaD
Copy link
Contributor Author

@tiancaiamao I have optimized my code as per your suggestions , and the CI for c18161d also passing now. Could you please have a look once?
Thanks.

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 16, 2017
@shenli
Copy link
Member

shenli commented Jun 19, 2017

LGTM
@YugandhaD Thanks!

@tiancaiamao tiancaiamao merged commit 5b979d0 into pingcap:master Jun 19, 2017
@YugandhaD
Copy link
Contributor Author

Thanks!

@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants