about summary refs log tree commit diff
path: root/tests/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/init.sh')
-rw-r--r--tests/init.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/init.sh b/tests/init.sh
new file mode 100644
index 000000000000..87ab59f964bf
--- /dev/null
+++ b/tests/init.sh
@@ -0,0 +1,18 @@
+test -n "$TEST_ROOT"
+if test -d "$TEST_ROOT"; then
+    chmod -R u+w "$TEST_ROOT"
+    rm -rf "$TEST_ROOT"
+fi
+mkdir "$TEST_ROOT"
+
+mkdir "$NIX_STORE_DIR"
+mkdir "$NIX_DATA_DIR"
+mkdir "$NIX_LOG_DIR"
+mkdir "$NIX_STATE_DIR"
+mkdir "$NIX_DB_DIR"
+
+# Initialise the database.
+$TOP/src/nix-store/nix-store --init
+
+# Did anything happen?
+test -e "$NIX_DB_DIR"/validpaths