aboutsummaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2020-03-06 10:06:54 +0100
committerMathieu Othacehe <m.othacehe@gmail.com>2020-03-08 20:28:31 +0100
commit9a2f99f42fdd19ac379ac85be2a8c2a34a345aa5 (patch)
tree7453d86ffe9231b7b6937b80cd38684155d35f8b /tests/gexp.scm
parent5d52d10661635ece0db9ffb89ab57f5f937221aa (diff)
downloadpatches-9a2f99f42fdd19ac379ac85be2a8c2a34a345aa5.tar
patches-9a2f99f42fdd19ac379ac85be2a8c2a34a345aa5.tar.gz
gexp: Default to current target.base-for-series-3111
* guix/gexp.scm (lower-object): Set target argument to 'current by default and look for the current target system at bind time if needed, (gexp->file): ditto, (gexp->script): ditto, (lower-gexp): make sure lowered extensions are not cross-compiled. * tests/gexp.scm: Add cross-compilation test-cases for gexp->script and gexp->file with a target passed explicitely and with a default target.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 7c8985d846..9e38816c3d 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1331,6 +1331,56 @@
'#~(foo #$bar #$baz:out #$(chbouib 42) #$@(list x y z)
#+foo #+foo:out #+(chbouib 42) #+@(list x y z)))
+(test-assertm "gexp->file, cross-compilation"
+ (mlet* %store-monad ((target -> "aarch64-linux-gnu")
+ (exp -> (gexp (list (ungexp coreutils))))
+ (xdrv (gexp->file "foo" exp #:target target))
+ (refs (references*
+ (derivation-file-name xdrv)))
+ (xcu (package->cross-derivation coreutils
+ target))
+ (cu (package->derivation coreutils)))
+ (return (and (member (derivation-file-name xcu) refs)
+ (not (member (derivation-file-name cu) refs))))))
+
+(test-assertm "gexp->file, cross-compilation with default target"
+ (mlet* %store-monad ((target -> "aarch64-linux-gnu")
+ (_ (set-current-target target))
+ (exp -> (gexp (list (ungexp coreutils))))
+ (xdrv (gexp->file "foo" exp))
+ (refs (references*
+ (derivation-file-name xdrv)))
+ (xcu (package->cross-derivation coreutils
+ target))
+ (cu (package->derivation coreutils)))
+ (return (and (member (derivation-file-name xcu) refs)
+ (not (member (derivation-file-name cu) refs))))))
+
+(test-assertm "gexp->script, cross-compilation"
+ (mlet* %store-monad ((target -> "aarch64-linux-gnu")
+ (exp -> (gexp (list (ungexp coreutils))))
+ (xdrv (gexp->script "foo" exp #:target target))
+ (refs (references*
+ (derivation-file-name xdrv)))
+ (xcu (package->cross-derivation coreutils
+ target))
+ (cu (package->derivation coreutils)))
+ (return (and (member (derivation-file-name xcu) refs)
+ (not (member (derivation-file-name cu) refs))))))
+
+(test-assertm "gexp->script, cross-compilation with default target"
+ (mlet* %store-monad ((target -> "aarch64-linux-gnu")
+ (_ (set-current-target target))
+ (exp -> (gexp (list (ungexp coreutils))))
+ (xdrv (gexp->script "foo" exp))
+ (refs (references*
+ (derivation-file-name xdrv)))
+ (xcu (package->cross-derivation coreutils
+ target))
+ (cu (package->derivation coreutils)))
+ (return (and (member (derivation-file-name xcu) refs)
+ (not (member (derivation-file-name cu) refs))))))
+
(test-end "gexp")
;; Local Variables: