diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm index d848ecd9c4b..76410f192e8 100644 --- a/guix/build-system/renpy.scm +++ b/guix/build-system/renpy.scm @@ -81,6 +81,8 @@ (outputs '("out")) (output "out") (game "game") + (tests? #t) + (test-flags ''()) (search-paths '()) (system (%current-system)) (guile #f) @@ -102,6 +104,8 @@ #:outputs #$(outputs->gexp outputs) #:output #$output #:game #$game + #:test-flags #$test-flags + #:tests? #$tests? #:search-paths '#$(sexp->gexp (map search-path-specification->sexp diff --git a/guix/build/renpy-build-system.scm b/guix/build/renpy-build-system.scm index 04ac9120603..cc5ded69f4e 100644 --- a/guix/build/renpy-build-system.scm +++ b/guix/build/renpy-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021 Liliana Marie Prikler +;;; Copyright © 2021, 2025 Liliana Marie Prikler ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +39,19 @@ ;; badly if we do "quit")) +(define* (start-xorg-server #:key tests? inputs native-inputs #:allow-other-keys) + (when tests? + (let ((Xvfb (search-input-file (or native-inputs inputs) + "/bin/Xvfb"))) + (setenv "HOME" (getcwd)) + (system (format #f "~a :1 &" Xvfb)) + (setenv "DISPLAY" ":1")))) + +(define* (check #:key game tests? (test-flags '()) #:allow-other-keys) + (if tests? + (apply invoke "renpy" game "test" test-flags) + (display "test suite not run\n"))) + (define* (install #:key inputs outputs game (output "out") #:allow-other-keys) (let* ((out (assoc-ref outputs output)) (json-dump (call-with-input-file (string-append game @@ -87,7 +100,8 @@ (delete 'bootstrap) (delete 'configure) (replace 'build build) - (delete 'check) + (add-before 'check 'start-xorg-server start-xorg-server) + (replace 'check check) (replace 'install install) (add-after 'install 'install-desktop-file install-desktop-file)))