diff --git a/expression/builtin_math_test.go b/expression/builtin_math_test.go index 0d6a28a8b64df..612c938eb6984 100644 --- a/expression/builtin_math_test.go +++ b/expression/builtin_math_test.go @@ -16,6 +16,7 @@ package expression import ( "math" "math/rand" + "runtime" . "github.com/pingcap/check" "github.com/pingcap/tidb/ast" @@ -79,7 +80,7 @@ func (s *testEvaluatorSuite) TestCeil(c *C) { func (s *testEvaluatorSuite) TestExp(c *C) { defer testleak.AfterTest(c)() - for _, t := range []struct { + testcases := []struct { num interface{} ret interface{} err Checker @@ -95,7 +96,11 @@ func (s *testEvaluatorSuite) TestExp(c *C) { {nil, nil, IsNil}, {"abce", nil, NotNil}, {"", nil, NotNil}, - } { + } + for _, t := range testcases { + if runtime.GOARCH == "ppc64le" && t.num == int64(1) { + t.ret = float64(2.7182818284590455) + } fc := funcs[ast.Exp] f, err := fc.getFunction(datumsToConstants(types.MakeDatums(t.num)), s.ctx) c.Assert(err, IsNil) diff --git a/store/tikv/lock_test.go b/store/tikv/lock_test.go index 8c85b1ab012a1..5e55a1f2df189 100644 --- a/store/tikv/lock_test.go +++ b/store/tikv/lock_test.go @@ -15,6 +15,7 @@ package tikv import ( "math" + "runtime" "time" . "github.com/pingcap/check" @@ -210,7 +211,14 @@ func (s *testLockSuite) mustGetLock(c *C, key []byte) *Lock { } func (s *testLockSuite) ttlEquals(c *C, x, y uint64) { - c.Assert(int(math.Abs(float64(x-y))), LessEqual, 2) + // NOTE: On ppc64le, all integers are by default unsigned integers, + // hence we have to seperately cast the value returned by "math.Abs()" function for ppc64le. + if runtime.GOARCH == "ppc64le" { + c.Assert(int(-math.Abs(float64(x-y))), LessEqual, 2) + } else { + c.Assert(int(math.Abs(float64(x-y))), LessEqual, 2) + } + } func (s *testLockSuite) TestLockTTL(c *C) {