]> code.delx.au - gnu-emacs/blobdiff - test/lisp/net/network-stream-tests.el
Fix failing echo-server-nowait test
[gnu-emacs] / test / lisp / net / network-stream-tests.el
index e19bd528961e6c4cb06de4432f458e24f48113ac..f30c92a1de5b3c18e96232cee6c6dcc84d406f52 100644 (file)
@@ -4,6 +4,8 @@
 
 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
 
+;; This file is part of GNU Emacs.
+
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
@@ -25,6 +27,7 @@
 (require 'gnutls)
 
 (ert-deftest make-local-unix-server ()
+  (skip-unless (featurep 'make-network-process '(:family local)))
   (let* ((file (make-temp-name "/tmp/server-test"))
          (server
           (make-network-process
                                      :buffer (generate-new-buffer "*foo*")
                                      :host "localhost"
                                      :nowait t
+                                     :family 'ipv4
                                      :service port)))
     (should (eq (process-status proc) 'connect))
     (while (eq (process-status proc) 'connect)
 (defun make-tls-server (port)
   (start-process "gnutls" (generate-new-buffer "*tls*")
                  "gnutls-serv" "--http"
-                 "--x509keyfile" "lisp/net/key.pem"
-                 "--x509certfile" "lisp/net/cert.pem"
+                 "--x509keyfile" "data/net/key.pem"
+                 "--x509certfile" "data/net/cert.pem"
                  "--port" (format "%s" port)))
 
 (ert-deftest connect-to-tls-ipv4-wait ()
     (setq status (gnutls-peer-status proc))
     (should (consp status))
     (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
     (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
       (should (stringp issuer))
       (setq issuer (split-string issuer ","))
 (ert-deftest connect-to-tls-ipv6-nowait ()
   (skip-unless (executable-find "gnutls-serv"))
   (skip-unless (gnutls-available-p))
+  (skip-unless (not (eq system-type 'windows-nt)))
+  (skip-unless (featurep 'make-network-process '(:family ipv6)))
   (let ((server (make-tls-server 44333))
         (times 0)
         proc status)