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

[wasm] System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests fails with randomized test order #65671

Open
radical opened this issue Feb 21, 2022 · 3 comments
Assignees
Labels
area-System.Numerics test-bug Problem in test source code (most likely)
Milestone

Comments

@radical
Copy link
Member

radical commented Feb 21, 2022

Found on #65628 which runs tests in a random order.

Random test failure with v8/linux, but seems to be reliably reproducible with XUNIT_RANDOM_ORDER_SEED=1883302047:

[03:29:54] info: Starting:    System.Runtime.Numerics.Tests.dll
[03:29:58] fail: [FAIL] System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests
[03:29:58] info: Assert.Equal() Failure
[03:29:58] info:           ↓ (pos 0)
[03:29:58] info: Expected: -0
[03:29:58] info: Actual:   0
[03:29:58] info:           ↑ (pos 0)
[03:29:58] info:    at System.Numerics.Tests.cast_toTest.VerifyDoubleExplicitCastToBigInteger(Double value)
[03:29:58] info:    at System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests()
[03:29:58] info:    at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)

To test it with that PR, make sure to <XUnitUseRandomizedTestOrderer>false</XUnitUseRandomizedTestOrderer> from the csproj.

@radical radical added the arch-wasm WebAssembly architecture label Feb 21, 2022
@ghost
Copy link

ghost commented Feb 21, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Found on #65628 which runs tests in a random order.

Random test failure with v8/linux, but seems to be reliably reproducible with XUNIT_RANDOM_ORDER_SEED=1883302047:

[03:29:54] info: Starting:    System.Runtime.Numerics.Tests.dll
[03:29:58] fail: [FAIL] System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests
[03:29:58] info: Assert.Equal() Failure
[03:29:58] info:           ↓ (pos 0)
[03:29:58] info: Expected: -0
[03:29:58] info: Actual:   0
[03:29:58] info:           ↑ (pos 0)
[03:29:58] info:    at System.Numerics.Tests.cast_toTest.VerifyDoubleExplicitCastToBigInteger(Double value)
[03:29:58] info:    at System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests()
[03:29:58] info:    at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)

To test it with that PR, make sure to <XUnitUseRandomizedTestOrderer>false</XUnitUseRandomizedTestOrderer> from the csproj.

Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Numerics untriaged New issue has not been triaged by the area owner labels Feb 21, 2022
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label May 25, 2022
@lewing lewing added this to the 7.0.0 milestone May 25, 2022
@vargaz
Copy link
Contributor

vargaz commented May 25, 2022

This is still reproducible.

@vargaz
Copy link
Contributor

vargaz commented May 25, 2022

This seems to be a problem with the test itself. It uses randomized values, which could lead to random failures.
In this case, this code:
https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime.Numerics/tests/BigInteger/cast_to.cs#L663
is called with a value like -0.1, and it basically does:

        double value = -0.1;
        Console.WriteLine (Math.Ceiling (value).ToString () == ((BigInteger)value).ToString ());

which fails because Math.Ceiling ().ToString () returns "-0".

@dakersnar dakersnar modified the milestones: 7.0.0, 8.0.0, Future Aug 8, 2022
@dakersnar dakersnar added test-bug Problem in test source code (most likely) and removed arch-wasm WebAssembly architecture labels Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Numerics test-bug Problem in test source code (most likely)
Projects
None yet
Development

No branches or pull requests

4 participants