aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/aidc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/aidc.scm')
0 files changed, 0 insertions, 0 deletions
e '((gnu services herd))))) (define vm (virtual-machine (operating-system os) (port-forwardings '((8000 . 2628))) (memory-size 1024))) (define test (with-imported-modules '((gnu build marionette)) #~(begin (use-modules (ice-9 rdelim) (ice-9 regex) (srfi srfi-64) (gnu build marionette)) (define marionette ;; Forward the guest's DICT port to local port 8000. (make-marionette (list #$vm))) (define %dico-socket (socket PF_INET SOCK_STREAM 0)) (test-runner-current (system-test-runner #$output)) (test-begin "dicod") ;; Wait for the service to be started. (test-assert "service is running" (marionette-eval '(begin (use-modules (gnu services herd)) (start-service 'dicod)) marionette)) ;; Wait until dicod is actually listening. ;; TODO: Use a PID file instead. (test-assert "connect inside" (wait-for-tcp-port 2628 marionette)) (test-assert "connect" (let ((addr (make-socket-address AF_INET INADDR_LOOPBACK 8000))) (connect %dico-socket addr) (read-line %dico-socket 'concat))) (test-equal "CLIENT" "250 ok\r\n" (begin (display "CLIENT \"GNU Guile\"\r\n" %dico-socket) (read-line %dico-socket 'concat))) (test-assert "DEFINE" (begin (display "DEFINE ! hello\r\n" %dico-socket) (display "QUIT\r\n" %dico-socket) (let ((result (read-string %dico-socket))) (and (string-contains result "gcide") (string-contains result "hello") result)))) (test-end)))) (gexp->derivation "dicod" test)) (define %test-dicod (system-test (name "dicod") (description "Connect to the dicod DICT server.") (value (run-dicod-test))))