summaryrefslogtreecommitdiff
path: root/tests/transformations.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/transformations.scm')
-rw-r--r--tests/transformations.scm41
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 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016-2017, 2019-2024 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2016-2017, 2019-2024, 2026 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2021 Marius Bakke <marius@gnu.org> 3;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
@@ -638,6 +638,45 @@
638 (package->bag (t p)) 638 (package->bag (t p))
639 #f))) 639 #f)))
640 640
641(test-equal "options->transformations, amd-gpu"
642 '("gfx90a" "gfx942")
643 (let ((p (dummy-package "amd-gpu-code"
644 (native-inputs
645 (list (@ (gnu packages llvm) clang-rocm)))
646 (properties '((amd-gpu-targets . ("whatever"))))))
647 (t (options->transformation '((amd-gpu . ("gfx90a" "gfx942"))))))
648 (assoc-ref (package-properties (t p)) 'amd-gpu-targets)))
649
650(test-equal "options->transformations, amd-gpu, not applicable"
651 #f
652 (let ((p (dummy-package "not-amd-gpu-code"))
653 (t (options->transformation '((amd-gpu . ("gfx90a" "gfx942"))))))
654 (assoc-ref (package-properties (t p)) 'amd-gpu-targets)))
655
656(test-assert "options->transformations, amd-gpu, missing clang-rocm input"
657 (let ((p (dummy-package "amd-gpu-code"
658 (properties '((amd-gpu-targets . ("whatever"))))))
659 (t (options->transformation '((amd-gpu . ("generic"))))))
660 ;; Since 'clang-rocm' is not among the inputs, an error should be raised.
661 (guard (c ((formatted-message? c)
662 (string-contains (formatted-message-string c)
663 "no ROCm compiler")))
664 (t p)
665 #f)))
666
667(test-assert "options->transformations, amd-gpu, wrong GPU"
668 (let ((p (dummy-package "amd-gpu-code"
669 (native-inputs
670 (list (@ (gnu packages llvm) clang-rocm)))
671 (properties '((amd-gpu-targets . ("whatever"))))))
672 (t (options->transformation '((amd-gpu . ("does-not-exist"))))))
673 ;; Since this AMD GPU target is not known to 'clang-rocm', an error should
674 ;; be raised.
675 (guard (c ((formatted-message? c)
676 (member "does-not-exist" (formatted-message-arguments c))))
677 (t p)
678 #f)))
679
641(test-equal "options->transformation + package->manifest-entry" 680(test-equal "options->transformation + package->manifest-entry"
642 '((transformations . ((without-tests . "foo")))) 681 '((transformations . ((without-tests . "foo"))))
643 (let* ((p (dummy-package "foo")) 682 (let* ((p (dummy-package "foo"))