aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-26 23:48:03 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-26 23:50:12 +0200
commit2e8cabb8d630a8423e2e5a3bf150c1c0310b945d (patch)
tree246681e13528c29ef1ff9e2f30283ff043f7cb83 /tests
parent2cc5ec7f0d64e9e94f6ae637e1f9573d4b948f0a (diff)
downloadguix-2e8cabb8d630a8423e2e5a3bf150c1c0310b945d.tar
guix-2e8cabb8d630a8423e2e5a3bf150c1c0310b945d.tar.gz
gexp: 'program-file' honors the current system and cross-compilation target.
Fixes <https://bugs.gnu.org/36813>. Reported by Jakob L. Kreuze <zerodaysfordays.sdf.org@sdf.org>. * guix/gexp.scm (program-file-compiler): Pass #:system and #:target to 'gexp->script'. (load-path-expression): Add #:system and #:target and honor them. (gexp->script): Likewise. * tests/gexp.scm ("program-file #:system"): New test. * doc/guix.texi (G-Expressions): Adjust accordingly.
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 460afe7f59..5c013d838d 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1104,6 +1104,25 @@
(return (and (zero? (close-pipe pipe))
(= 42 (string->number str)))))))))
+(test-assertm "program-file #:system"
+ (let* ((exp (with-imported-modules '((guix build utils))
+ (gexp (begin
+ (use-modules (guix build utils))
+ (display "hi!")))))
+ (system (if (string=? (%current-system) "x86_64-linux")
+ "armhf-linux"
+ "x86_64-linux"))
+ (file (program-file "program" exp)))
+ (mlet %store-monad ((drv (lower-object file system)))
+ (return (and (string=? (derivation-system drv) system)
+ (find (lambda (input)
+ (let ((drv (pk (derivation-input-derivation input))))
+ (and (string=? (derivation-name drv)
+ "module-import-compiled")
+ (string=? (derivation-system drv)
+ system))))
+ (derivation-inputs drv)))))))
+
(test-assertm "scheme-file"
(let* ((text (plain-file "foo" "Hello, world!"))
(scheme (scheme-file "bar" #~(list "foo" #$text))))