From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:59550) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkvV8-0003rc-2f for guix-patches@gnu.org; Tue, 09 Jul 2019 15:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkvV6-0004R1-3P for guix-patches@gnu.org; Tue, 09 Jul 2019 15:10:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53695) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkvV4-0004Pu-Q2 for guix-patches@gnu.org; Tue, 09 Jul 2019 15:10:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkvV4-00049L-Jz for guix-patches@gnu.org; Tue, 09 Jul 2019 15:10:02 -0400 Subject: [bug#36555] [PATCH v2 3/3] tests: Add reconfigure system test. Resent-Message-ID: From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) References: <87imsci9sj.fsf@sdf.lonestar.org> <87imsbtk3o.fsf@dustycloud.org> <875zobvxg7.fsf_-_@sdf.lonestar.org> <871ryzvxes.fsf_-_@sdf.lonestar.org> <87wogruisz.fsf_-_@sdf.lonestar.org> Date: Tue, 09 Jul 2019 15:09:46 -0400 In-Reply-To: <87wogruisz.fsf_-_@sdf.lonestar.org> (Jakob L. Kreuze's message of "Tue, 09 Jul 2019 15:09:00 -0400") Message-ID: <87sgrfuirp.fsf_-_@sdf.lonestar.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Lemmer Webber Cc: 36555@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable * gnu/tests/reconfigure.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. =2D-- gnu/local.mk | 1 + gnu/tests/reconfigure.scm | 99 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 gnu/tests/reconfigure.scm diff --git a/gnu/local.mk b/gnu/local.mk index 0e17af953..b334d0572 100644 =2D-- a/gnu/local.mk +++ b/gnu/local.mk @@ -592,6 +592,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/tests/mail.scm \ %D%/tests/messaging.scm \ %D%/tests/networking.scm \ + %D%/tests/reconfigure.scm \ %D%/tests/rsync.scm \ %D%/tests/security-token.scm \ %D%/tests/singularity.scm \ diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm new file mode 100644 index 000000000..bb8c33bf5 =2D-- /dev/null +++ b/gnu/tests/reconfigure.scm @@ -0,0 +1,99 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2019 Jakob L. Kreuze +;;; +;;; 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 reconfigure) + #:use-module (gnu tests) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu services) + #:use-module (gnu services networking) + #:use-module (gnu services shepherd) + #:use-module (guix derivations) + #:use-module (guix gexp) + #:use-module (guix monads) + #:use-module (guix scripts system reconfigure) + #:use-module (guix store) + #:export (%test-switch-to-system)) + +;;; Commentary: +;;; +;;; Test in-place system reconfiguration: advancing the system generation = on a +;;; running instance of the Guix System. +;;; +;;; Code: + +(define* (run-switch-to-system-test) + "Run a test of an OS running SWITCH-SYSTEM-PROGRAM, which creates a new +generation of the system profile." + (define os + (marionette-operating-system + (simple-operating-system) + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm (virtual-machine os)) + + (define (test script) + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + + (define marionette + (make-marionette (list #$vm))) + + (define (system-generations marionette) + "Return the names of the generation symlinks on MARIONETTE." + (marionette-eval + '(begin + (use-modules (ice-9 ftw) + (srfi srfi-1)) + (let* ((profile-dir "/var/guix/profiles/") + (entries (map first (cddr (file-system-tree profile= -dir))))) + (remove (lambda (entry) + (member entry '("per-user" "system"))) + entries))) + marionette)) + + (mkdir #$output) + (chdir #$output) + + (test-begin "switch-to-system") + + (let ((generations-prior (system-generations marionette))) + (test-assert "capture activation script output" + (string? + (marionette-eval + '(primitive-load #$script) + marionette))) + + (test-equal "deployment created new generation" + (length (system-generations marionette)) + (1+ (length generations-prior)))) + + (test-end) + (exit (=3D (test-runner-fail-count (test-runner-current)) 0))))) + + (mlet %store-monad ((script (switch-system-program os))) + (gexp->derivation "switch-to-system" (test script)))) + +(define %test-switch-to-system + (system-test + (name "switch-to-system") + (description "Create a new generation of the system profile.") + (value (run-switch-to-system-test)))) =2D-=20 2.22.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl0k5noACgkQ9Qb9Fp2P 2VoGShAAslLmiT6+TFpQjMcEgOGVctrP6kyFP4FwHeaugMo7X28SJ4pzSuoohl4a ofsfZgY8HJ7dM8/pHY7Q0x6GiRreZKZCqRR28PhjRw6ebEAQGdlXvRRgtVg8kBhw vvXmbY0EKDcJy7nFUZut3b8HrMqXBornKo7q2t1+OUeVLssODVVckPLSKCCFCxOK ilkcwD6a4sddIHcuACPtJ3VZp+OCW8zX9EgROUPnm+ijM63Rx4C04ouUF/NaOOcn obMHWgbL18DsCeuI4BbKtEbFhKtI97RmkoTwDJvEDvrpbB6IeceytCoxSmB+5p3/ li7e9jRkszoF68SYpmHx4AzYk3x65zKaHFIgMcdktj2kP7hmIRL2ON2ayMIZ2wT5 QE5cOhSd5eYKaUVxu5uQadQDtOqOpIrLRyv4ZEYzJyJ/Rka7Q6EHznQ5hB8GpPTv VnA5QFccRka2LXFJmMYjXzIlheSLk62HsMbQ46t/OMqwZqrHDLDQkrfdtrCRto1l /dgdm6aS7ByH7MTp/XC26XYK4pWgZ1+ciClb5lsXS0Ad+4kCqDArzcsgrlQf6KRG CRsMxb6fUBZXEQbmOJf//mwV+raQGGpvvoox6eofhNfpVzSiyhO5KomhUkTMJ23B io5aSx5ojAcXUlvTLazxPMSrWZvPC/f+TEYqrcDb8nGqMnl10ZM= =5DFu -----END PGP SIGNATURE----- --=-=-=--