build: renpy: Add check command.

* guix/build/renpy-build-system.scm (start-xorg-server, check): New variables.
(%standard-phases): Adjust accordingly.
* guix/build-system/renpy.scm (renpy-build): Support #:tests? and #:test-flags.
This commit is contained in:
Liliana Marie Prikler 2025-11-29 17:24:53 +01:00
parent a6c83120f2
commit 712d0c27f8
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
2 changed files with 20 additions and 2 deletions

View file

@ -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

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2021, 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;;
;;; 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)))