guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: minetest: Enable tests.


From: guix-commits
Subject: 02/02: gnu: minetest: Enable tests.
Date: Tue, 23 Mar 2021 06:36:14 -0400 (EDT)

leoprikler pushed a commit to branch master
in repository guix.

commit 7fc1fac64a8d800d651f55a80ff158abd7a90ccb
Author: la snesne <lasnesne@lagunposprasihopre.org>
AuthorDate: Tue Mar 23 09:28:05 2021 +0900

    gnu: minetest: Enable tests.
    
    * gnu/packages/games.scm (minetest)[arguments]: Remove #:tests?.
    Add #:phases.
    
    Co-authored-by: Leo Prikler <leo.prikler@student.tugraz.at>
---
 gnu/packages/games.scm | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index add8b58..7366e64 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3482,7 +3482,7 @@ match, cannon keep, and grave-itation pit.")
                   #t))))
     (build-system cmake-build-system)
     (arguments
-     '(#:configure-flags
+     `(#:configure-flags
        (list "-DRUN_IN_PLACE=0"
              "-DENABLE_FREETYPE=1"
              "-DENABLE_GETTEXT=1"
@@ -3493,7 +3493,27 @@ match, cannon keep, and grave-itation pit.")
              (string-append "-DCURL_INCLUDE_DIR="
                             (assoc-ref %build-inputs "curl")
                             "/include/curl"))
-       #:tests? #f))                    ;no check target
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-sources
+           (lambda _
+             (substitute* "src/CMakeLists.txt"
+               (("set\\(EXECUTABLE_OUTPUT_PATH .*\\)") ""))
+             (substitute* "src/unittest/test_servermodmanager.cpp"
+               ;; do no override MINETEST_SUBGAME_PATH
+               (("(un)?setenv\\(\"MINETEST_SUBGAME_PATH\".*\\);")
+                "(void)0;"))
+             (setenv "MINETEST_SUBGAME_PATH"
+                     (string-append (getcwd) "/games")) ; for check
+             #t))
+         (replace 'check
+           (lambda _
+             ;; Thanks to our substitutions, the tests should also run
+             ;; when invoked on the target outside of `guix build'.
+             (unless ,(%current-target-system)
+               (setenv "HOME" "/tmp")
+               (invoke "src/minetest" "--run-unittests"))
+             #t)))))
     (native-search-paths
      (list (search-path-specification
             (variable "MINETEST_SUBGAME_PATH")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]