summary refs log tree commit diff
path: root/tests/store-roots.scm
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-07-13 17:21:32 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-07-13 17:21:32 +0200
commit15406013fe63f2ab238eec2d7a8adbc586806ac8 (patch)
tree8377d7c70a925f7c5ea4c04473c4eb547610b64b /tests/store-roots.scm
parenta3ac317ab4a90f66ac65055fa26dee58ed2367b8 (diff)
parentdd4c1992103a65b8fbdc80fe07a9fe9be822769a (diff)
downloadguix-emacs-team.tar.gz
Merge branch 'master' into emacs-team emacs-team
Diffstat (limited to 'tests/store-roots.scm')
-rw-r--r--tests/store-roots.scm18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/store-roots.scm b/tests/store-roots.scm
index 5bcf1bc87e..9877987a65 100644
--- a/tests/store-roots.scm
+++ b/tests/store-roots.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019, 2023 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,14 +21,26 @@
   #:use-module (guix store)
   #:use-module (guix store roots)
   #:use-module ((guix utils) #:select (call-with-temporary-directory))
+  #:use-module ((guix build utils) #:select (delete-file-recursively))
+  #:use-module ((guix config) #:select (%state-directory))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-64))
 
-(define %store
-  (open-connection))
+(define %store #f)
 
 (test-begin "store-roots")
 
+(test-equal "gc-roots, initial"
+  (list (string-append %state-directory "/profiles"))
+  (begin
+    ;; 'gc-roots' should gracefully handle lack of that directory.
+    (delete-file-recursively (string-append %state-directory "/profiles"))
+    (gc-roots)))
+
+;; The 'open-connection' call below gets guix-daemon to create
+;; %STATE-DIRECTORY/profiles.
+(set! %store (open-connection))
+
 (test-assert "gc-roots, regular root"
   (let* ((item (add-text-to-store %store "something"
                                   (random-text)))