about summary refs log tree commit diff
path: root/tests/binary-patching.sh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T15·30+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T15·30+0000
commita07c68f05edd754e389e0757ed2deefd70aad364 (patch)
tree9b4739b556517b6cf32505e2d0f888b27f104398 /tests/binary-patching.sh
parentbf658f016ff16af79535358c8e609a933b86e6d7 (diff)
* Finally, a test for the binary patch functionality.
Diffstat (limited to 'tests/binary-patching.sh')
-rw-r--r--tests/binary-patching.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/binary-patching.sh b/tests/binary-patching.sh
new file mode 100644
index 000000000000..8d7788fb614f
--- /dev/null
+++ b/tests/binary-patching.sh
@@ -0,0 +1,33 @@
+source common.sh
+
+mkdir -p $TEST_ROOT/cache2 $TEST_ROOT/patches
+
+RESULT=$TEST_ROOT/result
+
+# Build version 1 and 2 of the "foo" package.
+$NIX_BIN_DIR/nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest1 \
+    $($nixbuild -o $RESULT binary-patching.nix --arg version 1)
+
+out2=$($nixbuild -o $RESULT binary-patching.nix --arg version 2)
+$NIX_BIN_DIR/nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest2 $out2
+rm $RESULT
+
+# Generate a binary patch.
+$NIX_BIN_DIR/generate-patches.pl $TEST_ROOT/cache2 $TEST_ROOT/patches \
+    file://$TEST_ROOT/patches $TEST_ROOT/manifest1 $TEST_ROOT/manifest2
+
+grep -q "patch {" $TEST_ROOT/manifest2
+
+# Get rid of version 2.
+$nixstore --delete $out2
+! test -e $out2
+
+# Pull the manifest containing the patch.
+clearManifests
+$NIX_BIN_DIR/nix-pull file://$TEST_ROOT/manifest2
+
+# To make sure that we're using the patch, delete the full NARs.
+rm -f $TEST_ROOT/cache2/*
+
+# Now rebuild it.  This should use the patch generated above.
+$nixbuild -o $RESULT binary-patching.nix --arg version 2