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

Clock resolution test failures on WSL with Nix #31

Open
AlexKnauth opened this issue Jan 20, 2022 · 8 comments
Open

Clock resolution test failures on WSL with Nix #31

AlexKnauth opened this issue Jan 20, 2022 · 8 comments

Comments

@AlexKnauth
Copy link

I'm getting these clock resolution test failures when installing time-compat on my Windows machine with WSL and Nix:

    resolution
      getCurrentTime:                                                             FAIL (0.14s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.000000001s
         but got: 0.0000001s
      taiClock:                                                                   FAIL (0.15s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.000000001s
         but got: 0.0000001s
2 out of 859 tests failed (0.89s)
Test suite main: FAIL
Test suite logged to: dist/test/time-compat-1.9.5-main.log
Test suite instances: RUNNING...
Test suite instances: PASS
Test suite logged to: dist/test/time-compat-1.9.5-instances.log
1 of 2 test suites (1 of 2 test cases) passed.

I got these while attempting to install nix-thunk on WSL, see: obsidiansystems/nix-thunk#23

The failure is coming from assertEqual "resolution" res $ gcdAll times here:

assertEqual "resolution" res $ gcdAll times

@rickynils
Copy link

I see the same error when building on aarch64-linux (on https://nixbuild.net):

    resolution
      getCurrentTime:                                                             FAIL (0.13s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.000000001s
         but got: 0.00000004s
        Use -p '/getCurrentTime/' to rerun this test only.
      taiClock:                                                                   FAIL (0.14s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.000000001s
         but got: 0.00000004s
        Use -p '/taiClock/' to rerun this test only.

@phadej
Copy link
Collaborator

phadej commented Aug 20, 2022

getTime_resolution is only shimmed for relatively old time versions. Have either of you tried to run time tests?

@matoro
Copy link
Contributor

matoro commented Sep 13, 2022

I am getting a similar but opposite error on riscv64-linux; where the expected resolution is less precise than the actual resolution:

    resolution
      getCurrentTime:                                                             FAIL (1.21s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/getCurrentTime/' to rerun this test only.
      taiClock:                                                                   FAIL (1.22s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/taiClock/' to rerun this test only.

@phadej
Copy link
Collaborator

phadej commented Sep 14, 2022

@matoro same question applies to you:

getTime_resolution is only shimmed for relatively old time versions. Have you tried to run time tests?

@zeldin
Copy link

zeldin commented Sep 15, 2022

I have the same result as matoro when running tests on riscv64-linux:

    resolution
      getCurrentTime:                                                             FAIL (1.21s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/getCurrentTime/' to rerun this test only.
      taiClock:                                                                   FAIL (1.25s)
        test/main/Test/Clock/Resolution.hs:57:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/taiClock/' to rerun this test only.

I also tried running tests on https://github.com/haskell/time, both version 1.9.3 (the one bundled with ghc 9.0.2) and version 1.12.2 (the current one). 1.12.2 passed all its tests, but 1.9.3 did give familiar test fails:

  LocalTime
      getCurrentTime:                                                             FAIL (1.20s)
        test/main/Test/Clock/Resolution.hs:43:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/getCurrentTime/' to rerun this test only.
      taiClock:                                                                   FAIL (3.92s)
        test/main/Test/Clock/Resolution.hs:43:
        resolution
        expected: 0.004s
         but got: 0.000000001s
        Use -p '/taiClock/' to rerun this test only.

@phadej
Copy link
Collaborator

phadej commented Sep 16, 2022

       expected: 0.004s
         but got: 0.000000001s

is ok, getting smaller resolution than expected (i.e. clock is more precise that it says).
The time test-suite has done that recently: haskell/time@6516a35

Patch to fix test-suite (from == to <=) is welcome.

(As I don't have a system where it fails, it's harder for me to get it right).


In original reports

        expected: 0.000000001s
         but got: 0.00000004s

getting larger resolutions that what is actually reported is bad :( but they should test with time test-suite first.

matoro added a commit to matoro/time-compat that referenced this issue Sep 16, 2022
The upstream version of time was incorrect in newer versions until
haskell/time@6516a35.
Because the compat implementation was correct and the upstream version
of time is now logically identical, simply replace both versions with
the current upstream time implementation.

See haskellari#31 for details on
which platforms the distinction matters.  Does NOT close that issue
though, because the original issue is for platforms on which the actual
resolution is less precise than the expected, and this will only fix
platforms on which the actual resolution is more precise.
matoro added a commit to matoro/time-compat that referenced this issue Sep 16, 2022
The upstream version of time was incorrect in newer versions until
haskell/time@6516a35.
Because the compat implementation was correct and the upstream version
of time is now logically identical, simply replace both versions with
the current upstream time implementation.

See haskellari#31 for details on
which platforms the distinction matters.  Does NOT close that issue
though, because the original issue is for platforms on which the actual
resolution is less precise than the expected, and this will only fix
platforms on which the actual resolution is more precise.
@phadej
Copy link
Collaborator

phadej commented Oct 14, 2024

@NorfairKing same question as to all others. Have you tried time test-suite. The implementation is from time, as n the test is also copied from time.

So if it fails, it's very likely it's an upstream time issue. (Except if something is changed, but afaik from https://github.com/haskell/time/blob/618b690e3b80bbafcb3889decf7b3d22a7a51980/test/main/Test/Clock/Resolution.hs the test is the same).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants