aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-08-07 15:02:29 +0200
committerGitHub <noreply@github.com>2019-08-07 15:02:29 +0200
commit56df30cd3f89f76f608b469044c17a42cdb2b338 (patch)
tree0a8cb3bf92293f9fd6d684f62a5d1f63874290d8 /tests
parent399b6f3c46077e10a7047e8216fc1a67425a768a (diff)
parent363a2f68261af73aefe4edead9c0526030751a27 (diff)
Merge pull request #2995 from tweag/post-build-hook
Add a post build hook
Diffstat (limited to 'tests')
-rw-r--r--tests/dependencies.nix1
-rw-r--r--tests/local.mk3
-rw-r--r--tests/post-hook.sh15
-rwxr-xr-xtests/push_to_store.sh4
4 files changed, 22 insertions, 1 deletions
diff --git a/tests/dependencies.nix b/tests/dependencies.nix
index 687237add..eca4b2964 100644
--- a/tests/dependencies.nix
+++ b/tests/dependencies.nix
@@ -17,6 +17,7 @@ let {
builder = ./dependencies.builder0.sh + "/FOOBAR/../.";
input1 = input1 + "/.";
input2 = "${input2}/.";
+ input1_drv = input1;
meta.description = "Random test package";
};
diff --git a/tests/local.mk b/tests/local.mk
index 261e4db0d..ef359c631 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -28,7 +28,8 @@ nix_tests = \
check.sh \
plugins.sh \
search.sh \
- nix-copy-ssh.sh
+ nix-copy-ssh.sh \
+ post-hook.sh
# parallel.sh
install-tests += $(foreach x, $(nix_tests), tests/$(x))
diff --git a/tests/post-hook.sh b/tests/post-hook.sh
new file mode 100644
index 000000000..3f82d0c5e
--- /dev/null
+++ b/tests/post-hook.sh
@@ -0,0 +1,15 @@
+source common.sh
+
+clearStore
+
+export REMOTE_STORE=$TEST_ROOT/remote_store
+
+# Build the dependencies and push them to the remote store
+nix-build dependencies.nix --post-build-hook $PWD/push_to_store.sh
+
+clearStore
+
+# Ensure that we the remote store contains both the runtime and buildtime
+# closure of what we've just built
+nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix
+nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix input1_drv
diff --git a/tests/push_to_store.sh b/tests/push_to_store.sh
new file mode 100755
index 000000000..d97eb095d
--- /dev/null
+++ b/tests/push_to_store.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo Pushing "$@" to "$REMOTE_STORE"
+echo -n "$OUT_PATHS" | xargs -d: nix copy --to "$REMOTE_STORE" --no-require-sigs