Hello! Here’s a test for the graphical installer, as discussed earlier at: https://lists.gnu.org/archive/html/guix-devel/2020-01/msg00407.html The first part of this patch series implements client support in theinstaller as discussed above (only more robust to multiple clients,disconnections, etc.). A dirty bit there is the‘close-port-and-reuse-fd’ hack, which works around the fact that Newtdoes not provide a ‘form-unwatch-fd’ procedure. Good enough for now!There are also two hacks to (1) skip connectivity checks and (2) topass ‘--no-grafts’ to ‘guix system init’. The second part implements the actual test. The new (gnu installertests) module provides tools to implement a dialogue with the installer,and the new “gui-installed-os” test uses it to perform a bare-bonesstyle installation. There’s a commented out variant that does it onan encrypted root, but it currently fails presumably due tohttps://issues.guix.gnu.org/issue/39712. That’s it! Feedback welcome! Ludo’. PS: This patch series is also available as ‘wip-installer-test’. Ludovic Courtès (7): tests: 'run-basic-test' can enter a root password. installer: Use a Guile-Newt snapshot that supports 'form-watch-fd'. installer: Implement a dialog on /var/guix/installer-socket. installer: Bypass connectivity check when /tmp/installer-assume-online exists. installer: Run commands without hopping through the shell. installer: Honor /tmp/installer-system-init-options. tests: install: Add "gui-installed-os". gnu/installer.scm | 21 ++ gnu/installer/final.scm | 21 +- gnu/installer/newt/final.scm | 40 ++- gnu/installer/newt/network.scm | 10 +- gnu/installer/newt/page.scm | 569 ++++++++++++++++++++----------- gnu/installer/newt/partition.scm | 8 +- gnu/installer/newt/user.scm | 64 ++-- gnu/installer/newt/welcome.scm | 44 ++- gnu/installer/steps.scm | 25 +- gnu/installer/tests.scm | 340 ++++++++++++++++++ gnu/installer/utils.scm | 152 +++++++-- gnu/local.mk | 3 +- gnu/tests/base.scm | 23 +- gnu/tests/install.scm | 200 ++++++++++- 14 files changed, 1212 insertions(+), 308 deletions(-) create mode 100644 gnu/installer/tests.scm -- 2.25.1
This is useful for automated tests. * gnu/installer/newt/network.scm (wait-service-online)[online?]: Newprocedure. Check for /tmp/installer-assume-online.Use it instead of 'connman-online?'.--- gnu/installer/newt/network.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
This will allow us to automate testing of the installer. * gnu/installer/utils.scm (%client-socket-file)(current-server-socket, current-clients): New variables.(open-server-socket, call-with-server-socket): New procedure.(with-server-socket): New macro.(run-shell-command): Add call to 'send-to-clients'. Select on bothcurrent-input-port and current-clients.* gnu/installer/steps.scm (run-installer-steps): Wrap 'call-with-prompt'in 'with-socket-server'. Call 'sigaction' for SIGPIPE.* gnu/installer/newt/page.scm (watch-clients!, close-port-and-reuse-fd)(run-form-with-clients, send-to-clients): New procedures.(draw-info-page): Add call to 'run-form-with-clients'.(run-input-page): Likewise. Handle EXIT-REASON equal to 'exit-fd-ready.(run-confirmation-page): Likewise.(run-listbox-selection-page): Likewise. Define 'choice->item' and use it.(run-checkbox-tree-page): Likewise.(run-file-textbox-page): Add call to 'run-form-with-clients'. Handle'exit-fd-ready'.* gnu/installer/newt/partition.scm (run-disk-page): Pass #:client-callback-procedure to 'run-listbox-selection-page'.* gnu/installer/newt/user.scm (run-user-page): Call'run-form-with-clients'. Handle 'exit-fd-ready'.* gnu/installer/newt/welcome.scm (run-menu-page): Define'choice->item' and use it. Call 'run-form-with-clients'.* gnu/installer/newt/final.scm (run-install-success-page)(run-install-failed-page): When (current-clients) is non-empty, call'send-to-clients' without displaying a choice window.--- gnu/installer/newt/final.scm | 40 ++- gnu/installer/newt/page.scm | 564 ++++++++++++++++++++----------- gnu/installer/newt/partition.scm | 8 +- gnu/installer/newt/user.scm | 64 ++-- gnu/installer/newt/welcome.scm | 44 ++- gnu/installer/steps.scm | 25 +- gnu/installer/utils.scm | 88 ++++- 7 files changed, 581 insertions(+), 252 deletions(-)
* gnu/installer/utils.scm (run-shell-command): Rename to...(run-command): Remove call to 'call-with-temporary-output-file' and hopthrough Bash. Expect COMMAND to be a list of strings rather than astring.* gnu/installer/final.scm (install-system): Turn INSTALL-COMMAND into alist of strings and pass it to 'run-command'.* gnu/installer/newt/page.scm (edit-file): Likewise.--- gnu/installer/final.scm | 11 +++---- gnu/installer/newt/page.scm | 5 ++- gnu/installer/utils.scm | 64 ++++++++++++++++++------------------- 3 files changed, 39 insertions(+), 41 deletions(-)
Toggle diff (29 lines)diff --git a/gnu/installer/final.scm b/gnu/installer/final.scmindex 7193ecb8a4..869be8814b 100644--- a/gnu/installer/final.scm+++ b/gnu/installer/final.scm@@ -111,9 +111,19 @@ cow-store service." Start COW-STORE service on target directory and launch guix install command in a subshell. LOCALE must be the locale name under which that command will run, or #f. Return #t on success and #f on failure."- (let ((install-command (list "guix" "system" "init" "--fallback"- (%installer-configuration-file)- (%installer-target-dir))))+ (let* ((options (catch 'system-error+ (lambda ()+ ;; If this file exists, it can provide+ ;; additional command-line options.+ (call-with-input-file+ "/tmp/installer-system-init-options"+ read))+ (const '())))+ (install-command (append (list "guix" "system" "init"+ "--fallback")+ options+ (list (%installer-configuration-file)+ (%installer-target-dir))))) (mkdir-p (%installer-target-dir)) ;; We want to initialize user passwords but we don't want to store them in-- 2.25.1
Re: [bug#39729] [PATCH 0/7] Testing the graphical installer
(name . Ludovic Courtès)(address . firstname.lastname@example.org)
Toggle quote (11 lines)> The second part implements the actual test. The new (gnu installer> tests) module provides tools to implement a dialogue with the installer,> and the new “gui-installed-os” test uses it to perform a bare-bones> style installation. There’s a commented out variant that does it on> an encrypted root, but it currently fails presumably due to> <https://issues.guix.gnu.org/issue/39712>.>> That’s it!>> Feedback welcome!
This serie LGTM, this is really impressive :) About the umounting issue,you were right. Umounting failed for both %test-gui-installed-os and%test-gui-installed-os-encrypted. The issue was that guix-daemon was keeping open files inside thecow-store, preventing the umount. I discovered then a second issue, someudevd workers, started while the cow-store was active were alsopreventing the umounting. I published a few patches on top of yours on wip-installer-test to fixthose issues. Thanks, Mathieu PS: I had a hard time debugging the marionette, couldn't find better toadd some syslog, wait an hour to test & repeat. Do you have a betterapproach? Would it be possible to have a debug ssh in the marionette?
Hi Mathieu! Mathieu Othacehe <email@example.com> skribis:
Toggle quote (23 lines)>> The second part implements the actual test. The new (gnu installer>> tests) module provides tools to implement a dialogue with the installer,>> and the new “gui-installed-os” test uses it to perform a bare-bones>> style installation. There’s a commented out variant that does it on>> an encrypted root, but it currently fails presumably due to>> <https://issues.guix.gnu.org/issue/39712>.>>>> That’s it!>>>> Feedback welcome!>> This serie LGTM, this is really impressive :) About the umounting issue,> you were right. Umounting failed for both %test-gui-installed-os and> %test-gui-installed-os-encrypted.>> The issue was that guix-daemon was keeping open files inside the> cow-store, preventing the umount. I discovered then a second issue, some> udevd workers, started while the cow-store was active were also> preventing the umounting.>> I published a few patches on top of yours on wip-installer-test to fix> those issues.
Well done, woohoo! I’ve pushed the whole series on ‘master’, including your bug fixes. We can think about writing installer tests for other configurationsnow. That should be the easy part. :-)
Toggle quote (4 lines)> PS: I had a hard time debugging the marionette, couldn't find better to> add some syslog, wait an hour to test & repeat. Do you have a better> approach? Would it be possible to have a debug ssh in the marionette?
I don’t really have a better approach. If you want to see the output of‘guix system init’, you can redirect its stderr to /dev/console (wrapthe ‘invoke’ call in ‘with-error-to-file’), and then you get a betteridea of what’s going on. But that’s about it. SSH wouldn’t be very helpful because the test process is non-interactive. Thanks! Ludo’.