From 2ad2678c0baaa755becdbb7be82e2bb2e8ba1ada Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 18 Jan 2022 16:54:53 +0100 Subject: [PATCH] Add a simple test for `nix why-depends` --- tests/dependencies.nix | 2 ++ tests/local.mk | 3 ++- tests/why-depends.sh | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/why-depends.sh 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