summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-11-23 15:22:42 +0100
committerLudovic Courtès <ludo@gnu.org>2023-11-25 16:29:25 +0100
commit9b48cf8cdd5718bc35828b3c4c9abe84122dad96 (patch)
tree74c4bcbd1c74539b1328754862b34372d0107119 /tests
parente04f8fe4ea50f81847cad98a5dc6b32c27b81ea2 (diff)
downloadguix-9b48cf8cdd5718bc35828b3c4c9abe84122dad96.tar.gz
tests: Import (guix build syscalls) when (guix build store-copy) is used.
Fixes a test failure introduced in
189525412e3d803f3f77e15ec4a62aaa57f65a2d.

* guix/progress.scm: Autoload (guix build syscalls).
* tests/gexp.scm ("gexp->derivation, store copy"): Add (guix build
syscalls) to the list of imported modules.  Use ‘with-imported-modules’
rather than #:modules.

Change-Id: I8d3fe90f564ef4b1a340f34cee6c08a741f7b836
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm59
1 files changed, 30 insertions, 29 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 7a90f8dcbf..0e3c446576 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014-2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -826,38 +826,39 @@
                          (call-with-output-file (string-append #$output "/two")
                            (lambda (port)
                              (display "This is the second one." port))))))
-        (build-drv #~(begin
-                       (use-modules (guix build store-copy)
-                                    (guix build utils)
-                                    (srfi srfi-1))
-
-                       (define (canonical-file? file)
-                         ;; Copied from (guix tests).
-                         (let ((st (lstat file)))
-                           (or (not (string-prefix? (%store-directory) file))
-                               (eq? 'symlink (stat:type st))
-                               (and (= 1 (stat:mtime st))
-                                    (zero? (logand #o222 (stat:mode st)))))))
-
-                       (mkdir #$output)
-                       (populate-store '("graph") #$output
-                                       #:deduplicate? #f)
-
-                       ;; Check whether 'populate-store' canonicalizes
-                       ;; permissions and timestamps.
-                       (unless (every canonical-file? (find-files #$output))
-                         (error "not canonical!" #$output)))))
+        (build-drv
+         (with-imported-modules '((guix build store-copy)
+                                  (guix build syscalls)
+                                  (guix progress)
+                                  (guix records)
+                                  (guix sets)
+                                  (guix build utils))
+           #~(begin
+               (use-modules (guix build store-copy)
+                            (guix build utils)
+                            (srfi srfi-1))
+
+               (define (canonical-file? file)
+                 ;; Copied from (guix tests).
+                 (let ((st (lstat file)))
+                   (or (not (string-prefix? (%store-directory) file))
+                       (eq? 'symlink (stat:type st))
+                       (and (= 1 (stat:mtime st))
+                            (zero? (logand #o222 (stat:mode st)))))))
+
+               (mkdir #$output)
+               (populate-store '("graph") #$output
+                               #:deduplicate? #f)
+
+               ;; Check whether 'populate-store' canonicalizes
+               ;; permissions and timestamps.
+               (unless (every canonical-file? (find-files #$output))
+                 (error "not canonical!" #$output))))))
     (mlet* %store-monad ((one (gexp->derivation "one" build-one))
                          (two (gexp->derivation "two" (build-two one)))
                          (drv (gexp->derivation "store-copy" build-drv
                                                 #:references-graphs
-                                                `(("graph" ,two))
-                                                #:modules
-                                                '((guix build store-copy)
-                                                  (guix progress)
-                                                  (guix records)
-                                                  (guix sets)
-                                                  (guix build utils))))
+                                                `(("graph" ,two))))
                          (ok? (built-derivations (list drv)))
                          (out -> (derivation->output-path drv)))
       (let ((one (derivation->output-path one))