From 9a2f99f42fdd19ac379ac85be2a8c2a34a345aa5 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 6 Mar 2020 10:06:54 +0100 Subject: gexp: Default to current target. * 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. --- tests/gexp.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'tests/gexp.scm') 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: -- cgit v1.2.3