diff options
author | Leo Famulari <leo@famulari.name> | 2017-07-23 03:42:12 -0400 |
---|---|---|
committer | Leo Famulari <leo@famulari.name> | 2017-07-23 03:42:12 -0400 |
commit | 6c1a317e29c45e85e3a0e050612cdefe470b100c (patch) | |
tree | e65dedf933090b1a9f8398655b3b20eba49fae96 /gnu/tests/networking.scm | |
parent | b7158b767b7fd9f0379dfe08083c48a0cf0f3d50 (diff) | |
parent | 9478c05955643f8ff95dabccc1e42b20abb88049 (diff) | |
download | patches-6c1a317e29c45e85e3a0e050612cdefe470b100c.tar patches-6c1a317e29c45e85e3a0e050612cdefe470b100c.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/tests/networking.scm')
-rw-r--r-- | gnu/tests/networking.scm | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index cfcb490874..aeee105a1c 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -74,60 +74,61 @@ done" )))))))))) (define* (run-inetd-test) "Run tests in %INETD-OS, where the inetd service provides an echo service on port 7, and a dict service on port 2628." - (mlet* %store-monad ((os -> (marionette-operating-system %inetd-os)) - (command (system-qemu-image/shared-store-script - os #:graphic? #f))) - (define test - (with-imported-modules '((gnu build marionette)) - #~(begin - (use-modules (ice-9 rdelim) - (srfi srfi-64) - (gnu build marionette)) - (define marionette - ;; Forward guest ports 7 and 2628 to host ports 8007 and 8628. - (make-marionette (list #$command "-net" - (string-append - "user" - ",hostfwd=tcp::8007-:7" - ",hostfwd=tcp::8628-:2628")))) + (define os + (marionette-operating-system %inetd-os)) - (mkdir #$output) - (chdir #$output) + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((8007 . 7) + (8628 . 2628))))) - (test-begin "inetd") + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (ice-9 rdelim) + (srfi srfi-64) + (gnu build marionette)) + (define marionette + (make-marionette (list #$vm))) - ;; Make sure the PID file is created. - (test-assert "PID file" - (marionette-eval - '(file-exists? "/var/run/inetd.pid") - marionette)) + (mkdir #$output) + (chdir #$output) - ;; Test the echo service. - (test-equal "echo response" - "Hello, Guix!" - (let ((echo (socket PF_INET SOCK_STREAM 0)) - (addr (make-socket-address AF_INET INADDR_LOOPBACK 8007))) - (connect echo addr) - (display "Hello, Guix!\n" echo) - (let ((response (read-line echo))) - (close echo) - response))) + (test-begin "inetd") - ;; Test the dict service - (test-equal "dict response" - "GNU Guix is a package management tool for the GNU system." - (let ((dict (socket PF_INET SOCK_STREAM 0)) - (addr (make-socket-address AF_INET INADDR_LOOPBACK 8628))) - (connect dict addr) - (display "DEFINE Guix\n" dict) - (let ((response (read-line dict))) - (close dict) - response))) + ;; Make sure the PID file is created. + (test-assert "PID file" + (marionette-eval + '(file-exists? "/var/run/inetd.pid") + marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + ;; Test the echo service. + (test-equal "echo response" + "Hello, Guix!" + (let ((echo (socket PF_INET SOCK_STREAM 0)) + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8007))) + (connect echo addr) + (display "Hello, Guix!\n" echo) + (let ((response (read-line echo))) + (close echo) + response))) - (gexp->derivation "inetd-test" test))) + ;; Test the dict service + (test-equal "dict response" + "GNU Guix is a package management tool for the GNU system." + (let ((dict (socket PF_INET SOCK_STREAM 0)) + (addr (make-socket-address AF_INET INADDR_LOOPBACK 8628))) + (connect dict addr) + (display "DEFINE Guix\n" dict) + (let ((response (read-line dict))) + (close dict) + response))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "inetd-test" test)) (define %test-inetd (system-test |