nix-community / rnix-lsp

WIP Language Server for Nix! [maintainer=@aaronjanse]
MIT License
702 stars 41 forks source link

Possible error in `test_provide_builtins`? Mac OS #60

Open peterbecich opened 2 years ago

peterbecich commented 2 years ago

Describe the bug

There may be a failing test:

test lookup::tests::test_provide_builtins ... FAILED

Steps to reproduce

Steps to reproduce the behavior:

  1. On Mac OS Big Sur nix-env -i -f https://github.com/nix-community/rnix-lsp/archive/master.tar.gz

I don't know if this occurs on Linux, but can test tomorrow.

Thank you

Ma27 commented 2 years ago

This is most likely because this testcase explicitly requires nixUnstable, however this is part of the checkInputs. I'm not a Mac user, but IIRC this doesn't have a sandbox which could cause issues, correct?

Would you mind checking which Nix is in use by cloning this repo and adding preCheck = "${pkgs.which}/bin/which nix"; to the derivation in flake.nix and share the result? :)

peterbecich commented 2 years ago

Thanks

I'm unable to run the preCheck because the error preempts this.

I have upgraded nix from the unstable channel https://search.nixos.org/packages?channel=unstable&show=nix_2_4&from=0&size=50&sort=relevance&type=packages&query=nix

and now have

% nix --version
nix (Nix) 2.4pre-rc1

Unfortunately, an error still occurs; in rnix-lsp:

 % nix build --extra-experimental-features nix-command --extra-experimental-features flakes
error: builder for '/nix/store/qr18i5gs3cnhzyayvgx6nplkf0ydmxxd-rnix-lsp-0.2.1.drv' failed with exit code 101;
       last 10 log lines:
       > ---- lookup::tests::test_provide_builtins stdout ----
       > thread 'lookup::tests::test_provide_builtins' panicked at 'assertion failed: val.1.get(\"abort\").unwrap().documentation.is_some()', src/lookup.rs:317:9
       >
       >
       > failures:
       >     lookup::tests::test_provide_builtins
       >
       > test result: FAILED. 23 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
       >
       > error: test failed, to rerun pass '--bin rnix-lsp'
       For full logs, run 'nix log /nix/store/qr18i5gs3cnhzyayvgx6nplkf0ydmxxd-rnix-lsp-0.2.1.drv'.
peterbecich commented 2 years ago

Interestingly, the Mac OS test here https://github.com/nix-community/rnix-lsp/pull/61 succeeds:

rnix-lsp> test lookup::tests::test_provide_builtins ... ok(B
aaronjanse commented 2 years ago

Later this weekend I'll try to see if it's possible to make the error message more helpful when nixUnstable is not found

peterbecich commented 2 years ago

Thanks!

Ma27 commented 2 years ago

What's the status here?

aaronjanse commented 2 years ago

I ended up getting distracted by evaluation + parsing. If anyone else wants to work on a helpful error message, feel free to do so

peterbecich commented 2 years ago

I've bypassed the error by removing the test: fn test_provide_builtins() { ... and installing rnix-lsp from source: nix-env -i -f .

It appears to work fine. Thanks

lilyball commented 2 years ago

I'm getting this issue locally. Interestingly, cache.nixos.org has a binary artifact available for rnix-lsp on aarch64-apple-darwin but not x86_64-apple-darwin (as of https://github.com/NixOS/nixpkgs/commit/5c37ad87222cfc1ec36d6cd1364514a9efc2f7f2), so hydra must be building it on M1 somehow.

Edit: Nevermind, my failure is the same test but a different assertion, it's failing on trying to match against the nix --version output (https://github.com/nix-community/rnix-lsp/issues/75).