Improve test apps
* Allow running test apps in repo root (e.g. `nix run ./tests#runTests`) * Pass argv to cabal to allow filtering tests with `-m` * Use `cabal run spec` rather than `cabal test`
This commit is contained in:
parent
9e2f3895e9
commit
ec9f9f98d8
2 changed files with 15 additions and 5 deletions
|
|
@ -3,6 +3,6 @@ environment:
|
||||||
NIX_CONFIG: "experimental-features = nix-command flakes"
|
NIX_CONFIG: "experimental-features = nix-command flakes"
|
||||||
tasks:
|
tasks:
|
||||||
- setup: "sudo ln -s /etc/zoneinfo/EST /etc/localtime"
|
- setup: "sudo ln -s /etc/zoneinfo/EST /etc/localtime"
|
||||||
- test-jail-nix: "cd jail.nix/tests && nix run .#runTests"
|
- test-jail-nix: "cd jail.nix && nix run ./tests#runTests"
|
||||||
- check-format: "cd jail.nix/tests && nix run .#checkFmt"
|
- check-format: "cd jail.nix && nix run ./tests#checkFmt"
|
||||||
- build-website: "cd jail.nix/website && nix build -L .#default"
|
- build-website: "cd jail.nix && nix build -L ./website#default"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,17 @@
|
||||||
program = lib.getExe (
|
program = lib.getExe (
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
inherit name runtimeInputs;
|
inherit name runtimeInputs;
|
||||||
text = script;
|
text = ''
|
||||||
|
if ! [ -e jail-nix-tests.cabal ]; then
|
||||||
|
if [ -e tests/jail-nix-tests.cabal ]; then
|
||||||
|
cd tests
|
||||||
|
else
|
||||||
|
echo "${name} must be called in repo root or tests directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
${script}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
@ -36,7 +46,7 @@
|
||||||
(lib.concatStringsSep " ")
|
(lib.concatStringsSep " ")
|
||||||
(lib.toShellVar "NIX_PATH")
|
(lib.toShellVar "NIX_PATH")
|
||||||
]
|
]
|
||||||
} cabal test
|
} cabal run spec -- "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
apps.x86_64-linux.checkFmt = mkApp "check-fmt" [ pkgs.nixfmt-tree ] "treefmt --ci";
|
apps.x86_64-linux.checkFmt = mkApp "check-fmt" [ pkgs.nixfmt-tree ] "treefmt --ci";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue