From 4df02ab675b262bc2d43f83ad33785eb434ea6cb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 10:33:29 +0100 Subject: tests: rsync: Set PATH. This is a followup to 8b9cad01e9619f53dc5a65892ca6a09ca5de3447, which would leave PATH unset. * gnu/tests/rsync.scm (run-rsync-test)[test]("service running"): Add call to 'setenv' for PATH. --- gnu/tests/rsync.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu/tests') diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm index 096580022f..24e60d9d9d 100644 --- a/gnu/tests/rsync.scm +++ b/gnu/tests/rsync.scm @@ -64,6 +64,10 @@ PORT." (marionette-eval '(begin (use-modules (gnu services herd)) + + ;; Make sure the 'rsync' command is found. + (setenv "PATH" "/run/current-system/profile/bin") + (start-service 'rsync)) marionette)) -- cgit v1.2.3 From ef0f5ff2a74e5e4dc49dfdd0ba6509a91281ddd5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 11:17:15 +0100 Subject: tests: dhcpd: Adjust network interface name. This is a followup to 8e53fe2b91d2776bc1529e7b34967c8f1d9edc32. * gnu/tests/networking.scm (dhcpd-v4-configuration) (%dhcpd-os): Use "ens3" instead of "eth0". --- gnu/tests/networking.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index d1234442bb..e90b247883 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -270,11 +270,11 @@ subnet 192.168.1.0 netmask 255.255.255.0 { (dhcpd-configuration (config-file minimal-dhcpd-v4-config-file) (version "4") - (interfaces '("eth0")))) + (interfaces '("ens3")))) (define %dhcpd-os (simple-operating-system - (static-networking-service "eth0" "192.168.1.4" + (static-networking-service "ens3" "192.168.1.4" #:netmask "255.255.255.0" #:gateway "192.168.1.1" #:name-servers '("192.168.1.2" "192.168.1.3")) -- cgit v1.2.3 From c215d9ec1ce108844b14c0c2952199a0da5f4176 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 12:18:59 +0100 Subject: tests: opensmtpd: Gracefully handle test failure. Previously the 'wait' loop would run for ~1024 seconds, at which point we'd reach the file descriptor limit due to the leak in 'queue-empty?'. * gnu/tests/mail.scm (run-opensmtpd-test)[test]("mail arrived"): In 'queue-empty?', close PIPE to avoid file descriptor leak. In 'wait' loop, arrange to run at most 20 times. --- gnu/tests/mail.scm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 298918b3a7..58172cd1d6 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -140,16 +140,21 @@ match from any for local action inbound (ice-9 rdelim)) (define (queue-empty?) - (eof-object? - (read-line - (open-input-pipe - (string-append #$(file-append opensmtpd "/sbin/smtpctl") - " show queue"))))) - - (let wait () - (if (queue-empty?) - (file-exists? "/var/mail/root") - (begin (sleep 1) (wait))))) + (let* ((pipe (open-pipe* OPEN_READ + #$(file-append opensmtpd + "/sbin/smtpctl") + "show" "queue")) + (line (read-line pipe))) + (close-pipe pipe) + (eof-object? line))) + + (let wait ((n 20)) + (cond ((queue-empty?) + (file-exists? "/var/mail/root")) + ((zero? n) + (error "root mailbox didn't show up")) + (else + (sleep 1) (wait (- n 1)))))) marionette)) (test-end) -- cgit v1.2.3 From a37e03d60e18dfcf119d0b92d9008e54fc350bf1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 12:21:05 +0100 Subject: tests: opensmtpd: Check /var/spool/mail instead of /var/mail. The test had been failing since the upgrade to 6.6.3p1 in commit 2dbfd8eec43b602d23cee3fdd2842cc333e36c24. * gnu/services/mail.scm (opensmtpd-activation): Create /var/spool/mail. * gnu/tests/mail.scm (run-opensmtpd-test): Check /var/spool/mail instead of /var/mail. --- gnu/services/mail.scm | 4 +++- gnu/tests/mail.scm | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index d97316512f..7791780dfc 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1670,7 +1670,9 @@ match from local for any action outbound ;; Create mbox and spool directories. (mkdir-p "/var/mail") (mkdir-p "/var/spool/smtpd") - (chmod "/var/spool/smtpd" #o711)))))) + (chmod "/var/spool/smtpd" #o711) + (mkdir-p "/var/spool/mail") + (chmod "/var/spool/mail" #o711)))))) (define %opensmtpd-pam-services (list (unix-pam-service "smtpd"))) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 58172cd1d6..a50fb1dbca 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -99,8 +99,8 @@ match from any for local action inbound (test-assert "mbox is empty" (marionette-eval - '(and (file-exists? "/var/mail") - (not (file-exists? "/var/mail/root"))) + '(and (file-exists? "/var/spool/mail") + (not (file-exists? "/var/spool/mail/root"))) marionette)) (test-eq "accept an email" @@ -150,7 +150,7 @@ match from any for local action inbound (let wait ((n 20)) (cond ((queue-empty?) - (file-exists? "/var/mail/root")) + (file-exists? "/var/spool/mail/root")) ((zero? n) (error "root mailbox didn't show up")) (else -- cgit v1.2.3 From e8cec7cc120fc95b2e869a1834a01e257e0f63c8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 12:34:13 +0100 Subject: tests: nfs: Ensure 'rpcinfo' can be found. The test was failing since 8b9cad01e9619f53dc5a65892ca6a09ca5de3447. * gnu/tests/nfs.scm (run-nfs-test)[test]("RPC service running"): Add 'setenv' call for PATH. --- gnu/tests/nfs.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gnu/tests') diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm index 014d049ab5..635c4a7322 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017 Ludovic Courtès +;;; Copyright © 2016, 2017, 2020 Ludovic Courtès ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice @@ -101,6 +101,10 @@ (marionette-eval '(begin (use-modules (gnu services herd)) + + ;; Ensure 'rpcinfo' can be found below. + (setenv "PATH" "/run/current-system/profile/bin") + (start-service 'rpcbind-daemon)) marionette)) -- cgit v1.2.3 From a55472955d7dbe7385fb25a5c31b26f8ebfa6e93 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 17:39:08 +0100 Subject: tests: nfs-server: Use marionette helper procedures. * gnu/tests/nfs.scm (run-nfs-server-test)[test](wait-for-file): Remove. ("nscd is listening on its socket"): Use 'wait-for-unix-socket'. --- gnu/tests/nfs.scm | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm index 635c4a7322..00109b752e 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -196,18 +196,6 @@ (define marionette (make-marionette (list #$(virtual-machine os)))) - (define (wait-for-file file) - ;; Wait until FILE exists in the guest - (marionette-eval - `(let loop ((i 10)) - (cond ((file-exists? ,file) - #t) - ((> i 0) - (sleep 1) - (loop (- i 1))) - (else - (error "File didn't show up: " ,file)))) - marionette)) (mkdir #$output) (chdir #$output) @@ -231,22 +219,8 @@ marionette)) (test-assert "nscd is listening on its socket" - (marionette-eval - ;; XXX: Work around a race condition in nscd: nscd creates its - ;; PID file before it is listening on its socket. - '(let ((sock (socket PF_UNIX SOCK_STREAM 0))) - (let try () - (catch 'system-error - (lambda () - (connect sock AF_UNIX "/var/run/nscd/socket") - (close-port sock) - (format #t "nscd is ready~%") - #t) - (lambda args - (format #t "waiting for nscd...~%") - (usleep 500000) - (try))))) - marionette)) + (wait-for-unix-socket "/var/run/nscd/socket" + marionette)) (test-assert "network is up" (marionette-eval -- cgit v1.2.3