oom pushed a commit to branch c++-team
in repository guix.

commit 6ad8d8c14e461c97b24f53215017738e0261060b
Author: Greg Hogan <c...@greghogan.com>
AuthorDate: Sun Apr 6 12:09:05 2025 +0000

    gnu: llvm: Fix tests.
    
    * gnu/packages/llvm.scm (clang-from-llvm)[arguments]: Set #:tests? to
    disabled.
    (make-llvm, llvm-14)[arguments]<#:phases>: Replace 'check phase to run
    tests.
    (llvm-14)[native-inputs]: Add which.
    (llvm-12)[arguments]<#:phases>: Add 'remove-failing-tests phase.
    (llvm-6)[arguments]<#:phases>: ... and remove it.
    
    Change-Id: Ibf0e4a4b535838ff4ffd60d66bc0bee4314abde6
---
 gnu/packages/llvm.scm | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 8d76c9c615..c91eca384f 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -269,7 +269,10 @@ until LLVM/Clang 14."
     (propagated-inputs
      (list llvm clang-runtime))
     (arguments
-     `(#:configure-flags
+     `(;; TODO: enable tests.
+       #:tests? #f
+
+       #:configure-flags
        (list "-DCLANG_INCLUDE_TESTS=True"
 
              ;; TODO: Use --gcc-install-dir when GCC_INSTALL_PREFIX is
@@ -651,11 +654,20 @@ output), and Binutils.")
            "-DLLVM_PARALLEL_LINK_JOBS=1") ;cater to smaller build machines
         ;; Don't use '-g' during the build, to save space.
         #:build-type "Release"
+        #:modules '((guix build cmake-build-system)
+                    ((guix build gnu-build-system) #:prefix gnu:)
+                    (guix build utils))
         #:phases
         #~(modify-phases %standard-phases
             (add-after 'unpack 'change-directory
               (lambda _
                 (chdir "llvm")))
+            (replace 'check
+              (lambda* (#:key outputs #:allow-other-keys)
+                (setenv "HOME" "/tmp")
+                (apply (assoc-ref gnu:%standard-phases 'check)
+                       (list #:test-target "check-llvm"
+                             #:outputs outputs))))
             (add-after 'install 'install-opt-viewer
               (lambda* (#:key outputs #:allow-other-keys)
                 (let* ((opt-viewer-share (string-append #$output:opt-viewer
@@ -693,6 +705,9 @@ of programming tools as well as libraries with equivalent 
functionality.")
     (source (llvm-monorepo version))
     (arguments
      (list
+      #:modules '((guix build cmake-build-system)
+                  ((guix build gnu-build-system) #:prefix gnu:)
+                  (guix build utils))
       #:configure-flags
       #~(list
          ;; These options are required for cross-compiling LLVM according
@@ -731,6 +746,12 @@ of programming tools as well as libraries with equivalent 
functionality.")
           (add-after 'unpack 'change-directory
             (lambda _
               (chdir "llvm")))
+          (replace 'check
+            (lambda* (#:key outputs #:allow-other-keys)
+              (setenv "HOME" "/tmp")
+              (apply (assoc-ref gnu:%standard-phases 'check)
+                     (list #:test-target "check-llvm"
+                           #:outputs outputs))))
           (add-after 'install 'install-opt-viewer
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
@@ -741,9 +762,7 @@ of programming tools as well as libraries with equivalent 
functionality.")
                 (rename-file (string-append out "/share/opt-viewer")
                              opt-viewer-dir)))))))
 
-    (native-inputs
-     `(("python" ,python-wrapper)
-       ("perl"   ,perl)))))
+    (native-inputs (list perl python-wrapper which))))
 
 (define-public clang-runtime-15
   (clang-runtime-from-llvm llvm-15))
@@ -932,6 +951,9 @@ Library.")
                                              "/bin/config.guess")))
                          (copy-file config.guess "cmake/config.guess")))))
                 #~())
+         (add-after 'unpack 'delete-failing-tests
+           (lambda _
+             (delete-file "test/DebugInfo/X86/vla-multi.ll")))
          (add-before 'build 'shared-lib-workaround
            ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
            ;; doesn't seem to get the correct rpath to be able to run
@@ -1259,7 +1281,12 @@ Library.")
               (uri (llvm-uri "llvm" version))
               (sha256
                (base32
-                "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))))
+                "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments llvm-7)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (delete 'delete-failing-tests)))))))
 
 (define-public clang-runtime-6
   (clang-runtime-from-llvm

Reply via email to