Subject: [bug#33259] [PATCH 6/8] pack: Add test for 'self-contained-tarball' with localstatedir.

From: Ludovic Courtès <[email-masked]>
Date: Sun, 4 Nov 2018 23:10:34 +0100

* tests/pack.scm ("self-contained-tarball + localstatedir"): New test.
---
 tests/pack.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/pack.scm b/tests/pack.scm
index 63fef70c64..22321a3e46 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -89,6 +89,29 @@
 ;; quite inexpensively; see <https://bugs.gnu.org/32184>.
 
 (with-external-store store
+  (unless store (test-skip 1))
+  (test-assertm "self-contained-tarball + localstatedir" store
+    (mlet* %store-monad
+        ((guile   (set-guile-for-build (default-guile)))
+         (profile (profile-derivation (packages->manifest
+                                       (list %bootstrap-guile))
+                                      #:hooks '()
+                                      #:locales? #f))
+         (tarball (self-contained-tarball "tar-pack" profile
+                                          #:localstatedir? #t))
+         (check   (gexp->derivation
+                   "check-tarball"
+                   #~(let ((bin (string-append "." #$profile "/bin")))
+                       (setenv "PATH"
+                               (string-append #$%tar-bootstrap "/bin"))
+                       (system* "tar" "xvf" #$tarball)
+                       (mkdir #$output)
+                       (exit
+                        (and (file-exists? "var/guix/db/db.sqlite")
+                             (string=? (string-append #$%bootstrap-guile "/bin")
+                                       (readlink bin))))))))
+      (built-derivations (list check))))
+
   (unless store (test-skip 1))
   (test-assertm "docker-image + localstatedir" store
     (mlet* %store-monad
-- 
2.19.1