aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2017-02-22 16:56:14 -0500
committerNoam Postavsky2017-02-25 12:56:09 -0500
commit546d30ed1400d5a434886790a102bd37ec852919 (patch)
tree64f7969ff55228c28183b56d98108319fe504965
parent9e9d381ff0c83283278f43a65d3ecefd0cde8041 (diff)
downloademacs-546d30ed1400d5a434886790a102bd37ec852919.tar.gz
emacs-546d30ed1400d5a434886790a102bd37ec852919.zip
Don't use IP 0.0.0.0 for package test server (Bug#22582)
* test/lisp/emacs-lisp/package-resources/package-test-server.py: Set 'server_address' when port number is given on the command line. Print IP and port number as a URL, and flush it after printing. * test/lisp/emacs-lisp/package-tests.el: (package-test-update-archives-async): Grab the whole URL from server output.
-rw-r--r--test/lisp/emacs-lisp/package-resources/package-test-server.py10
-rw-r--r--test/lisp/emacs-lisp/package-tests.el15
2 files changed, 13 insertions, 12 deletions
diff --git a/test/lisp/emacs-lisp/package-resources/package-test-server.py b/test/lisp/emacs-lisp/package-resources/package-test-server.py
index 1acd9f744b9..128b4249ec3 100644
--- a/test/lisp/emacs-lisp/package-resources/package-test-server.py
+++ b/test/lisp/emacs-lisp/package-resources/package-test-server.py
@@ -11,11 +11,15 @@ if sys.argv[1:]:
11 port = int(sys.argv[1]) 11 port = int(sys.argv[1])
12else: 12else:
13 port = 0 13 port = 0
14 server_address = ('127.0.0.1', port) 14server_address = ('127.0.0.1', port)
15 15
16HandlerClass.protocol_version = Protocol 16HandlerClass.protocol_version = Protocol
17httpd = ServerClass(server_address, HandlerClass) 17httpd = ServerClass(server_address, HandlerClass)
18 18
19sa = httpd.socket.getsockname() 19ip, port = httpd.socket.getsockname()[0:2]
20print "Serving HTTP on", sa[0], "port", sa[1], "..." 20print ("Server started, http://%s:%s/" % (ip, port))
21# Flush in case we're in full buffering mode (instead of line
22# buffering), this might happen if python is a cygwin program and we
23# run it from a native w32 program.
24sys.stdout.flush()
21httpd.serve_forever() 25httpd.serve_forever()
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index 2e4666e7fe3..5172b482cb0 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -376,22 +376,19 @@ Must called from within a `tar-mode' buffer."
376 "package-server" "package-server-buffer" 376 "package-server" "package-server-buffer"
377 (executable-find "python2") 377 (executable-find "python2")
378 "package-test-server.py")) 378 "package-test-server.py"))
379 port) 379 (addr nil))
380 (unwind-protect 380 (unwind-protect
381 (progn 381 (progn
382 (with-current-buffer "package-server-buffer" 382 (with-current-buffer "package-server-buffer"
383 (should 383 (should
384 (with-timeout (10 nil) 384 (with-timeout (10 nil)
385 (while (not port) 385 (while (not addr)
386 (accept-process-output nil 1) 386 (accept-process-output nil 1)
387 (goto-char (point-min)) 387 (goto-char (point-min))
388 (if (re-search-forward "Serving HTTP on .* port \\([0-9]+\\) " 388 (when (re-search-forward "Server started, \\(.*\\)\n" nil t)
389 nil t) 389 (setq addr (match-string 1))))
390 (setq port (match-string 1)))) 390 addr)))
391 port))) 391 (with-package-test (:basedir package-test-data-dir :location addr)
392 (with-package-test (:basedir
393 package-test-data-dir
394 :location (format "http://0.0.0.0:%s/" port))
395 (list-packages) 392 (list-packages)
396 (should package--downloads-in-progress) 393 (should package--downloads-in-progress)
397 (should mode-line-process) 394 (should mode-line-process)