diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-01-13 09:38:38 +0100 |
|---|---|---|
| committer | Rutherther <rutherther@ditigal.xyz> | 2026-01-25 21:25:40 +0100 |
| commit | 0c5d65d5400c6193571972451083baa66265ec5a (patch) | |
| tree | 170670c1dbd525e94d48d25a3fa8e1a5c455c21c /tests | |
| parent | 062f036fecf6db056feaaf127b5df1c39d49f5d8 (diff) | |
transformations: Add ‘--amd-gpu’ transformation option.
* guix/transformations.scm (split-on-commas): New procedure, moved from…
(transform-package-toolchain): … here.
(package-amd-gpu-specialization, transform-package-amd-gpu-targets): New
procedures.
(%transformations, %options): Add ‘amd-gpu’.
* tests/transformations.scm ("options->transformations, amd-gpu")
("options->transformations, amd-gpu, not applicable")
("options->transformations, amd-gpu, missing clang-rocm input")
("options->transformations, amd-gpu, wrong GPU"): New tests.
* doc/guix.texi (Package Transformation Options): Document it.
Change-Id: I56bf0dffbf12bc08cf6318fe56952473b395c303
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #5583
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/transformations.scm | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm index 9f5aacc41b4..1db54a0e196 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016-2017, 2019-2024 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016-2017, 2019-2024, 2026 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -638,6 +638,45 @@ (package->bag (t p)) #f))) +(test-equal "options->transformations, amd-gpu" + '("gfx90a" "gfx942") + (let ((p (dummy-package "amd-gpu-code" + (native-inputs + (list (@ (gnu packages llvm) clang-rocm))) + (properties '((amd-gpu-targets . ("whatever")))))) + (t (options->transformation '((amd-gpu . ("gfx90a" "gfx942")))))) + (assoc-ref (package-properties (t p)) 'amd-gpu-targets))) + +(test-equal "options->transformations, amd-gpu, not applicable" + #f + (let ((p (dummy-package "not-amd-gpu-code")) + (t (options->transformation '((amd-gpu . ("gfx90a" "gfx942")))))) + (assoc-ref (package-properties (t p)) 'amd-gpu-targets))) + +(test-assert "options->transformations, amd-gpu, missing clang-rocm input" + (let ((p (dummy-package "amd-gpu-code" + (properties '((amd-gpu-targets . ("whatever")))))) + (t (options->transformation '((amd-gpu . ("generic")))))) + ;; Since 'clang-rocm' is not among the inputs, an error should be raised. + (guard (c ((formatted-message? c) + (string-contains (formatted-message-string c) + "no ROCm compiler"))) + (t p) + #f))) + +(test-assert "options->transformations, amd-gpu, wrong GPU" + (let ((p (dummy-package "amd-gpu-code" + (native-inputs + (list (@ (gnu packages llvm) clang-rocm))) + (properties '((amd-gpu-targets . ("whatever")))))) + (t (options->transformation '((amd-gpu . ("does-not-exist")))))) + ;; Since this AMD GPU target is not known to 'clang-rocm', an error should + ;; be raised. + (guard (c ((formatted-message? c) + (member "does-not-exist" (formatted-message-arguments c)))) + (t p) + #f))) + (test-equal "options->transformation + package->manifest-entry" '((transformations . ((without-tests . "foo")))) (let* ((p (dummy-package "foo")) |
