Bug 105253 - 2 clampTo unit tests are failing
Summary: 2 clampTo unit tests are failing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-17 22:00 PST by Julien Chaffraix
Modified: 2012-12-19 09:46 PST (History)
3 users (show)

See Also:


Attachments
Proposed fix. (2.61 KB, patch)
2012-12-18 18:03 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2012-12-17 22:00:47 PST
clampToUnsigned is failing on 2 bots and clampToFloat is failing only on Apple Win:

http://build.webkit.org/builders/Chromium%20Mac%20Release%20%28Tests%29/builds/30528/steps/run-api-tests/logs/stdio
http://build.webkit.org/builders/Apple%20Win%207%20Release%20%28Tests%29/builds/31009/steps/run-api-tests/logs/stdio

Here are the failures:

Note: Google Test filter = WTF.clampToIntegerFloat
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from WTF
[ RUN      ] WTF.clampToIntegerFloat
..\Tests\WTF\MathExtras.cpp(103): error: Value of: maxInt
  Actual: 2147483648
Expected: clampToInteger(maxInt)
Which is: 2147483647
..\Tests\WTF\MathExtras.cpp(106): error: Value of: maxInt
  Actual: 2147483648
Expected: clampToInteger(overflowInt)
Which is: 2147483647
[  FAILED  ] WTF.clampToIntegerFloat (0 ms)
[----------] 1 test from WTF (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] WTF.clampToIntegerFloat

 1 FAILED TEST
Note: Google Test filter = WTF.clampToUnsigned
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from WTF
[ RUN      ] WTF.clampToUnsigned
..\Tests\WTF\MathExtras.cpp(153): error: Value of: maxUnsigned
  Actual: 4294967295
Expected: clampTo<unsigned>(overflowUnsigned)
Which is: 0
[  FAILED  ] WTF.clampToUnsigned (0 ms)
[----------] 1 test from WTF (0 ms total)
Comment 1 Julien Chaffraix 2012-12-17 22:12:11 PST
Disabled the test in http://trac.webkit.org/changeset/137986.
Comment 2 Emil A Eklund 2012-12-18 11:03:17 PST
The windows unsigned failure is due to sizeof(unsigned long) == sizeof(unsigned) on windows 64bit (as it used the LLP64 memory model).

Adding a sizeof check as you have for clampToIntLong should do the trick.

The chromium mac failure seems to be due to float imprecision, EXPECT_NEAR with a tolerance of 1 should do the trick.
Comment 3 Julien Chaffraix 2012-12-18 17:11:24 PST
(In reply to comment #2)
> The windows unsigned failure is due to sizeof(unsigned long) == sizeof(unsigned) on windows 64bit (as it used the LLP64 memory model).
> 
> Adding a sizeof check as you have for clampToIntLong should do the trick.

True, but clampToUnsigned is testing the same case as clampToUnsignedLong as we can't test overflowing without a type that is wider than unsigned. This makes me lean towards just removing this test (FWIW we don't have a clampToInt for this very reason).

> The chromium mac failure seems to be due to float imprecision, EXPECT_NEAR with a tolerance of 1 should do the trick.

Good catch, that should fix the issue.
Comment 4 Julien Chaffraix 2012-12-18 18:03:22 PST
Created attachment 180069 [details]
Proposed fix.
Comment 5 Julien Chaffraix 2012-12-19 09:43:30 PST
Comment on attachment 180069 [details]
Proposed fix.

Thanks, Emil!
Comment 6 WebKit Review Bot 2012-12-19 09:46:52 PST
Comment on attachment 180069 [details]
Proposed fix.

Clearing flags on attachment: 180069

Committed r138176: <http://trac.webkit.org/changeset/138176>
Comment 7 WebKit Review Bot 2012-12-19 09:46:56 PST
All reviewed patches have been landed.  Closing bug.