tests: add small testcase for output cycle detection
Change-Id: I186937dfbca4d051e5ad860239720816429a0a8e
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
with import ./config.nix;
|
||||
|
||||
rec {
|
||||
dep = import ./dependencies.nix {};
|
||||
|
||||
cycle = mkDerivation {
|
||||
name = "cycle";
|
||||
inherit dep;
|
||||
outputs = [ "foo" "bar" "baz" ];
|
||||
builder = builtins.toFile "builder.sh" ''
|
||||
mkdir -p $foo/bin $bar/lib $baz/share
|
||||
echo $bar > $foo/bin/alarm
|
||||
echo $baz > $bar/lib/libfoo
|
||||
echo $foo > $baz/share/lalala
|
||||
'';
|
||||
};
|
||||
|
||||
as_dependency = mkDerivation {
|
||||
name = "depends-on-cycle";
|
||||
inherit cycle;
|
||||
builder = builtins.toFile "builder.sh" ''
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -173,6 +173,7 @@ functional_tests_scripts = [
|
||||
'regression-reference-checks.sh',
|
||||
'redirected-filter-source.sh',
|
||||
'daemon-trust.sh',
|
||||
'output-cycles.sh',
|
||||
]
|
||||
|
||||
# Plugin tests require shared libraries support.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
(! nix-build check-outputs.nix -A cycle) 2>&1 | grepQuiet "cycle detected in build of '.*' in the references of output 'bar' from output 'foo'"
|
||||
|
||||
error="$(! nix-build check-outputs.nix -A as_dependency 2>&1)"
|
||||
|
||||
grepQuiet "cycle detected in build of '.*' in the references of output 'bar' from output 'foo'" <<<"$error"
|
||||
grepQuiet "error: 1 dependencies of derivation" <<<"$error"
|
||||
Reference in New Issue
Block a user