From patchwork Wed Aug 7 12:42:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jakob L. Kreuze" X-Patchwork-Id: 14884 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 8310517274; Wed, 7 Aug 2019 13:46:31 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 4785217252 for ; Wed, 7 Aug 2019 13:46:31 +0100 (BST) Received: from localhost ([::1]:40644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvLKo-0007eh-VT for patchwork@mira.cbaines.net; Wed, 07 Aug 2019 08:46:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48299) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvLKe-0007SE-Iv for guix-patches@gnu.org; Wed, 07 Aug 2019 08:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvLKV-00040x-4U for guix-patches@gnu.org; Wed, 07 Aug 2019 08:46:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hvLKN-0003vr-IY for guix-patches@gnu.org; Wed, 07 Aug 2019 08:46:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hvLKN-0000Ld-Fq for guix-patches@gnu.org; Wed, 07 Aug 2019 08:46:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36953] [PATCH] reconfigure: Improve tests for system activation. Resent-From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Aug 2019 12:46:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36953 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 36953@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15651819601304 (code B ref -1); Wed, 07 Aug 2019 12:46:03 +0000 Received: (at submit) by debbugs.gnu.org; 7 Aug 2019 12:46:00 +0000 Received: from localhost ([127.0.0.1]:38158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvLKJ-0000Ky-OF for submit@debbugs.gnu.org; Wed, 07 Aug 2019 08:45:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:45928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvLKI-0000Kr-95 for submit@debbugs.gnu.org; Wed, 07 Aug 2019 08:45:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48184) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvLKH-0007Ky-5g for guix-patches@gnu.org; Wed, 07 Aug 2019 08:45:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvLKF-0003qO-Vf for guix-patches@gnu.org; Wed, 07 Aug 2019 08:45:57 -0400 Received: from mx.sdf.org ([205.166.94.20]:65364) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hvLKF-0003pU-Iz for guix-patches@gnu.org; Wed, 07 Aug 2019 08:45:55 -0400 Received: from Epsilon (pool-173-76-53-40.bstnma.fios.verizon.net [173.76.53.40]) (authenticated (0 bits)) by mx.sdf.org (8.15.2/8.14.5) with ESMTPSA id x77CjrkZ018386 (using TLSv1.2 with cipher AES256-GCM-SHA384 (256 bits) verified NO) for ; Wed, 7 Aug 2019 12:45:54 GMT From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) Date: Wed, 07 Aug 2019 08:42:42 -0400 Message-ID: <87r25x4059.fsf@sdf.lonestar.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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/reconfigure.scm (run-switch-to-system-test): Assert that '/run/current-system' points to the activated system, and that new user accounts specified in the operating system declaration are created. --- gnu/tests/reconfigure.scm | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index 3a2f0a2e53..fb11e6164e 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -19,8 +19,10 @@ (define-module (gnu tests reconfigure) #:use-module (gnu bootloader) #:use-module (gnu services shepherd) - #:use-module (gnu system vm) #:use-module (gnu system) + #:use-module (gnu system accounts) + #:use-module (gnu system shadow) + #:use-module (gnu system vm) #:use-module (gnu tests) #:use-module (guix derivations) #:use-module (guix gexp) @@ -43,7 +45,13 @@ generation of the system profile." (define os (marionette-operating-system - (simple-operating-system) + (operating-system + (inherit (simple-operating-system)) + (users (cons (user-account + (name "jakob") + (group "users") + (home-directory "/home/jakob")) + %base-user-accounts))) #:imported-modules '((gnu services herd) (guix combinators)))) @@ -84,7 +92,25 @@ generation of the system profile." (test-equal "script created new generation" (length (system-generations marionette)) - (1+ (length generations-prior)))) + (1+ (length generations-prior))) + + (test-assert "script activated the new generation" + (and (eqv? 'symlink + (marionette-eval + '(stat:type (lstat "/run/current-system")) + marionette)) + (string= #$os + (marionette-eval + '(readlink "/run/current-system") + marionette)))) + + (test-assert "script activated user accounts" + (marionette-eval + '(string-contains (call-with-input-file "/etc/passwd" + (lambda (port) + (get-string-all port))) + "jakob") + marionette))) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0)))))