From 712d0c27f88ea980495d3df644da0a44c8036db0 Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Sat, 29 Nov 2025 17:24:53 +0100 Subject: [PATCH] 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. --- guix/build-system/renpy.scm | 4 ++++ guix/build/renpy-build-system.scm | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm index d848ecd9c4..76410f192e 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 04ac912060..cc5ded69f4 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)))