Commit graph

36 commits

Author SHA1 Message Date
Ludovic Courtès
5f34796dc4
marionette: Add #:peek? to ‘wait-for-tcp-port?’.
* gnu/build/marionette.scm (wait-for-tcp-port): Add #:peek? parameter
and honor it.

Change-Id: Ie7515a5223299390ab8af6fe5aa3cf63ba5c8078
2024-02-10 22:59:56 +01:00
Bruno Victal
6a86e2d13a
marionette: Allow passing custom OCR arguments.
* gnu/build/marionette.scm (%default-ocrad-arguments): New variable.
(invoke-ocrad-ocr, invoke-tesseract-ocr, marionette-screen-text)
[ocr-arguments]: New argument.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-07-19 10:38:15 -04:00
Ludovic Courtès
00b9ab0a83
tests: root-unmount: Wait for the first QEMU process to finish.
There was a tiny possibility that the first QEMU process would still be
running by the time we launch the second one.

* gnu/build/marionette.scm (marionette-pid): Export.
* gnu/tests/base.scm (run-root-unmount-test)[test]: Add 'waitpid' call.
2022-11-17 11:10:09 +01:00
Maxim Cournoyer
133901a396
marionette: Add a callback arguments to wait-for-screen-text.
* gnu/build/marionette.scm (wait-for-screen-text): New 'pre-action' and
'post-action' arguments.  Update doc.  Call the procedures before and after
the OCR occurs, respectively.
2022-10-07 10:11:12 -04:00
Maxim Cournoyer
f24e0fc233
marionette: Define keystrokes for typing colons and exclamation marks.
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Register keystrokes for
the ':' and '!' characters.
2022-10-07 10:11:12 -04:00
Maxim Cournoyer
4cce84b247
marionette: Preserve screen dumps on failures.
This is to make it easier to debug test failures involving
'wait-for-screen-text': the screendump image used for the OCR is now preserved
for inspection when 'wait-for-screen-text' fails.

* gnu/build/marionette.scm (marionette-screen-text): Return the screendump
image file as the second value.  Adjust doc.
(wait-for-screen-text): Add the preserved screendump image file name to the
error message.  Adjust doc.
2022-10-07 10:11:12 -04:00
Maxim Cournoyer
21f641e9fa
marionette: Make marionette-screen-text private.
It has only one user, which is better suited for wait-for-screen-text anyway.

* gnu/tests/base.scm (run-basic-test): Refactor to use wait-for-screen-text
instead of marionette-screen-text.
2022-10-07 10:11:11 -04:00
Christopher Baines
ad5584bf25
marionette: Avoid read error when wait-for-file file is empty.
Since #<eof> can't be read.

* gnu/build/marionette.scm (wait-for-file): Return "" if file is empty.

Partially-Fixes: https://issues.guix.gnu.org/57827
2022-09-16 11:59:42 +02:00
Christopher Baines
0f46d4f147
marionette: Make it easier to debug REPL read failures.
Log the remaining contnet written to the REPL, so that there's more to go on
than:

  socket:5:14: Unknown # object: "#<"

* gnu/build/marionette.scm (marionette-eval): Catch exceptions from read and
log the remainder of the content from the REPL.
2022-09-16 11:59:39 +02:00
Maxim Cournoyer
42fee6d0f1
build: marionette: Add support for Tesseract OCR.
* gnu/build/marionette.scm (invoke-ocrad-ocr): New procedure.
(invoke-tesseract-ocr): Likewise.
(marionette-screen-text): Rename the #:ocrad argument to #:ocr.  Dispatch the
matching OCR invocation procedure.
(wait-for-screen-text): Rename the #:ocrad argument to #:ocr.
* gnu/tests/base.scm (run-basic-test): Adjust accordingly.
* gnu/tests/install.scm (enter-luks-passphrase): Likewise.
(enter-luks-passphrase-for-home): Likewise.
2022-08-28 22:10:20 -04:00
Maxim Cournoyer
697b797160
marionette: Improve the error message of 'wait-for-screen-text'.
* gnu/build/marionette.scm (wait-for-screen-text): Return the last OCR'd text
when the predicate fails to match instead of the not useful predicate object.
2022-08-28 22:10:20 -04:00
Maxim Cournoyer
ce53253d1f
build: marionette: Adjust QEMU Info manual reference.
* gnu/build/marionette.scm (marionette-control): Update doc to correct the
QEMU Info manual reference.
2022-08-11 11:52:51 -04:00
Timotej Lazar
fd74fe6325
tests: Add qemu-guest-agent system test.
Enable the QEMU guest agent interface in marionette VMs, run the
qemu-guest-agent service in one and try talking to it.

* gnu/build/marionette.scm (make-marionette): Enable the guest agent device.
* gnu/tests/virtualization.scm (run-qemu-guest-agent-test): New procedure.
(%test-qemu-guest-agent): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-08-09 17:15:45 +02:00
Ludovic Courtès
52aceda4fd
marionette: Add #:address parameter to 'wait-for-tcp-port'.
* gnu/build/marionette.scm (wait-for-tcp-port): Add #:address parameter.
Honor it, and improve error reporting in the 'failure case.
2022-05-22 21:56:40 +02:00
Mathieu Othacehe
05a9d1f378
Remove VM generation dead-code.
This code duplicates the (gnu system image) and (gnu build image) code. Using
VM for image generation is not needed, not portable and really slow. Remove
all the VM image generation code to make sure that only the image API is used.

* gnu/build/vm.scm: Remove it. Move the qemu-command procedure to ...
* gnu/build/marionette.scm: ... here.
* gnu/local.mk (GNU_SYSTEM_MODULES): Adapt it.
* tests/modules.scm: Ditto.
* gnu/tests/install.scm: Ditto.
* gnu/system/vm.scm: Adapt it and remove expression->derivation-in-linux-vm,
qemu-img, system-qemu-image/shared-store and system-docker-image procedures.
* doc/guix.texi (G-Expressions): Adapt it.
2021-12-23 10:54:00 +01:00
Ludovic Courtès
9980ac0f99
marionette: Print a line when a test succeeds.
* gnu/build/marionette.scm (system-test-runner): Add call to
'test-runner-on-test-end!'.
2021-09-26 23:35:58 +02:00
Ludovic Courtès
7d72829448
marionette: 'system-test-runner' can create output directory.
* gnu/build/marionette.scm (system-test-runner): Take optional
'log-directory' parameter.  Add 'test-begin' handler and honor
LOG-DIRECTORY.
2021-09-26 23:10:29 +02:00
Ludovic Courtès
9b9bfc7ac2
marionette: 'system-test-runner' dumps test log upon failure.
* gnu/build/marionette.scm (system-test-runner): In 'test-end' handler,
when SUCCESS? is false, dump log content to the current error port.
2021-09-26 23:09:23 +02:00
Ludovic Courtès
1fb75128a5
tests: Adjust to SRFI-64 as found in Guile 3.0.7.
In Guile 3.0.7, 'test-runner-current' is set to #f upon 'test-end'.
Consequently, the previous strategy, where we'd call
'test-runner-current' after 'test-end', no longer works.  Instead, set
the test runner in each test right before 'test-begin'.

* gnu/build/marionette.scm (system-test-runner): New procedure.
* gnu/tests/audio.scm (run-mpd-test): Replace (exit (= ...)) idiom
by (test-runner-current (system-test-runner)).
* gnu/tests/base.scm (run-basic-test)
(run-cleanup-test, run-mcron-test, run-nss-mdns-test): Likewise.
* gnu/tests/ci.scm (run-laminar-test): Likewise.
* gnu/tests/cups.scm (run-cups-test): Likewise.
* gnu/tests/databases.scm (run-memcached-test)
(run-postgresql-test, run-mysql-test): Likewise.
* gnu/tests/desktop.scm (run-elogind-test): Likewise.
* gnu/tests/dict.scm (run-dicod-test): Likewise.
* gnu/tests/docker.scm (run-docker-test): Likewise.
(run-docker-system-test): Likewise.
* gnu/tests/file-sharing.scm (run-transmission-daemon-test): Likewise.
* gnu/tests/ganeti.scm (run-ganeti-test): Likewise.
* gnu/tests/guix.scm (run-guix-build-coordinator-test): Likewise.
(run-guix-data-service-test): Likewise.
* gnu/tests/ldap.scm (run-ldap-test): Likewise.
* gnu/tests/linux-modules.scm (run-loadable-kernel-modules-test-base): Likewise.
* gnu/tests/mail.scm (run-opensmtpd-test)
(run-exim-test, run-dovecot-test, run-getmail-test): Likewise.
* gnu/tests/messaging.scm (run-xmpp-test)
(run-bitlbee-test, run-quassel-test): Likewise.
* gnu/tests/monitoring.scm (run-prometheus-node-exporter-server-test)
(run-zabbix-server-test): Likewise.
* gnu/tests/networking.scm (run-inetd-test, run-openvswitch-test)
(run-dhcpd-test, run-tor-test, run-iptables-test, run-ipfs-test): Likewise.
* gnu/tests/nfs.scm (run-nfs-test)
(run-nfs-server-test, run-nfs-root-fs-test): Likewise.
* gnu/tests/package-management.scm (run-nix-test): Likewise.
* gnu/tests/reconfigure.scm (run-switch-to-system-test)
(run-upgrade-services-test, run-install-bootloader-test): Likewise.
* gnu/tests/rsync.scm (run-rsync-test): Likewise.
* gnu/tests/security-token.scm (run-pcscd-test): Likewise.
* gnu/tests/singularity.scm (run-singularity-test): Likewise.
* gnu/tests/ssh.scm (run-ssh-test): Likewise.
* gnu/tests/telephony.scm (run-jami-test): Likewise.
* gnu/tests/version-control.scm (run-cgit-test): Likewise.
(run-git-http-test, run-gitolite-test, run-gitile-test): Likewise.
* gnu/tests/virtualization.scm (run-libvirt-test, run-childhurd-test): Likewise.
* gnu/tests/web.scm (run-webserver-test, run-php-fpm-test)
(run-hpcguix-web-server-test, run-tailon-test, run-patchwork-test): Likewise.
2021-09-25 18:52:05 +02:00
Ludovic Courtès
b6ec284fe8
marionette: Provide portable US-layout keystrokes for "<" and ">".
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Use shit-comma and
shift-dot for #\< and #\> because the "less" key doesn't work the same
in "US intl." layouts.
2020-02-22 00:45:42 +01:00
Ludovic Courtès
1708ed6e9d
marionette: 'wait-for' procedures no longer leak a port.
* gnu/build/marionette.scm (wait-for-tcp-port): Close SOCK upon
success.
(wait-for-unix-socket): Likewise.
2020-02-22 00:45:42 +01:00
Ludovic Courtès
604b167bf2
marionette: Add braces to the keystrokes.
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Add braces.
2019-05-15 12:18:51 +02:00
Chris Marusich
cb29343940
marionette: Add wait-for-unix-socket.
* gnu/build/marionette.scm (wait-for-unix-socket): New variable.
2018-08-28 00:19:58 -07:00
Chris Marusich
4dd53a83b5
marionette: Add support for QEMU's "quit" command.
* gnu/build/marionette.scm (marionette-control): Don't wait for the
monitor prompt when the command was "quit".
2018-08-28 00:14:25 -07:00
Ludovic Courtès
7a4e2eaab3
marionette: Add 'wait-for-tcp-port'.
* gnu/build/marionette.scm (wait-for-tcp-port): New procedure.
* gnu/tests/dict.scm (run-dicod-test)["connect inside"]: Use it instead
of the inline loop.
2018-06-01 13:50:26 +02:00
Ludovic Courtès
27a2c9c3e0
marionette: Use QEMU's "VM channel" mechanism.
* gnu/tests.scm (<marionette-configuration>)[device]: Default to
"/dev/virtio-ports/org.gnu.guix.port.0".
* gnu/tests.scm (marionette-shepherd-service): Remove (guix build
syscalls) from 'modules'.  Remove 'tcsetattr' call from 'start'.
* gnu/build/marionette.scm (make-marionette): Use "-virtserialport"
instead of "-virtconsole".
2018-02-19 22:04:11 +01:00
Ludovic Courtès
13877c3453
marionette: 'wait-for-file' can be passed a read procedure.
* gnu/build/marionette.scm (wait-for-file): Add #:read parameter and
honor it.
* gnu/tests/base.scm (run-basic-test)["login on tty1"]: Use
'wait-for-file' instead of inline code.
2017-09-08 00:11:21 +02:00
Ludovic Courtès
06b8eae3d1
marionette: Augment the set of keystrokes.
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Add ', ", and `.
2017-08-28 09:56:33 +02:00
Ludovic Courtès
0a80981178
marionette: Fix typing of capital letters.
Previously we'd use "sendkey P" instead of "sendkey shift-p", which had
no effect.

* gnu/build/marionette.scm (character->keystroke): New procedure.
(string->keystroke-commands): Use it.
2017-08-28 09:56:33 +02:00
Ludovic Courtès
8bd5231485
marionette: 'wait-for-file' really raises an error when a file is missing.
* gnu/build/marionette.scm (wait-for-file): Arrange to call 'error' on
the host, not in the guest.
2017-08-28 09:56:33 +02:00
Ludovic Courtès
5fa7cc5335
marionette: Factorize 'wait-for-file'.
* gnu/build/marionette.scm (wait-for-file): New procedure.
* gnu/tests/base.scm (run-mcron-test)[test](wait-for-file): Remove.
Pass second argument in 'wait-for-file' calls.
* gnu/tests/ssh.scm (run-ssh-test)[test](wait-for-file): Remove.
Pass second argument in 'wait-for-file' calls.
* gnu/tests/messaging.scm (run-xmpp-test)[test](guest-wait-for-file):
Remove.
Use 'wait-for-file' instead, with second argument.
2017-06-12 23:34:14 +02:00
Ludovic Courtès
f7f292d359
install: Enable "cryptodisk" handling in GRUB.
This allows 'grub-install' to do the right thing when / or /boot is a
LUKS-encrypted partition.

Fixes <http://bugs.gnu.org/21843>.

* gnu/build/install.scm (install-grub): Add 'setenv' to set
'GRUB_ENABLE_CRYPTODISK'.
(wait-for-screen-text): New test.
* gnu/tests/base.scm (run-basic-test): Add #:initialization parameter
and honor it.
* gnu/tests/install.scm (%encrypted-root-os)[kernel-arguments]: Remove.
(%encrypted-root-installation-script): Pass '--uuid' to 'cryptsetup
luksFormat'.  Remove 'sed' invocation.
(enter-luks-passphrase): New procedure.
(%test-encrypted-os)[value]: Pass #:initialization to 'run-basic-test'.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
fe93383350
marionette: Add 'marionette-screen-text' using OCR.
* gnu/build/marionette.scm (marionette-screen-text): New procedure.
* gnu/tests/base.scm (run-basic-test)["screen text"]: New test.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
f25c9ebc80
marionette: Delay synchronization with the host's REPL.
* gnu/build/marionette.scm (<marionette>)[marionette-repl]: Rename to...
[%marionette-repl]: ... this.
(marionette-repl): New macro.
(make-marionette): Wrap last 'read' call into 'delay', making the last
argument to 'marionette' a promise of a port.
(marionette-eval): Use 'force' in 'match' clause.
2016-11-23 21:13:18 +01:00
Ludovic Courtès
ad17470551
marionette: Avoid use of SIGALRM for timeouts.
* gnu/build/marionette.scm (make-marionette)[accept*]: New procedures.
Remove calls to 'sigaction'.  Use 'accept*' instead of 'accept'.
2016-11-22 23:45:08 +01:00
Ludovic Courtès
957afcae3c
Add (gnu tests) and (gnu build marionette).
* gnu/build/marionette.scm, gnu/tests.scm: New files.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.
* gnu/system/vm.scm (common-qemu-options): Remove '-serial stdio'.
2016-05-04 23:35:55 +02:00