From patchwork Sun Mar 13 05:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 37772 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 D8BF027BBE9; Sun, 13 Mar 2022 05:45:29 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable 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 BE72127BBEA for ; Sun, 13 Mar 2022 05:45:28 +0000 (GMT) Received: from localhost ([::1]:42132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTH2l-0005E5-Rm for patchwork@mira.cbaines.net; Sun, 13 Mar 2022 00:45:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTH2N-0005C4-CV for guix-patches@gnu.org; Sun, 13 Mar 2022 00:45:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTH2N-0007SA-3L for guix-patches@gnu.org; Sun, 13 Mar 2022 00:45:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTH2N-0007sC-2A for guix-patches@gnu.org; Sun, 13 Mar 2022 00:45:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54368] [PATCH 2/4] tests: install: Streamline 'qemu-command/writable-image'. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Mar 2022 05:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54368 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54368@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 54368-submit@debbugs.gnu.org id=B54368.164715029230199 (code B ref 54368); Sun, 13 Mar 2022 05:45:03 +0000 Received: (at 54368) by debbugs.gnu.org; 13 Mar 2022 05:44:52 +0000 Received: from localhost ([127.0.0.1]:41409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTH2C-0007r1-8D for submit@debbugs.gnu.org; Sun, 13 Mar 2022 00:44:52 -0500 Received: from mail-qk1-f181.google.com ([209.85.222.181]:34772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTH2A-0007qY-Dh for 54368@debbugs.gnu.org; Sun, 13 Mar 2022 00:44:50 -0500 Received: by mail-qk1-f181.google.com with SMTP id 1so9738762qke.1 for <54368@debbugs.gnu.org>; Sat, 12 Mar 2022 21:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jxzUKyzPB6YDczelGkxCT4nUeEucVvKs1dGfgMu6LNo=; b=qy93ONtJrhV/OEuKQwS5k9ywmlYaMc72JJFf54pisE2GbSWIXBNcwEZbVa47eBjZCt MxfDICciCbRUi9yE8qaY896zMW30j18WWcDIDdSsihxxehPRqHSPwZg3P9/JufcxNBib rqehy3FhJIIQWmcYmOZ1NHeQsN9jHHxcaxzeX9vtin/qT1bh8lL3Mo9OvKJTGTXb1Ahl Lx5i4egXEg5ny1cfDHzFOlA9BiL0mHFPTEES92hLlbUtUzS57HFqGaRvaUW6OCkGrnAG qEZE64Sbx9VSBGPP4USa+i+WB/0diaVs4fTYk2SLJIrIivo4OuDJbDoSIvstJpNlsrM9 +EDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jxzUKyzPB6YDczelGkxCT4nUeEucVvKs1dGfgMu6LNo=; b=ywS1oh8zoETXMmUM5nnz/nLV4wVuOnlHc79D3yMCTlNKJWS1TmhjuBaB/ndMnFlmMa Y5tGQBATWPBidf3BD8zbtGc4xu2dv/3tbm0DeH64H+b+HXKnsOLTKuwD1o6rPdpnqhru JBc7VsLw2DTdJbu9b4AKYmi6CsT2uz00mbG1t4Gp6RxvpmBpSo2THINtIlAVOOhJyH3w DWXtmIGDeK+SIfxhDbJuGjw23SPI8ZTG6Bea9b1Y+vFTJskG8Va0/thryszwi/RtycRI IrzbfS9EQiyu4eZj515C7oPZdXW2+ALAXRLde7+TTr0tGPQ8Awk7Tu+gOMjk+nP8qFQy MaHw== X-Gm-Message-State: AOAM5326EDbVcS85EgzLl2ytfehPz40yfnUWV25s3o3R/j//eZtlmVYX KL8T/Bjco5ET9S9tFgk2RlJam5c68Lg= X-Google-Smtp-Source: ABdhPJwUFbe1OZkyE5Mgttbdv4OkieHHr/van4DgpSGCwk7oQz4AGhSVa/0ZoA5Zv/V3ciz+wH5JNg== X-Received: by 2002:a37:bac6:0:b0:663:5fde:226f with SMTP id k189-20020a37bac6000000b006635fde226fmr11318697qkf.137.1647150284699; Sat, 12 Mar 2022 21:44:44 -0800 (PST) Received: from localhost.localdomain (dsl-153-119.b2b2c.ca. [66.158.153.119]) by smtp.gmail.com with ESMTPSA id v129-20020a379387000000b0064936bab2fcsm6376657qkd.48.2022.03.12.21.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Mar 2022 21:44:44 -0800 (PST) From: Maxim Cournoyer Date: Sun, 13 Mar 2022 00:43:53 -0500 Message-Id: <20220313054356.17578-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220313054356.17578-1-maxim.cournoyer@gmail.com> References: <20220313054356.17578-1-maxim.cournoyer@gmail.com> 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" X-getmail-retrieved-from-mailbox: Patches * gnu/tests/install.scm (qemu-command/writable-image): Replace the use of a writable backing file by the use of the '-snapshot' option, and rename to... (qemu-command*): ... this, adjusting all calls. --- gnu/tests/install.scm | 61 +++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index ae8c6051f1..d1f8cc1c6d 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -341,29 +341,16 @@ (define marionette (gexp->derivation "installation" install #:substitutable? #f))) ;too big -(define* (qemu-command/writable-image image - #:key - (uefi-support? #f) - (memory-size 256)) - "Return as a monadic value the command to run QEMU on a writable copy of -IMAGE, a disk image. The QEMU VM has access to MEMORY-SIZE MiB of RAM." +(define* (qemu-command* image #:key (uefi-support? #f) (memory-size 256)) + "Return as a monadic value the command to run QEMU with a writable overlay +above IMAGE, a disk image. The QEMU VM has access to MEMORY-SIZE MiB of RAM." (mlet* %store-monad ((system (current-system)) (uefi-firmware -> (and uefi-support? (uefi-firmware system)))) - (return #~(let ((image #$image)) - ;; First we need a writable copy of the image. - (format #t "creating writable image from '~a'...~%" image) - (unless (zero? (system* #+(file-append qemu-minimal - "/bin/qemu-img") - "create" "-f" "qcow2" "-F" "qcow2" - "-o" - (string-append "backing_file=" image) - "disk.img")) - (error "failed to create writable QEMU image" image)) - - (chmod "disk.img" #o644) + (return #~(begin `(,(string-append #$qemu-minimal "/bin/" #$(qemu-command system)) + "-snapshot" ;for the volatile, writable overlay ,@(if (file-exists? "/dev/kvm") '("-enable-kvm") '()) @@ -371,7 +358,7 @@ (define* (qemu-command/writable-image image '("-bios" #$uefi-firmware) '()) "-no-reboot" "-m" #$(number->string memory-size) - "-drive" "file=disk.img,if=virtio"))))) + "-drive" (format #f "file=~a,if=virtio" #$image)))))) (define %test-installed-os (system-test @@ -382,7 +369,7 @@ (define %test-installed-os build (current-guix) and then store a couple of full system images.") (value (mlet* %store-monad ((image (run-install %minimal-os %minimal-os-source)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %minimal-os command "installed-os"))))) @@ -399,7 +386,7 @@ (define %test-installed-extlinux-os (list syslinux) #:script %extlinux-gpt-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %minimal-extlinux-os command "installed-extlinux-os"))))) @@ -476,7 +463,7 @@ (define %test-iso-image-installer %simple-installation-script-for-/dev/vda #:installation-image-type 'uncompressed-iso9660)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %minimal-os-on-vda command name))))) @@ -531,7 +518,7 @@ (define %test-separate-home-os %separate-home-os-source #:script %simple-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %separate-home-os command "separate-home-os"))))) @@ -608,7 +595,7 @@ (define %test-separate-store-os %separate-store-os-source #:script %separate-store-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %separate-store-os command "separate-store-os"))))) @@ -690,7 +677,7 @@ (define %test-raid-root-os #:script %raid-root-installation-script #:target-size (* 3200 MiB))) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %raid-root-os `(,@command) "raid-root-os"))))) @@ -823,7 +810,7 @@ (define %test-encrypted-root-os %encrypted-root-os-source #:script %encrypted-root-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %encrypted-root-os command "encrypted-root-os" #:initialization enter-luks-passphrase))))) @@ -909,7 +896,7 @@ (define %test-lvm-separate-home-os %lvm-separate-home-installation-script #:packages (list lvm2-static) #:target-size (* 3200 MiB))) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %lvm-separate-home-os `(,@command) "lvm-separate-home-os"))))) @@ -1009,7 +996,7 @@ (define %test-encrypted-root-not-boot-os %encrypted-root-not-boot-os-source #:script %encrypted-root-not-boot-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %encrypted-root-not-boot-os command "encrypted-root-not-boot-os" #:initialization enter-luks-passphrase))))) @@ -1085,7 +1072,7 @@ (define %test-btrfs-root-os %btrfs-root-os-source #:script %btrfs-root-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %btrfs-root-os command "btrfs-root-os"))))) @@ -1153,7 +1140,7 @@ (define %test-btrfs-raid-root-os %btrfs-raid-root-os-source #:script %btrfs-raid-root-installation-script #:target-size (* 2800 MiB))) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %btrfs-raid-root-os `(,@command) "btrfs-raid-root-os"))))) @@ -1245,7 +1232,7 @@ (define %test-btrfs-root-on-subvolume-os %btrfs-root-on-subvolume-os-source #:script %btrfs-root-on-subvolume-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %btrfs-root-on-subvolume-os command "btrfs-root-on-subvolume-os"))))) @@ -1319,7 +1306,7 @@ (define %test-jfs-root-os %jfs-root-os-source #:script %jfs-root-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %jfs-root-os command "jfs-root-os"))))) @@ -1392,7 +1379,7 @@ (define %test-f2fs-root-os %f2fs-root-os-source #:script %f2fs-root-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %f2fs-root-os command "f2fs-root-os"))))) @@ -1465,7 +1452,7 @@ (define %test-xfs-root-os %xfs-root-os-source #:script %xfs-root-installation-script)) - (command (qemu-command/writable-image image))) + (command (qemu-command* image))) (run-basic-test %xfs-root-os command "xfs-root-os"))))) @@ -1748,9 +1735,9 @@ (define* (guided-installation-test name #:desktop? desktop? #:encrypted? encrypted? #:uefi-support? uefi-support?)))) - (command (qemu-command/writable-image image - #:uefi-support? uefi-support? - #:memory-size 512))) + (command (qemu-command* image + #:uefi-support? uefi-support? + #:memory-size 512))) (run-basic-test target-os command name #:initialization (and encrypted? enter-luks-passphrase) #:root-password %root-password