thiagokokada/nix-alien

Add integration tests

thiagokokada opened this issue · 2 comments

I just realized #88 that nix-ld and Flakes codepaths was broken for a long time (they would not even eval correctly). This was caused by a clear lack of testing in the code.

Also testing even the main code is boring because I need to find a binary that is not static linked (babashka is generally my choice), running the commands and checking the output. There should be a better way to do this.

I think it should be viable to add some integration tests by:

  • Having some way to skip the interactivity from FZF, by auto-selecting the correct choice
    • --additional-packages flag is almost what I want, but it is dumb right now and doesn't appear as a candidate for the selecting lib logic. Should be a quick fix
    • Optionally create a new flag to fill this part
  • In checks.nix, add new checks. They should download a binary, run nix-alien/nix-alien-ld and call the resulting binary with --help or something to show it is working
    • Can we call nix builders inside nix though?
    • Also, we need to make sure that all dependencies are in the /nix/store, otherwise the test may fail because we will not have network access

As an alternative, we can always use GitHub Actions and create some test scripts that are not written in Nix.

Not ideal, but should work quickly.

https://nixos.org/manual/nix/unstable/contributing/experimental-features.html#xp-feature-recursive-nix

Recursive nix seems to be what we want here. Sadly this may mean that this should be put outside of #checks, or anyone that is calling nix flake check in this repo would need to add recursive-nix as an optional feature.