feat(tvix/cli): introduce mkNixpkgsEvalCheck, add outPath check
This introduces a function that can be instantiated with an attribute path to instantiate, as well as the expected path (normally interpolated with the nix evaluator). Check both pkgs.stdenv.drvPath and pkgs.stdenv.outPath to match. Change-Id: Id667ed35fa159ff83fedb3017ef8d3271aa42695 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8606 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
7bd9df0133
commit
1fb5008237
1 changed files with 23 additions and 16 deletions
|
@ -1,25 +1,32 @@
|
|||
{ depot, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
mkNixpkgsEvalCheck = attrset: expectedPath: {
|
||||
label = ":nix: evaluate nixpkgs.${attrset} in tvix";
|
||||
needsOutput = true;
|
||||
|
||||
command = pkgs.writeShellScript "tvix-eval-${builtins.replaceStrings [".drv"] ["-drv"] attrset}" ''
|
||||
TVIX_OUTPUT=$(result/bin/tvix -E '(import ${pkgs.path} {}).${attrset}')
|
||||
EXPECTED='${/* the verbatim expected Tvix output: */ "=> \"${expectedPath}\" :: string"}'
|
||||
|
||||
echo "Tvix output: ''${TVIX_OUTPUT}"
|
||||
if [ "$TVIX_OUTPUT" != "$EXPECTED" ]; then
|
||||
echo "Correct would have been ''${EXPECTED}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Output was correct."
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
||||
(depot.tvix.crates.workspaceMembers.tvix-cli.build.override {
|
||||
runTests = true;
|
||||
}).overrideAttrs (_: {
|
||||
meta = {
|
||||
ci.extraSteps.eval-nixpkgs-stdenv = {
|
||||
label = ":nix: evaluate nixpkgs.stdenv in tvix";
|
||||
needsOutput = true;
|
||||
|
||||
command = pkgs.writeShellScript "tvix-eval-stdenv" ''
|
||||
TVIX_OUTPUT=$(result/bin/tvix -E '(import ${pkgs.path} {}).stdenv.drvPath')
|
||||
EXPECTED='${/* the verbatim expected Tvix output: */ "=> \"${pkgs.stdenv.drvPath}\" :: string"}'
|
||||
|
||||
echo "Tvix output: ''${TVIX_OUTPUT}"
|
||||
if [ "$TVIX_OUTPUT" != "$EXPECTED" ]; then
|
||||
echo "Correct would have been ''${EXPECTED}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Output was correct."
|
||||
'';
|
||||
ci.extraSteps = {
|
||||
eval-nixpkgs-stdenv-drvpath = (mkNixpkgsEvalCheck "stdenv.drvPath" pkgs.stdenv.drvPath);
|
||||
eval-nixpkgs-stdenv-outpath = (mkNixpkgsEvalCheck "stdenv.outPath" pkgs.stdenv.outPath);
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue