diff options
| author | Ludovic Courtès <ludovic.courtes@inria.fr> | 2021-12-03 23:06:49 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-01-01 15:23:24 +0100 |
| commit | d090e9c37d693f5a0f381482c17fb03462cb6a48 (patch) | |
| tree | 59fc6ad56654fd2e74b49375f914088cc9f7cda5 /tests/transformations.scm | |
| parent | 0a767f02d408100b7f834586adb49b0091fef01d (diff) | |
transformations: Add '--tune'.
* guix/transformations.scm (tuning-compiler)
(tuned-package, tunable-package?, package-tuning)
(transform-package-tuning)
(build-system-with-tuning-compiler): New procedures.
(%transformations): Add 'tune'.
(%transformation-options): Add "--tune".
* tests/transformations.scm ("options->transformation, tune")
("options->transformations, tune, wrong micro-architecture"): New
tests.
* doc/guix.texi (Package Transformation Options): Document '--tune'.
Diffstat (limited to 'tests/transformations.scm')
| -rw-r--r-- | tests/transformations.scm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm index 09839dc1c53..8db85b4305b 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm | |||
| @@ -38,12 +38,14 @@ | |||
| 38 | #:use-module (guix utils) | 38 | #:use-module (guix utils) |
| 39 | #:use-module (guix git) | 39 | #:use-module (guix git) |
| 40 | #:use-module (guix upstream) | 40 | #:use-module (guix upstream) |
| 41 | #:use-module (guix diagnostics) | ||
| 41 | #:use-module (gnu packages) | 42 | #:use-module (gnu packages) |
| 42 | #:use-module (gnu packages base) | 43 | #:use-module (gnu packages base) |
| 43 | #:use-module (gnu packages busybox) | 44 | #:use-module (gnu packages busybox) |
| 44 | #:use-module (ice-9 match) | 45 | #:use-module (ice-9 match) |
| 45 | #:use-module (srfi srfi-1) | 46 | #:use-module (srfi srfi-1) |
| 46 | #:use-module (srfi srfi-26) | 47 | #:use-module (srfi srfi-26) |
| 48 | #:use-module (srfi srfi-34) | ||
| 47 | #:use-module (srfi srfi-64)) | 49 | #:use-module (srfi srfi-64)) |
| 48 | 50 | ||
| 49 | 51 | ||
| @@ -465,6 +467,39 @@ | |||
| 465 | `((with-latest . "foo"))))) | 467 | `((with-latest . "foo"))))) |
| 466 | (package-version (t p))))) | 468 | (package-version (t p))))) |
| 467 | 469 | ||
| 470 | (test-equal "options->transformation, tune" | ||
| 471 | '(cpu-tuning . "superfast") | ||
| 472 | (let* ((p0 (dummy-package "p0")) | ||
| 473 | (p1 (dummy-package "p1" | ||
| 474 | (inputs `(("p0" ,p0))) | ||
| 475 | (properties '((tunable? . #t))))) | ||
| 476 | (p2 (dummy-package "p2" | ||
| 477 | (inputs `(("p1" ,p1))))) | ||
| 478 | (t (options->transformation '((tune . "superfast")))) | ||
| 479 | (p3 (t p2))) | ||
| 480 | (and (not (package-replacement p3)) | ||
| 481 | (match (package-inputs p3) | ||
| 482 | ((("p1" tuned)) | ||
| 483 | (match (package-inputs tuned) | ||
| 484 | ((("p0" p0)) | ||
| 485 | (and (not (package-replacement p0)) | ||
| 486 | (assq 'cpu-tuning | ||
| 487 | (package-properties | ||
| 488 | (package-replacement tuned))))))))))) | ||
| 489 | |||
| 490 | (test-assert "options->transformations, tune, wrong micro-architecture" | ||
| 491 | (let ((p (dummy-package "tunable" | ||
| 492 | (properties '((tunable? . #t))))) | ||
| 493 | (t (options->transformation '((tune . "nonexistent-superfast"))))) | ||
| 494 | ;; Because GCC used by P's build system does not support | ||
| 495 | ;; '-march=nonexistent-superfast', we should see an error when lowering | ||
| 496 | ;; the tuned package. | ||
| 497 | (guard (c ((formatted-message? c) | ||
| 498 | (member "nonexistent-superfast" | ||
| 499 | (formatted-message-arguments c)))) | ||
| 500 | (package->bag (t p)) | ||
| 501 | #f))) | ||
| 502 | |||
| 468 | (test-equal "options->transformation + package->manifest-entry" | 503 | (test-equal "options->transformation + package->manifest-entry" |
| 469 | '((transformations . ((without-tests . "foo")))) | 504 | '((transformations . ((without-tests . "foo")))) |
| 470 | (let* ((p (dummy-package "foo")) | 505 | (let* ((p (dummy-package "foo")) |
