Subject: [bug#76488] [PATCH 1/4] tests: Export ‘marionette-program’.

From: Ludovic Courtès <[email-masked]>
Date: Sat, 22 Feb 2025 18:10:13 +0100

* gnu/tests.scm (%default-marionette-device): New variable.
(<marionette-configuration>)[device]: Use it.
(marionette-program): Make all parameters optional and export.

Change-Id: I496d88253b5ebad60da09a0cca5ed960aa2ab389
---
 gnu/tests.scm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gnu/tests.scm b/gnu/tests.scm
index 2a9e51511f0..da0b0146ea7 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016-2020, 2022-2024 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2016-2020, 2022-2025 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2017 Mathieu Othacehe <[email-masked]>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2021 Maxime Devos <[email-masked]>
@@ -48,6 +48,7 @@ (define-module (gnu tests)
 
             marionette-service-type
             marionette-operating-system
+            marionette-program
             define-os-with-source
 
             %simple-os
@@ -72,11 +73,15 @@ (define-module (gnu tests)
 ;;;
 ;;; Code:
 
+(define %default-marionette-device
+  ;; Default marionette device in the guest.
+  "/dev/virtio-ports/org.gnu.guix.port.0")
+
 (define-record-type* <marionette-configuration>
   marionette-configuration make-marionette-configuration
   marionette-configuration?
   (device           marionette-configuration-device ;string
-                    (default "/dev/virtio-ports/org.gnu.guix.port.0"))
+                    (default %default-marionette-device))
   (imported-modules marionette-configuration-imported-modules
                     (default '()))
   (extensions       marionette-configuration-extensions
@@ -92,7 +97,10 @@ (define-syntax-rule (with-imported-modules-and-extensions imported-modules
     (with-extensions extensions
       gexp)))
 
-(define (marionette-program device imported-modules extensions)
+(define* (marionette-program #:optional
+                             (device %default-marionette-device)
+                             (imported-modules '())
+                             (extensions '()))
   "Return the program that runs the marionette REPL on DEVICE.  Ensure
 IMPORTED-MODULES and EXTENSIONS are accessible from the REPL."
   (define code
-- 
2.48.1