From fdff3a7eae8a4d2f0e6eae992d3c3cf64e1a3ad3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Feb 2014 17:47:54 +0100 Subject: [PATCH] Add a test for nix-store --dump-db / --load-db --- tests/dump-db.sh | 20 ++++++++++++++++++++ tests/local.mk | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/dump-db.sh diff --git a/tests/dump-db.sh b/tests/dump-db.sh new file mode 100644 index 000000000..234b7ac02 --- /dev/null +++ b/tests/dump-db.sh @@ -0,0 +1,20 @@ +source common.sh + +clearStore + +path=$(nix-build dependencies.nix -o $TEST_ROOT/result) + +deps="$(nix-store -qR $TEST_ROOT/result)" + +nix-store --dump-db > $TEST_ROOT/dump + +rm -rf $NIX_DB_DIR + +nix-store --load-db < $TEST_ROOT/dump + +deps2="$(nix-store -qR $TEST_ROOT/result)" + +[ "$deps" = "$deps2" ]; + +nix-store --dump-db > $TEST_ROOT/dump2 +cmp $TEST_ROOT/dump $TEST_ROOT/dump2 diff --git a/tests/local.mk b/tests/local.mk index 6b82c0a35..ab170dfe5 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -10,7 +10,7 @@ nix_tests = \ remote-store.sh export.sh export-graph.sh negative-caching.sh \ binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \ multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ - binary-cache.sh nix-profile.sh repair.sh + binary-cache.sh nix-profile.sh repair.sh dump-db.sh install-tests += $(foreach x, $(nix_tests), tests/$(x))