aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-01 10:01:05 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-01 13:50:26 +0200
commit7a4e2eaab34f7fad6951f312203ac0d9dfa3d44a (patch)
treee2e4fee0dbdb7f1e9da9533e656d87c9caba72a7 /gnu/tests
parent5ede50b850df9d0a7bd6f5e27def1d783c0f08a4 (diff)
downloadguix-7a4e2eaab34f7fad6951f312203ac0d9dfa3d44a.tar
guix-7a4e2eaab34f7fad6951f312203ac0d9dfa3d44a.tar.gz
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.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/dict.scm19
1 files changed, 2 insertions, 17 deletions
diff --git a/gnu/tests/dict.scm b/gnu/tests/dict.scm
index b9c741e3e0..4431e37dc1 100644
--- a/gnu/tests/dict.scm
+++ b/gnu/tests/dict.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -96,22 +96,7 @@
;; Wait until dicod is actually listening.
;; TODO: Use a PID file instead.
(test-assert "connect inside"
- (marionette-eval
- '(begin
- (use-modules (ice-9 rdelim))
- (let ((sock (socket PF_INET SOCK_STREAM 0)))
- (let loop ((i 0))
- (pk 'try i)
- (catch 'system-error
- (lambda ()
- (connect sock AF_INET INADDR_LOOPBACK 2628))
- (lambda args
- (pk 'connection-error args)
- (when (< i 20)
- (sleep 1)
- (loop (+ 1 i))))))
- (read-line sock 'concat)))
- marionette))
+ (wait-for-tcp-port 2628 marionette))
(test-assert "connect"
(let ((addr (make-socket-address AF_INET INADDR_LOOPBACK 8000)))