;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org> ;;; ;;; 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 <http://www.gnu.org/licenses/>. (define-module (gnu tests reconfigure) #:use-module (gnu bootloader) #:use-module (gnu services shepherd) #: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) #:use-module (guix monads) #:use-module (guix scripts system reconfigure) #:use-module (guix store) #:export (%test-switch-to-system %test-upgrade-services %test-install-bootloader)) ;;; 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 (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)))) (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))) ;; Return the names of the generation symlinks on MARIONETTE. (define (system-generations marionette)