output missing/substitutable derivations in eval output

This commit is contained in:
Jörg Thalheim
2021-03-21 19:05:11 +01:00
parent 617d4ee151
commit 71cbe4eab4
6 changed files with 151 additions and 52 deletions
+5
View File
@@ -0,0 +1,5 @@
with import <nixpkgs> {};
{
builtJob = pkgs.writeText "job1" "job1";
substitutedJob = pkgs.hello;
}
+26
View File
@@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1616345250,
"narHash": "sha256-WLbLFIJyKCklGyEMGwh9XDTzafafyO95s4+rJHOc/Ag=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5e4a4e0c32f0ca0a5bd4ebbbf17aedd347de7f3e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+12
View File
@@ -0,0 +1,12 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
outputs = { self, nixpkgs }: let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
hydraJobs = {
builtJob = pkgs.writeText "job1" "job1";
substitutedJob = pkgs.hello;
};
};
}
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
import subprocess
import json
from tempfile import TemporaryDirectory
from pathlib import Path
from typing import List
TEST_ROOT = Path(__file__).parent.resolve()
PROJECT_ROOT = TEST_ROOT.parent
BIN = PROJECT_ROOT.joinpath("build", "src", "hydra-eval-jobs")
def common_test(extra_args: List[str]) -> None:
with TemporaryDirectory() as tempdir:
cmd = [str(BIN), "--gc-roots-dir", tempdir] + extra_args
res = subprocess.run(
cmd,
cwd=TEST_ROOT.joinpath("assets"),
text=True,
check=True,
stdout=subprocess.PIPE,
)
data = json.loads(res.stdout)
assert len(data["builtJob"]["builds"]) == 1
assert len(data["substitutedJob"]["substitutes"]) >= 1
def test_flake() -> None:
common_test(["--flake", ".#"])
def test_expression() -> None:
common_test(["ci.nix"])