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

Add a flag for disabling tests for time-compat #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hithroc
Copy link

@Hithroc Hithroc commented Sep 21, 2021

WSL2 has an annoying bug where clock_getres returns a resolution of 1ns, but the actual clock resolution is 100ns. microsoft/WSL#6029 haskell/time#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!

@int-index
Copy link
Contributor

Have you tried the workaround suggested by @Tritlo in haskell/time#136 (comment)?

@Hithroc
Copy link
Author

Hithroc commented Sep 21, 2021

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
Copy link
Author

Hithroc commented Sep 21, 2021

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

@AlexKnauth
Copy link

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.

Copy link
Collaborator

@supersven supersven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Hithroc ,

Thanks a lot for this PR! Unfortunately, I'm not using Windows, so it's hard for me to judge if this really fixes a or the problem...

Maybe, someone using WSL2 could be so kind to test this?

@@ -22,6 +22,7 @@ in
, withNuma ? nixpkgs.stdenv.isLinux
, withDtrace ? nixpkgs.stdenv.isLinux
, withGrind ? true
, fixWSL2 ? false # fix time-compat build issues for WSL2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to set the default according to the environment?

Like withDtrace ? nixpkgs.stdenv.isLinux, but for WSL2 if that is possible? 🤔

@supersven
Copy link
Collaborator

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...

@AlexKnauth
Copy link

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

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

Successfully merging this pull request may close these issues.

4 participants