ghc.nix icon indicating copy to clipboard operation
ghc.nix copied to clipboard

Add a flag for disabling tests for time-compat

Open Hithroc opened this issue 3 years ago • 6 comments

WSL2 has an annoying bug where clock_getres returns a resolution of 1ns, but the actual clock resolution is 100ns. https://github.com/microsoft/WSL/issues/6029 https://github.com/haskell/time/issues/136 Because of this, building time-compat results in a failure:

resolution
      getCurrentTime:                                                             FAIL (0.14s)
        test/main/Test/Clock/Resolution.hs:44:
        resolution
        expected: 0.000000001s
         but got: 0.0000001s
      taiClock:                                                                   FAIL (0.14s)
        test/main/Test/Clock/Resolution.hs:44:
        resolution
        expected: 0.000000001s
         but got: 0.0000001s

This PR adds fixWSL2 flag that disables time-compat tests. I'm pretty sure overriding time-compat like this means that package caches can't be used anymore and all of the dependencies will have to be recompiled, so this flag is disabled by default. Annoying, but better than not building at all!

Hithroc avatar Sep 21 '21 22:09 Hithroc

Have you tried the workaround suggested by @tritlo in https://github.com/haskell/time/issues/136#issuecomment-843600385?

int-index avatar Sep 21 '21 22:09 int-index

No, I haven't. I actually didn't see that comment (I did implement this fix in back March, only now decided to make it into MR).

Hithroc avatar Sep 21 '21 23:09 Hithroc

Yeah, that seems to work, installing cachix required some changes in system configuration though which is annoying. Not sure if that was NixOS specific.

Hithroc avatar Sep 21 '21 23:09 Hithroc

I am also trying to use time-compat via Nix on WSL, and I am running into the same clock resolution test failures.

I've tried building both normally and with cachix use ghc-nix, and neither has worked so far.

AlexKnauth avatar Jan 25 '22 19:01 AlexKnauth

Hey @AlexKnauth ,

I've tried building both normally and with cachix use ghc-nix, and neither has worked so far.

So, does this PR solve the issue on your machine? (I'm a bit unsure about how to interpret the word normally.)

Your input would be very valuable, as I don't have access to any Windows machine...

supersven avatar Feb 19 '22 12:02 supersven

How should I supply the new fixWSL2 flag when building this?

AlexKnauth avatar Feb 19 '22 21:02 AlexKnauth