refactor(nix/buildLisp/tests/argv0): use derivation for tests

There is no need to use an extraStep, actually, and using derivations
reduces noise on CI.

Change-Id: I897c3c3f7e0acee8f051fcc01450ff57176726f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6573
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
sterni 2022-09-13 18:33:18 +02:00
parent cd280e0796
commit f39a4e4fa7

View file

@ -1,6 +1,9 @@
{ depot, pkgs, ... }:
{ depot, pkgs, lib, ... }:
depot.nix.buildLisp.program {
let
# Trivial test program that outputs argv[0] and exits
prog =
depot.nix.buildLisp.program {
name = "argv0-test";
srcs = [
@ -19,18 +22,37 @@ depot.nix.buildLisp.program {
default = depot.nix.buildLisp.bundled "asdf";
}
];
};
passthru.meta.ci = {
extraSteps.verify = {
label = "verify argv[0] output";
needsOutput = true;
command = pkgs.writeShellScript "check-argv0" ''
# Extract verify argv[0] output for given buildLisp program
checkImplementation = prog:
pkgs.runCommand "check-argv0" { } ''
set -eux
for invocation in "$(pwd)/result/bin/argv0-test" "./result/bin/argv0-test"; do
checkInvocation() {
invocation="$1"
test "$invocation" = "$("$invocation")"
done
}
checkInvocation "${prog}/bin/argv0-test"
cd ${prog}
checkInvocation "./bin/argv0-test"
cd bin
checkInvocation ./argv0-test
set +x
touch "$out"
'';
};
};
}
inherit (prog.meta.ci) targets;
in
(checkImplementation prog).overrideAttrs (_: {
# Wire up a subtarget all (active) non-default implementations
passthru = lib.genAttrs targets (name: checkImplementation prog.${name});
meta.ci = { inherit targets; };
})