diff mbox series

[bug#72106,2/3] gnu: klee: Enable the test suite.

Message ID 3628ef5ffdfff900c749131956e3109dbd813493.1720953093.git.soeren@soeren-tempel.net
State New
Headers show
Series gnu: klee: Enable test suite | expand

Commit Message

Sören Tempel July 14, 2024, 10:42 a.m. UTC
From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/check.scm (klee): Enable all tests.
[arguments]: Add phase to patch lit configuration, set #:test-target.
<#:configure-flags?>: Enable system and unit tests, configure gtest.
[inputs]: Add googletest and python-lit.
---
 gnu/packages/check.scm | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index f31e1bdb36..14d7124908 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -1063,13 +1063,23 @@  (define-public klee
       (base32 "1nma6dqi8chjb97llsa8mzyskgsg4dx56lm8j514j5wmr8vkafz6"))))
    (arguments
     (list
+     #:test-target "check"
      #:phases
      #~(modify-phases %standard-phases
-                      (add-after 'unpack 'patch
+                      (add-after 'unpack 'patch-cmake
                         (lambda _
                           (substitute* "CMakeLists.txt"
                             (("\\$\\{KLEE_UCLIBC_PATH\\}/lib/libc\\.a")
                              "${KLEE_UCLIBC_PATH}"))))
+                      (add-after 'unpack 'patch-lit-config
+                        (lambda _
+                          ;; Make sure that we retain the value of the GUIX_PYTHONPATH
+                          ;; environment variable in the test environmented created by
+                          ;; python-lit. Otherwise, the test scripts won't be able to
+                          ;; find the python-tabulate dependency, causing test failures.
+                          (substitute* "test/lit.cfg"
+                            (("addEnv\\('PWD'\\)" env)
+                             (string-append env "\n" "addEnv('GUIX_PYTHONPATH')")))))
                       (add-after 'install 'wrap-hooks
                         (lambda* (#:key inputs outputs #:allow-other-keys)
                           (let* ((out (assoc-ref outputs "out"))
@@ -1080,7 +1090,13 @@  (define-public klee
                               `("KLEE_RUNTIME_LIBRARY_PATH" =
                                 (,(string-append lib "/klee/runtime/"))))))))
      #:configure-flags
-     #~(list (string-append "-DLLVMCC="
+     #~(list "-DENABLE_UNIT_TESTS=ON"
+             "-DENABLE_SYSTEM_TESTS=ON"
+             (string-append "-DGTEST_SRC_DIR="
+                            (assoc-ref %build-inputs "googletest"))
+             (string-append "-DGTEST_INCLUDE_DIR="
+                            (assoc-ref %build-inputs "googletest") "/googletest/include")
+             (string-append "-DLLVMCC="
                             (search-input-file %build-inputs "/bin/clang"))
              (string-append "-DLLVMCXX="
                             (search-input-file %build-inputs "/bin/clang++"))
@@ -1090,7 +1106,14 @@  (define-public klee
    ;; klee-stats tool (shipped in /bin) requires Python.
    (propagated-inputs (list python python-tabulate))
    (native-inputs (list clang-13 llvm-13 python-lit))
-   (inputs (list bash-minimal klee-uclibc gperftools sqlite z3))
+   (inputs
+     `(("bash-minimal" ,bash-minimal)
+       ("klee-uclibc" ,klee-uclibc)
+       ("gperftools" ,gperftools)
+       ("sqlite" ,sqlite)
+       ("z3" ,z3)
+       ("python-lit" ,python-lit)
+       ("googletest" ,(package-source googletest))))
    (build-system cmake-build-system)
    (home-page "https://klee-se.org/")
    (synopsis "Symbolic execution engine")