aboutsummaryrefslogtreecommitdiff
path: root/gnu/installer
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/installer')
0 files changed, 0 insertions, 0 deletions
stem-test-location fold-system-tests all-system-tests)) ;;; Commentary: ;;; ;;; This module provides the infrastructure to run operating system tests. ;;; The most important part of that is tools to instrument the OS under test, ;;; essentially allowing it to run in a virtual machine controlled by the host ;;; system--hence the name "marionette". ;;; ;;; Code: (define-record-type* <marionette-configuration> marionette-configuration make-marionette-configuration marionette-configuration? (device marionette-configuration-device ;string (default "/dev/virtio-ports/org.gnu.guix.port.0")) (imported-modules marionette-configuration-imported-modules (default '())) (extensions marionette-configuration-extensions (default '())) ; list of packages (requirements marionette-configuration-requirements ;list of symbols (default '()))) ;; Hack: avoid indenting code beyond column 80 in marionette-shepherd-service. (define-syntax-rule (with-imported-modules-and-extensions imported-modules extensions gexp) (with-imported-modules imported-modules (with-extensions extensions gexp))) (define (marionette-program 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 (with-imported-modules-and-extensions `((guix build utils) (guix build syscalls) ,@imported-modules) extensions #~(begin (use-modules (ice-9 match) (ice-9 binary-ports)) (define (self-quoting? x) (letrec-syntax ((one-of (syntax-rules () ((_) #f) ((_ pred rest ...) (or (pred x) (one-of rest ...)))))) (one-of symbol? string? keyword? pair? null? array? number? boolean? char?))) (let ((repl (open-file #$device "r+0")) (console (open-file "/dev/console" "r+0"))) ;; Redirect output to the console. (close-fdes 1) (close-fdes 2) (dup2 (fileno console) 1) (dup2 (fileno console) 2) (close-port console) (display 'ready repl) (let loop () (newline repl) (match (read repl) ((? eof-object?) (primitive-exit 0)) (expr (catch #t (lambda () (let ((result (primitive-eval expr))) (write (if (self-quoting? result) result (object->string result)) repl))) (lambda (key . args) (print-exception (current-error-port) (stack-ref (make-stack #t) 1) key args) (write #f repl))))) (loop)))))) (program-file "marionette-repl.scm" code)) (define (marionette-shepherd-service config) "Return the Shepherd service for the marionette REPL" (match config (($ <marionette-configuration> device imported-modules extensions requirement) (list (shepherd-service (provision '(marionette)) ;; Always depend on UDEV so that DEVICE is available. (requirement `(udev ,@requirement)) (modules '((ice-9 match) (srfi srfi-9 gnu))) (start #~(make-forkexec-constructor (list #$(marionette-program device imported-modules extensions)))) (stop #~(make-kill-destructor))))))) (define marionette-service-type ;; This is the type of the "marionette" service, allowing a guest system to ;; be manipulated from the host. This marionette REPL is essentially a ;; universal backdoor. (service-type (name 'marionette-repl) (extensions (list (service-extension shepherd-root-service-type marionette-shepherd-service))) (description "The @dfn{marionette} service allows a guest system (virtual machine) to be manipulated by the host. It is used for system tests."))) (define* (marionette-operating-system os #:key (imported-modules '()) (extensions '()) (requirements '())) "Return a marionetteed variant of OS such that OS can be used as a marionette in a virtual machine--i.e., controlled from the host system. The marionette service in the guest is started after the Shepherd services listed in REQUIREMENTS. The packages in the list EXTENSIONS are made available from the backdoor REPL." (operating-system (inherit os) ;; Make sure the guest dies on error. (kernel-arguments (cons "panic=1" (operating-system-user-kernel-arguments os))) ;; Make sure the guest doesn't hang in the REPL on error. (initrd (lambda (fs . rest) (apply (operating-system-initrd os) fs #:on-error 'backtrace rest))) (services (cons (service marionette-service-type (marionette-configuration (requirements requirements) (extensions extensions) (imported-modules imported-modules))) (operating-system-user-services os))))) (define-syntax define-os-with-source (syntax-rules (use-modules operating-system) "Define two variables: OS containing the given operating system, and SOURCE containing the source to define OS as an sexp. This is convenient when we need both the <operating-system> object so we can instantiate it, and the source to create it so we can store in in a file in the system under test." ((_ (os source) (use-modules modules ...) (operating-system fields ...)) (begin (define os (operating-system fields ...)) (define source '(begin (use-modules modules ...) (operating-system fields ...))))))) ;;; ;;; Simple opera2020-10-05bootloader: Fix u-boot installation....This is a follow-up of f19cf27c2b9ff92e2c0fd931ef7fde39c376adaa. The bootloader installation must be done on the final disk-image, hence using "disk-image-installer" instead of "installer" callback. * gnu/bootloader/u-boot.scm: Turn all installer callbacks into disk-image-installer callbacks. * gnu/build/bootloader.scm (write-file-on-device): Open the output file with 'no-truncate and 'no-create options. * gnu/system/image.scm (with-imported-modules*): Add (gnu build bootloader) module. Mathieu Othacehe 2020-09-27gnu: grub: Support for network boot via TFTP....* gnu/bootloader/grub.scm (grub-efi-netboot-bootloader): New variable. (install-grub-efi-netboot): New procedure. (grub-root-search): Update comment. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Stefan 2020-09-14gnu: grub: Support loading files from TFTP if the root filesystem is NFS....* gnu/bootloader/grub.scm (grub-root-search): Set the root to "(tftp)" if the searched-for file is stored on NFS. Stefan 2020-09-07bootloader: Use "define" instead of "define*" for all records....* gnu/bootloader/grub.scm (grub-minimal-bootloader): Use "define". (grub-efi-bootloader): Use "define". (grub-mkrescue-bootloader): Use "define". Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Stefan 2020-09-06bootloader: Add comment about grub configuration files....* gnu/bootloader/grub.scm: Add comment about grub configuration files. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Stefan path %load-path "guix.scm")) "gnu/tests" #:warn warn-about-load-error)) (define (fold-system-tests proc seed) "Invoke PROC on each system test, passing it the test and the previous result." (fold-module-public-variables (lambda (obj result) (if (system-test? obj) (cons obj result) result)) '() (test-modules))) (define (all-system-tests) "Return the list of system tests." (reverse (fold-system-tests cons '()))) ;; Local Variables: ;; eval: (put 'with-imported-modules-and-extensions 'scheme-indent-function 2) ;; End: ;;; tests.scm ends here