Subject: [bug#75319] [PATCH v3 2/6] gnu: libzim: Enable tests.

From: Sughosha <[email-masked]>
Date: Mon, 24 Feb 2025 10:58:58 +0530

* gnu/packages/web.scm (zim-testing-suite): New variable.
(libzim)[arguments]<#:phases>: Add phase 'inject-test-data.
<#:configure-flags>: Set test_data_dir.

Change-Id: I9dc05ccad8b6b4cfd31bea8eaa9b9a03271240f6
---
 gnu/packages/web.scm | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 90cd02313c..767f814c2d 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -9366,6 +9366,17 @@ (define-public kineto
 of Geminispace, but it defaults to a specific domain.")
     (license license:gpl3+)))
 
+(define zim-testing-suite
+  (let ((version "0.7.0"))
+    (origin
+      (method url-fetch)
+      (uri
+       (string-append "https://github.com/openzim/zim-testing-suite/releases/"
+                      "download/" version "/zim-testing-suite-" version
+                      ".tar.gz"))
+      (sha256
+       (base32 "1r5cibid3p5x3f463scy309ji9am0ys50s7ray4gv79wjyb1vnmj")))))
+
 (define-public libzim
   (package
     (name "libzim")
@@ -9381,8 +9392,16 @@ (define-public libzim
               (file-name (git-file-name name version))))
     (build-system meson-build-system)
     (arguments
-     ;; TODO: Find out why tests fail.
-     '(#:tests? #f))
+     (list #:configure-flags ''("-Dtest_data_dir=test_data")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'configure 'inject-test-data
+                 (lambda _
+                   (with-directory-excursion (dirname (getcwd))
+                     (mkdir-p "build/test_data")
+                     (invoke "tar" "--strip-components=1"
+                             "-xf" #+zim-testing-suite
+                             "-C" "build/test_data")))))))
     (inputs
      (list icu4c
            python-wrapper ; for libzim-compile-resources
-- 
2.47.1