From patchwork Sat Feb 22 17:10:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38980 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 436B927BBEA; Sat, 22 Feb 2025 17:11:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0646B27BBE2 for ; Sat, 22 Feb 2025 17:11:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlt1s-0003Ib-Na; Sat, 22 Feb 2025 12:11:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1r-0003I2-D4 for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tlt1r-0004NQ-4Y for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=iILKr3rtmfSVxNWCCARoYHwHho3h3VPVnc84U5rZlKA=; b=HoT8RQNOpiNKAtGnLpqCOPLTLrsrXUR8qG2DH6wY/8MhehJOvRrgkyb+JP6pPxquZkM7FSHG653gWu4EHh+gD1FH4vNKaJvLQ9aRsAD8w6XLggkhbc2krmkqzq/RfiS1WQCRPVL30Kk3pNxb8wltxF+GrL/cV/agxN6KoEIoL/5DuOpRr3QoXeIFyXK2igKgsAkl1FOfi0ZOvINGEBKc5Sl90S0AxFpNEGGjH1zT5tTi9dYa3AJkdTGvnwumgptnnwnbveKkQ6KXaweWVhAcnQ5jHXwqPJw8xP7tRYXCueN+eOrodZuNNVF6dWQsxUl+CQf2NxzuoPt5foRM2+QLTw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tlt1q-0002Ee-Vf for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76488] [PATCH 1/4] tests: Export =?utf-8?b?4oCYbWFyaW9uZXR0?= =?utf-8?b?ZS1wcm9ncmFt4oCZLg==?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Feb 2025 17:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76488 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76488@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 76488-submit@debbugs.gnu.org id=B76488.17402442478542 (code B ref 76488); Sat, 22 Feb 2025 17:11:02 +0000 Received: (at 76488) by debbugs.gnu.org; 22 Feb 2025 17:10:47 +0000 Received: from localhost ([127.0.0.1]:57043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tlt1a-0002Db-CG for submit@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58928) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tlt1R-0002Cf-2N for 76488@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1L-0004L4-OJ; Sat, 22 Feb 2025 12:10:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=iILKr3rtmfSVxNWCCARoYHwHho3h3VPVnc84U5rZlKA=; b=ClDqIzL0nbT035zbex7M brKEasCo6HfS9sqVxM3SqA7heAwYepKyloVq/HLROkYs5ozKLZQN8Mvf+pfA8t88eNcmulx7UsKQ3 HVZkRkKGMHC35qfZVQtQmFcNOSxedJI6GcfECTvztqgrHmOgxwTw9uplAftuRa5/Hnn6hk9n+9yho x0w4KuFuzpoVELESM8UM6o9bN8nkrmQyZe3TO4myf6MIjl43BMgv6FcUGxAre4FcJnnP0o1KlTNYc 47SzLYNJWkSi1Fm8zlKC+Dh8Sb4Z88yTXFmDdQMg8HTonEpHpC2Q0lR2R38txvhMaJe1p7m7znLn/ 4ppcbVUjoqHKpQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Feb 2025 18:10:13 +0100 Message-ID: <5d7a1ecb87b871dc98c22be29041361bf543076a.1740243928.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests.scm (%default-marionette-device): New variable. ()[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 +;;; Copyright © 2016-2020, 2022-2025 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2021 Maxime Devos @@ -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 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 From patchwork Sat Feb 22 17:10:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38979 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0AAF627BBEA; Sat, 22 Feb 2025 17:11:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7295E27BBE2 for ; Sat, 22 Feb 2025 17:11:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlt1r-0003Hy-5o; Sat, 22 Feb 2025 12:11:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1q-0003Hl-BX for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tlt1q-0004NC-3A for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=A6wC3vciTBAN1uMxnw0N4tNrObQQoeWqJP6ukYw2HbU=; b=NbuC/tJWZRFbsvXjmzLSqmDNFnMkpqfg2q0r6Aghpl/eiPLuubLkG4aOGL9qYLqFmWDfTDKFy/NugiMzcYphfyCmuj4RqYZuqZXdsbiE9zyUyiSOJh6ShZ7kJrrqmHtnVyF5ycu7qV0ffKcxUxYvyYVPuDcOYXW94GSJiFsxuO+0d2DNQJzhiuZabYbIcjm3pJQRDl1Srb4EfjEJz8O9rfTdsPD7srgqgSW61225Vg1fwG/X4TkwTdqqBaQAPwVyl5p2a9h47gAod++7VlSsi6V0vW+IiIIVmkGhbTX1GOSr9aLRHdSOr9max+si7Lx8IAnajaUnoC7tC3x9GK1W0A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tlt1p-0002EQ-VH for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76488] [PATCH 2/4] vm: =?utf-8?b?4oCYY29tbW9uLXFlbXUtb3B0aW9u?= =?utf-8?b?c+KAmQ==?= splits command-line tokens. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Feb 2025 17:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76488 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76488@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 76488-submit@debbugs.gnu.org id=B76488.17402442418517 (code B ref 76488); Sat, 22 Feb 2025 17:11:01 +0000 Received: (at 76488) by debbugs.gnu.org; 22 Feb 2025 17:10:41 +0000 Received: from localhost ([127.0.0.1]:57039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tlt1U-0002D5-Ju for submit@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58940) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tlt1R-0002Cg-Vp for 76488@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1M-0004LE-Mo; Sat, 22 Feb 2025 12:10:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=A6wC3vciTBAN1uMxnw0N4tNrObQQoeWqJP6ukYw2HbU=; b=pFMGscMlMegC0vSpSmJn pCGL/kan+aaxhxCqbFVF21T96oIMP3uxnexDtQgoipKK+cRf9SvqG2Wgb+3vk1/HcpIu2vuwTYJnw n9JpNu9t8abxm7II6o6kGJ/38R6q+v4vi5Bkv8BdBclYAnJqiFQFqUM+jOShYiN7gDGz2g956bFBk KywucHN1A06AHrypFXSHHwCYbkuB4xnD377PZeDiTad0OeA1v5qC68N1rAchOwecULebdg4H7w5xb Z23H1AxumOeumPEZhTq5P9aTEmOqUu5pXf2EpJ7p+au1A8zMvkLlhOEK47DAIgmobtYaUmI7N7J/r +BnabQo68kFtEg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Feb 2025 18:10:14 +0100 Message-ID: <70d3a086aeed2da038467f6c4670e51b61f29cc6.1740243928.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The result returned so far by ‘common-qemu-options’ assumed that it would be passed to a shell. This is the case when using ‘system-qemu-image/shared-store-script’ but possibly not in other cases. * gnu/system/vm.scm (common-qemu-options): Add #:image-format. [virtfs-option]: Return a list of strings instead of a single "-virtfs xyz" string. Update caller to use ‘append-map’. Separate "-drive" string. Change-Id: Ib07c27e2c4b2d222d7db2c612bb045d330bc7f68 --- gnu/system/vm.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 1e3f72c7b2a..dbfe873e4f5 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2024 Ludovic Courtès +;;; Copyright © 2013-2025 Ludovic Courtès ;;; Copyright © 2016 Christine Lemmer-Webber ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe @@ -211,14 +211,16 @@ (define* (virtualized-operating-system os (define* (common-qemu-options image shared-fs #:key + (image-format "raw") rw-image? (target (%current-target-system))) "Return the a string-value gexp with the common QEMU options to boot IMAGE, with '-virtfs' options for the host file systems listed in SHARED-FS." (define (virtfs-option fs) - #~(format #f "-virtfs local,path=~s,security_model=none,mount_tag=~s" - #$fs #$(file-system->mount-tag fs))) + #~("-virtfs" + (format #f "local,path=~a,security_model=none,mount_tag=~a" + #$fs #$(file-system->mount-tag fs)))) #~(;; Only enable kvm if we see /dev/kvm exists. ;; This allows users without hardware virtualization to still use these @@ -230,11 +232,12 @@ (define* (common-qemu-options image shared-fs "-object" "rng-random,filename=/dev/urandom,id=guix-vm-rng" "-device" "virtio-rng-pci,rng=guix-vm-rng" - #$@(map virtfs-option shared-fs) - #$@(if rw-image? - #~((format #f "-drive file=~a,format=qcow2,if=virtio" #$image)) - #~((format #f "-drive file=~a,format=raw,if=virtio,cache=writeback,werror=report,readonly=on" - #$image))))) + #$@(append-map virtfs-option shared-fs) + "-drive" + #$(if rw-image? + #~(format #f "file=~a,format=qcow2,if=virtio" #$image) + #~(format #f "file=~a,format=~a,if=virtio,cache=writeback,werror=report,readonly=on" + #$image #$image-format)))) (define* (system-qemu-image/shared-store-script os #:key From patchwork Sat Feb 22 17:10:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38981 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 64B9827BBEA; Sat, 22 Feb 2025 17:11:32 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2CFC227BBE2 for ; Sat, 22 Feb 2025 17:11:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlt1s-0003IZ-G3; Sat, 22 Feb 2025 12:11:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1q-0003Hu-W6 for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tlt1q-0004NJ-K2 for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=IYTNKFh2CZhPwTH/vq+gX8r5n92FU1BzGUWNuICccaA=; b=hkNqkUVE0BtUbvUn+8tzR11zQ2KhiX8PSDX/SNKT/sImLECWGBkuzb7ulVTgCDA1oZhYZy26DREXusk9ZMFlO+RL/T0lvEawdP98mVCMcQkswgfKC13qbVvDSbfKVDmZLxfZA3ZA+py7tdtDlaZnLGb1af/fiG+xfjeALL5/3VmCVFLGPH/mDMHHxRnNOKskXFXlME07EVVaoQTQqCRrgzT2/pi2oJEHm60zFO6cQKQq575itL6Iwv6kAfOVWLeFTQdS1F5jYxL+m8reAZ07540nsq+wgyb2LnFBJHBBTj876oztYZ2rSB7wtT09FetrxljglUXzKEiEjC++7zSVlw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tlt1q-0002EX-FX for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76488] [PATCH 3/4] vm: Export =?utf-8?b?4oCYZmlsZS1zeXN0ZW0t?= =?utf-8?b?Pm1vdW50LXRhZ+KAmQ==?= and =?utf-8?b?4oCYY29tbW9uLXFlbXUtb3B0aW9u?= =?utf-8?b?c+KAmS4=?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Feb 2025 17:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76488 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76488@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 76488-submit@debbugs.gnu.org id=B76488.17402442468533 (code B ref 76488); Sat, 22 Feb 2025 17:11:02 +0000 Received: (at 76488) by debbugs.gnu.org; 22 Feb 2025 17:10:46 +0000 Received: from localhost ([127.0.0.1]:57041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tlt1Z-0002DX-W1 for submit@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58954) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tlt1T-0002Ci-4Y for 76488@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:39 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1N-0004LL-KF; Sat, 22 Feb 2025 12:10:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=IYTNKFh2CZhPwTH/vq+gX8r5n92FU1BzGUWNuICccaA=; b=DDHvSqFFYqRsnlH8Ithz +V8agwF/ocKvdhf/eSO5KlqhydtcKu7eCxU0Ubw0rKDLXXok/3X/OwNn8nveQM+qDWU1N4a9BoqIS 7EavsP7BhMXonFyDwFqikaArnMO02MbgKYLW5P8UNqiUapa7JY33y0/qZ/i1bpumi8AFJaASx7fFK g2ojVXMfMzAj8jBTCr8CKBhOcRiRwtyRQCIrWkuGzwDU7QFMit8wwAQNv0AeU1qEzKuojIRXuiw0P 3s5CPzQC7Omm78WlNKC/4brxNVfYYFoe2VwZpSCY7iuEIqih8AFRULNJD9jZmq0oqohA4qy+UiY1U QNGZ/9rJK3frXA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Feb 2025 18:10:15 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/system/vm.scm (file-system->mount-tag, common-qemu-options): Export. Change-Id: I7228e5c02f07f8c8633a64c86d9c81aa3cb2e8b7 --- gnu/system/vm.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index dbfe873e4f5..4f2a27daf7a 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -85,7 +85,10 @@ (define-module (gnu system vm) virtual-machine-memory-size virtual-machine-disk-image-size virtual-machine-port-forwardings - virtual-machine-date)) + virtual-machine-date + + file-system->mount-tag + common-qemu-options)) ;;; Commentary: From patchwork Sat Feb 22 17:10:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38982 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DBE4827BBEA; Sat, 22 Feb 2025 17:11:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E361F27BBE2 for ; Sat, 22 Feb 2025 17:11:37 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlt1v-0003J8-84; Sat, 22 Feb 2025 12:11:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1s-0003IS-4Y for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tlt1r-0004NW-Kb for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=9lxNSCriN0s3RrKYtQo2/cragD6I+7yiy6yfnnojgro=; b=sKr3yHrUk2RtudYgh8mMucJZFwA6ITpv+Ls3jNThCyRRheT26w2bYrVVCLT0al/AjVzY+exrL6W+BRTAiLJgnB3A+NCvMlcxqa2pR9w9HV0pVbxIqcFdUiD35lXt6WGxrX3U4jZv41Px6h/8e6tD5ph+U/hXQT9iCGafIuN5reGDFwwxMBEGckujgn41no47hlx/48IjqPBgzvWa0/85F8mtEljZKQqPNyibJ1UHucNxoaKzWCfL1u79ITRnBZBFCIEi5GrEXDXYuAKIhhUyogTBhuEd0ZqtXkchGDwLoo3bs4IndnfTUoZCnqwLZhWGaBaw3gKAfoLUN1mcZy7Smw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tlt1r-0002Em-GL for guix-patches@gnu.org; Sat, 22 Feb 2025 12:11:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76488] [PATCH 4/4] tests: Test installation on Debian. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Feb 2025 17:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76488 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76488@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 76488-submit@debbugs.gnu.org id=B76488.17402442488553 (code B ref 76488); Sat, 22 Feb 2025 17:11:03 +0000 Received: (at 76488) by debbugs.gnu.org; 22 Feb 2025 17:10:48 +0000 Received: from localhost ([127.0.0.1]:57045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tlt1b-0002Dj-84 for submit@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58966) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tlt1T-0002Cm-RB for 76488@debbugs.gnu.org; Sat, 22 Feb 2025 12:10:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlt1O-0004LT-Gi; Sat, 22 Feb 2025 12:10:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=9lxNSCriN0s3RrKYtQo2/cragD6I+7yiy6yfnnojgro=; b=QxXpyJkQcbUbSyIjvv1O OgTdA3j0921lmQBDJoXxbTq6q3M7foQrDx8Q0csXV9zsHZ3FxQ+IYovGdQNFbsx3t0dI64Ax6wel9 3fed6t0uW+NH1Cu8c5e3MdzvNPqbGLYQCdQv3ylILC9fmEZJ09TypQwADXwD1mFIZ5KchYb/sm/DZ nFSZBIVyHJQRu02GjCKR5Z4TW/vS+u8/BXr2j/2NrtUA+DcazhNamsqEIbCp55mugu8diAxk8HufR xcgeLWhUVVCE6xPnKfeaWfO2WmYaittujSgGw4KtPkH2TA1mYcgzC58rf+9F/iH0mX6gBM+mwl6bG +fD3kBNhoZ3gCw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Feb 2025 18:10:16 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/foreign.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. Change-Id: I1f24d83bdc298acbef15db2e19775cc1d3fbd56c --- gnu/local.mk | 1 + gnu/tests/foreign.scm | 337 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 338 insertions(+) create mode 100644 gnu/tests/foreign.scm diff --git a/gnu/local.mk b/gnu/local.mk index c421da85cba..66cca59839e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -848,6 +848,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/docker.scm \ %D%/tests/emacs.scm \ %D%/tests/file-sharing.scm \ + %D%/tests/foreign.scm \ %D%/tests/ganeti.scm \ %D%/tests/gdm.scm \ %D%/tests/guix.scm \ diff --git a/gnu/tests/foreign.scm b/gnu/tests/foreign.scm new file mode 100644 index 00000000000..8cf580cb22d --- /dev/null +++ b/gnu/tests/foreign.scm @@ -0,0 +1,337 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests foreign) + #:use-module (guix download) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (guix monads) + #:use-module (guix packages) + #:use-module (guix profiles) + #:autoload (guix store) (%store-prefix %store-monad %graft?) + #:use-module (gnu compression) + #:use-module (gnu tests) + #:use-module (gnu packages base) + #:use-module (gnu packages bootstrap) + #:use-module (gnu packages guile) + #:use-module (gnu packages make-bootstrap) + #:use-module (gnu packages package-management) + #:use-module (gnu packages virtualization) + #:use-module (gnu system vm) + #:use-module ((guix scripts pack) #:prefix pack:) + #:use-module (srfi srfi-9)) + +(define marionette-systemd-service + ;; Definition of the marionette service for systemd. + (plain-file "marionette.service" " +[Unit] +Description=Guix marionette service + +[Install] +WantedBy=multi-user.target + +[Service] +ExecStart=/opt/guix/bin/guile --no-auto-compile \\ + /opt/guix/share/guix/marionette-repl.scm\n")) + +(define* (qcow-image-with-marionette image + #:key + (name "image-with-marionette.qcow2") + (device "/dev/vdb1")) + "Instrument IMAGE, returning a new image that contains a statically-linked +Guile under /opt/guix and a marionette systemd service. The relevant file +system is expected to be on DEVICE." + (define vm + (virtual-machine + (marionette-operating-system %simple-os))) + + (define build + (with-imported-modules (source-module-closure + '((guix build utils) + (gnu build marionette))) + #~(begin + (use-modules (guix build utils) + (gnu build marionette)) + + (define target-image + #$output) + + (invoke #+(file-append qemu "/bin/qemu-img") + "create" "-b" #$image + "-F" "qcow2" "-f" "qcow2" target-image + "10G") + + ;; Run a VM that will mount IMAGE and populate it. This is somewhat + ;; more convenient to set up than 'guestfish' from libguestfs. + (let ((marionette + (make-marionette + (list #$vm "-drive" + (string-append "file=" target-image + ",format=qcow2,if=virtio," + "cache=writeback,werror=report,readonly=off"))))) + + (marionette-eval '(system* "mount" #$device "/mnt") + marionette) + (marionette-eval '(system* "ls" "-la" "/mnt") + marionette) + (marionette-eval '(begin + (use-modules (guix build utils)) + (mkdir-p "/mnt/opt/guix") + (copy-recursively #$%guile-static-initrd + "/mnt/opt/guix" + #:log (%make-void-port "w"))) + marionette) + (marionette-eval '(system* "/mnt/opt/guix/bin/guile" "--version") + marionette) + (unless (= 42 (status:exit-val + (marionette-eval '(system* "/mnt/opt/guix/bin/guile" + "-c" "(exit 42)") + marionette))) + (error "statically-linked Guile is broken")) + + ;; Install the marionette systemd service and activate it. + (marionette-eval '(begin + (mkdir-p "/mnt/opt/guix/share/guix") + (copy-file #$(marionette-program) + "/mnt/opt/guix/share/guix/marionette-repl.scm") + + (mkdir-p "/mnt/etc/systemd/system") + (copy-file #$marionette-systemd-service + "/mnt/etc/systemd/system/marionette.service") + + ;; Activate the service, as per 'systemctl + ;; enable marionette.service'. + (symlink + "/etc/systemd/system/marionette.service" + "/mnt/etc/systemd/system/multi-user.target.wants/marionette.service")) + marionette) + + (unless (zero? (marionette-eval '(system* "umount" "/mnt") + marionette)) + (error "failed to unmount device")))))) + + (computed-file name build)) + +(define (manifest-entry-without-grafts entry) + "Return ENTRY with grafts disabled on its contents." + (manifest-entry + (inherit entry) + (item (with-parameters ((%graft? #f)) + (manifest-entry-item entry))))) + +(define %installation-tarball-manifest + ;; Manifest of the Guix installation tarball. + (concatenate-manifests + (list (packages->manifest (list guix)) + + ;; Include the dependencies of 'hello' in addition to 'guix' so that + ;; we can test 'guix build hello'. + (map-manifest-entries + manifest-entry-without-grafts + (package->development-manifest hello)) + + ;; Add the source of 'hello'. + (manifest + (list (manifest-entry + (name "hello-source") + (version (package-version hello)) + (item (let ((file (origin-actual-file-name + (package-source hello)))) + (computed-file + "hello-source" + #~(begin + ;; Put the tarball in a subdirectory since + ;; profile union crashes otherwise. + (mkdir #$output) + (mkdir (in-vicinity #$output "src")) + (symlink #$(package-source hello) + (in-vicinity #$output + (string-append "src/" + #$file)))))))))) + + ;; Include 'guile-final', which is needed when building derivations + ;; such as that of 'hello' but missing from the development manifest. + ;; Add '%bootstrap-guile', used by 'guix install --bootstrap'. + (map-manifest-entries + manifest-entry-without-grafts + (packages->manifest (list (canonical-package guile-3.0) + %bootstrap-guile)))))) + +(define %guix-install-script + ;; The 'guix-install.sh' script. + ;; + ;; To test local changes, replace the expression below with: + ;; + ;; (local-file "../../etc/guix-install.sh") + ;; + ;; This cannot be done unconditionally since that file does not exists in + ;; inferiors. + (file-append (package-source guix) "/etc/guix-install.sh")) + +(define (run-foreign-install-test image name) + "Run an installation of Guix in IMAGE, the QCOW2 image of a systemd-based +GNU/Linux distro, and check that the installation is functional." + (define instrumented-image + (qcow-image-with-marionette image + #:name (string-append name ".qcow2"))) + + (define (test tarball) + (with-imported-modules (source-module-closure + '((gnu build marionette) + (gnu system file-systems))) + #~(begin + (use-modules (gnu build marionette) + (gnu system file-systems) + (srfi srfi-64) + (ice-9 match)) + + (define marionette + (make-marionette + (list (string-append #$qemu-minimal "/bin/" (qemu-command)) + #$@(common-qemu-options instrumented-image + (list (%store-prefix)) + #:image-format "qcow2" + #:rw-image? #t) + "-m" "512" + "-snapshot"))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "foreign-install") + + (test-equal "marionette works" + "Linux" + (marionette-eval '(utsname:sysname (uname)) + marionette)) + + (test-equal "mount host file store" + 0 + (marionette-eval + '(begin + (mkdir "/host") + (system* "mount" "-t" "9p" + "-o" "trans=virtio,cache=loose,ro" + #$(file-system->mount-tag (%store-prefix)) + "/host")) + marionette)) + + (test-assert "screenshot before" + (marionette-control (string-append "screendump " #$output + "/before-install.ppm") + marionette)) + + (test-assert "install fake dependencies" + ;; The installation script insists on checking for the + ;; availability of 'wget' and 'gpg' but does not actually use them + ;; when 'GUIX_BINARY_FILE_NAME' is set. Provide fake binaries. + (marionette-eval '(begin + (symlink "/bin/true" "/bin/wget") + (symlink "/bin/true" "/bin/gpg") + #t) + marionette)) + + (test-assert "run install script" + (marionette-eval '(system + (string-append + "yes '' | GUIX_BINARY_FILE_NAME=" + (in-vicinity "/host" + (basename #$tarball)) + " sh " + (in-vicinity + "/host" + (string-drop #$%guix-install-script + #$(string-length + (%store-prefix)))))) + marionette)) + + (test-equal "hello not already built" + #f + ;; Check that the next test will really build 'hello'. + (marionette-eval '(file-exists? + #$(with-parameters ((%graft? #f)) + hello)) + marionette)) + + (test-equal "guix build hello" + 0 + ;; Check that guix-daemon is up and running and that the build + ;; environment is properly set up (build users, etc.). + (marionette-eval '(system* "guix" "build" "hello" "--no-grafts") + marionette)) + + (test-assert "hello indeed built" + (marionette-eval '(file-exists? + #$(with-parameters ((%graft? #f)) + hello)) + marionette)) + + (test-equal "guix install hello" + 0 + ;; Check that ~/.guix-profile & co. are properly created. + (marionette-eval '(let ((pw (getpwuid (getuid)))) + (setenv "USER" (passwd:name pw)) + (setenv "HOME" (pk 'home (passwd:dir pw))) + (system* "guix" "install" "hello" + "--no-grafts" "--bootstrap")) + marionette)) + + (test-equal "user profile created" + 0 + (marionette-eval '(system "ls -lad ~/.guix-profile") + marionette)) + + (test-equal "hello" + 0 + (marionette-eval '(system "~/.guix-profile/bin/hello") + marionette)) + + (test-assert "screenshot after" + (marionette-control (string-append "screendump " #$output + "/after-install.ppm") + marionette)) + + (test-end)))) + + (mlet* %store-monad ((profile (profile-derivation + %installation-tarball-manifest)) + (tarball (pack:self-contained-tarball + "guix-binary" profile + #:compressor (lookup-compressor "zstd") + #:profile-name "current-guix" + #:localstatedir? #t))) + (gexp->derivation name (test tarball)))) + +(define debian-12-qcow2 + ;; Image taken from . + ;; XXX: Those images are periodically removed from debian.org. + (origin + (uri + "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2") + (method url-fetch) + (sha256 + (base32 + "06vlcq2dzgczlyp9lfkkdf3dgvfjp22lh5xz0mnl0bdgzq61sykb")))) + +(define %test-foreign-install + (system-test + (name "debian-install") + (description + "Test installation of Guix on Debian using the @file{guix-install.sh} +script.") + (value (run-foreign-install-test debian-12-qcow2 name)))) + +%test-foreign-install