diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-05 16:32:25 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-05 21:58:42 +0200 |
| commit | d3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2 (patch) | |
| tree | 4b1c5c20515e88fdecf1626673d1f9864942ab1f /tests | |
| parent | b4469d8c12905f07a6825654bc3313beb0563cad (diff) | |
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')
| -rw-r--r-- | tests/packages.scm | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index 6deb21c3312..2a87f3f15d1 100644 --- a/tests/packages.scm +++ b/tests/packages.scm | |||
| @@ -281,9 +281,11 @@ | |||
| 281 | (s (build-system | 281 | (s (build-system |
| 282 | (name 'raw) | 282 | (name 'raw) |
| 283 | (description "Raw build system with direct store access") | 283 | (description "Raw build system with direct store access") |
| 284 | (lower (lambda* (name #:key source inputs #:allow-other-keys) | 284 | (lower (lambda* (name #:key source inputs system target |
| 285 | #:allow-other-keys) | ||
| 285 | (bag | 286 | (bag |
| 286 | (name name) | 287 | (name name) |
| 288 | (system system) (target target) | ||
| 287 | (build-inputs inputs) | 289 | (build-inputs inputs) |
| 288 | (build | 290 | (build |
| 289 | (lambda* (store name inputs | 291 | (lambda* (store name inputs |
| @@ -339,6 +341,38 @@ | |||
| 339 | (package-cross-derivation %store p "mips64el-linux-gnu") | 341 | (package-cross-derivation %store p "mips64el-linux-gnu") |
| 340 | #f))) | 342 | #f))) |
| 341 | 343 | ||
| 344 | (test-equal "package->bag" | ||
| 345 | `("foo86-hurd" #f (,(package-source gnu-make)) | ||
| 346 | (,(canonical-package glibc)) (,(canonical-package coreutils))) | ||
| 347 | (let ((bag (package->bag gnu-make "foo86-hurd"))) | ||
| 348 | (list (bag-system bag) (bag-target bag) | ||
| 349 | (assoc-ref (bag-build-inputs bag) "source") | ||
| 350 | (assoc-ref (bag-build-inputs bag) "libc") | ||
| 351 | (assoc-ref (bag-build-inputs bag) "coreutils")))) | ||
| 352 | |||
| 353 | (test-equal "package->bag, cross-compilation" | ||
| 354 | `(,(%current-system) "foo86-hurd" | ||
| 355 | (,(package-source gnu-make)) | ||
| 356 | (,(canonical-package glibc)) (,(canonical-package coreutils))) | ||
| 357 | (let ((bag (package->bag gnu-make (%current-system) "foo86-hurd"))) | ||
| 358 | (list (bag-system bag) (bag-target bag) | ||
| 359 | (assoc-ref (bag-build-inputs bag) "source") | ||
| 360 | (assoc-ref (bag-build-inputs bag) "libc") | ||
| 361 | (assoc-ref (bag-build-inputs bag) "coreutils")))) | ||
| 362 | |||
| 363 | (test-assert "bag->derivation" | ||
| 364 | (let ((bag (package->bag gnu-make)) | ||
| 365 | (drv (package-derivation %store gnu-make))) | ||
| 366 | (parameterize ((%current-system "foox86-hurd")) ;should have no effect | ||
| 367 | (equal? drv (bag->derivation %store bag))))) | ||
| 368 | |||
| 369 | (test-assert "bag->derivation, cross-compilation" | ||
| 370 | (let ((bag (package->bag gnu-make (%current-system) "mips64el-linux-gnu")) | ||
| 371 | (drv (package-cross-derivation %store gnu-make "mips64el-linux-gnu"))) | ||
| 372 | (parameterize ((%current-system "foox86-hurd") ;should have no effect | ||
| 373 | (%current-target-system "foo64-linux-gnu")) | ||
| 374 | (equal? drv (bag->derivation %store bag))))) | ||
| 375 | |||
| 342 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) | 376 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) |
| 343 | (test-skip 1)) | 377 | (test-skip 1)) |
| 344 | (test-assert "GNU Make, bootstrap" | 378 | (test-assert "GNU Make, bootstrap" |
