aboutsummaryrefslogtreecommitdiff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-05 16:32:25 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-05 21:58:42 +0200
commitd3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2 (patch)
tree4b1c5c20515e88fdecf1626673d1f9864942ab1f /tests/packages.scm
parentb4469d8c12905f07a6825654bc3313beb0563cad (diff)
downloadguix-d3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2.tar
guix-d3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2.tar.gz
build-system: Bags record their system and target.
* guix/build-system.scm (<bag>)[system, target]: New fields. (make-bag): Add #:system parameter and pass it to LOWER. * gnu/packages/bootstrap.scm (make-raw-bag): Initialize 'system' field. * guix/build-system/cmake.scm (lower): Likewise. * guix/build-system/perl.scm (lower): Likewise. * guix/build-system/python.scm (lower): Likewise. * guix/build-system/ruby.scm (lower): Likewise. * guix/build-system/trivial.scm (lower): Likewise. * guix/build-system/gnu.scm (lower): Initialize 'system' and 'target' fields. * guix/packages.scm (bag->derivation, bag->cross-derivation): New procedures. (package-derivation, package-cross-derivation): Use 'bag->derivation'. * tests/packages.scm ("search paths"): Initialize 'system' and 'target' fields. ("package->bag", "package->bag, cross-compilation", "bag->derivation", "bag->derivation, cross-compilation"): New tests.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 6deb21c331..2a87f3f15d 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -281,9 +281,11 @@
(s (build-system
(name 'raw)
(description "Raw build system with direct store access")
- (lower (lambda* (name #:key source inputs #:allow-other-keys)
+ (lower (lambda* (name #:key source inputs system target
+ #:allow-other-keys)
(bag
(name name)
+ (system system) (target target)
(build-inputs inputs)
(build
(lambda* (store name inputs
@@ -339,6 +341,38 @@
(package-cross-derivation %store p "mips64el-linux-gnu")
#f)))
+(test-equal "package->bag"
+ `("foo86-hurd" #f (,(package-source gnu-make))
+ (,(canonical-package glibc)) (,(canonical-package coreutils)))
+ (let ((bag (package->bag gnu-make "foo86-hurd")))
+ (list (bag-system bag) (bag-target bag)
+ (assoc-ref (bag-build-inputs bag) "source")
+ (assoc-ref (bag-build-inputs bag) "libc")
+ (assoc-ref (bag-build-inputs bag) "coreutils"))))
+
+(test-equal "package->bag, cross-compilation"
+ `(,(%current-system) "foo86-hurd"
+ (,(package-source gnu-make))
+ (,(canonical-package glibc)) (,(canonical-package coreutils)))
+ (let ((bag (package->bag gnu-make (%current-system) "foo86-hurd")))
+ (list (bag-system bag) (bag-target bag)
+ (assoc-ref (bag-build-inputs bag) "source")
+ (assoc-ref (bag-build-inputs bag) "libc")
+ (assoc-ref (bag-build-inputs bag) "coreutils"))))
+
+(test-assert "bag->derivation"
+ (let ((bag (package->bag gnu-make))
+ (drv (package-derivation %store gnu-make)))
+ (parameterize ((%current-system "foox86-hurd")) ;should have no effect
+ (equal? drv (bag->derivation %store bag)))))
+
+(test-assert "bag->derivation, cross-compilation"
+ (let ((bag (package->bag gnu-make (%current-system) "mips64el-linux-gnu"))
+ (drv (package-cross-derivation %store gnu-make "mips64el-linux-gnu")))
+ (parameterize ((%current-system "foox86-hurd") ;should have no effect
+ (%current-target-system "foo64-linux-gnu"))
+ (equal? drv (bag->derivation %store bag)))))
+
(unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))
(test-skip 1))
(test-assert "GNU Make, bootstrap"