aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2022-01-18 16:54:53 +0100
committerregnat <rg@regnat.ovh>2022-01-18 16:54:53 +0100
commit2ad2678c0baaa755becdbb7be82e2bb2e8ba1ada (patch)
tree48b0eeb254f75dc97d65b6951c5d1b5a2c7ce759
parentf6f0bcf11ff79213f5ffa58d0e490901b2d3ce58 (diff)
Add a simple test for `nix why-depends`
-rw-r--r--tests/dependencies.nix2
-rw-r--r--tests/local.mk3
-rw-r--r--tests/why-depends.sh13
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/dependencies.nix b/tests/dependencies.nix
index e320d81c9..45aca1793 100644
--- a/tests/dependencies.nix
+++ b/tests/dependencies.nix
@@ -27,6 +27,8 @@ let {
input1 = input1 + "/.";
input2 = "${input2}/.";
input1_drv = input1;
+ input2_drv = input2;
+ input0_drv = input0;
meta.description = "Random test package";
};
diff --git a/tests/local.mk b/tests/local.mk
index 8580ecac9..93cf20d43 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -61,7 +61,8 @@ nix_tests = \
ca/concurrent-builds.sh \
ca/nix-copy.sh \
eval-store.sh \
- readfile-context.sh
+ readfile-context.sh \
+ why-depends.sh
# parallel.sh
ifeq ($(HAVE_LIBCPUID), 1)
diff --git a/tests/why-depends.sh b/tests/why-depends.sh
new file mode 100644
index 000000000..11b54b5b6
--- /dev/null
+++ b/tests/why-depends.sh
@@ -0,0 +1,13 @@
+source common.sh
+
+clearStore
+
+cp ./dependencies.nix ./dependencies.builder0.sh ./config.nix $TEST_HOME
+
+cd $TEST_HOME
+
+nix-build ./dependencies.nix -A input0_drv -o dep
+nix-build ./dependencies.nix -o toplevel
+
+nix why-depends ./toplevel ./dep |
+ grep input-2