aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2020-12-31 15:00:41 +0100
committerMichael Albinus2020-12-31 15:00:41 +0100
commit87a2cfc085c9e3eae3005a0b8a7af8b4eda01eac (patch)
tree05822f7a07cf18bd8afd10f3259e8cffc5905a9e /test
parent2f8a7bcdc8c4b1ef0a5b46fb773fa7e058a20243 (diff)
downloademacs-87a2cfc085c9e3eae3005a0b8a7af8b4eda01eac.tar.gz
emacs-87a2cfc085c9e3eae3005a0b8a7af8b4eda01eac.zip
* test/src/process-tests.el: Let timeouts fail the tests. Fix some docstrings
Diffstat (limited to 'test')
-rw-r--r--test/src/process-tests.el52
1 files changed, 26 insertions, 26 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 7a83df9eefa..24b09c56e2c 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -50,13 +50,13 @@
50 50
51(ert-deftest process-test-sentinel-accept-process-output () 51(ert-deftest process-test-sentinel-accept-process-output ()
52 (skip-unless (executable-find "bash")) 52 (skip-unless (executable-find "bash"))
53 (with-timeout (60) 53 (with-timeout (60 (ert-fail "Test timed out"))
54 (should (process-test-sentinel-wait-function-working-p 54 (should (process-test-sentinel-wait-function-working-p
55 #'accept-process-output)))) 55 #'accept-process-output))))
56 56
57(ert-deftest process-test-sentinel-sit-for () 57(ert-deftest process-test-sentinel-sit-for ()
58 (skip-unless (executable-find "bash")) 58 (skip-unless (executable-find "bash"))
59 (with-timeout (60) 59 (with-timeout (60 (ert-fail "Test timed out"))
60 (should 60 (should
61 (process-test-sentinel-wait-function-working-p (lambda () (sit-for 0.01 t)))))) 61 (process-test-sentinel-wait-function-working-p (lambda () (sit-for 0.01 t))))))
62 62
@@ -84,7 +84,7 @@
84 84
85(ert-deftest process-test-stderr-buffer () 85(ert-deftest process-test-stderr-buffer ()
86 (skip-unless (executable-find "bash")) 86 (skip-unless (executable-find "bash"))
87 (with-timeout (60) 87 (with-timeout (60 (ert-fail "Test timed out"))
88 (let* ((stdout-buffer (generate-new-buffer "*stdout*")) 88 (let* ((stdout-buffer (generate-new-buffer "*stdout*"))
89 (stderr-buffer (generate-new-buffer "*stderr*")) 89 (stderr-buffer (generate-new-buffer "*stderr*"))
90 (proc (make-process :name "test" 90 (proc (make-process :name "test"
@@ -113,7 +113,7 @@
113 113
114(ert-deftest process-test-stderr-filter () 114(ert-deftest process-test-stderr-filter ()
115 (skip-unless (executable-find "bash")) 115 (skip-unless (executable-find "bash"))
116 (with-timeout (60) 116 (with-timeout (60 (ert-fail "Test timed out"))
117 (let* ((sentinel-called nil) 117 (let* ((sentinel-called nil)
118 (stderr-sentinel-called nil) 118 (stderr-sentinel-called nil)
119 (stdout-output nil) 119 (stdout-output nil)
@@ -156,7 +156,7 @@
156 156
157(ert-deftest set-process-filter-t () 157(ert-deftest set-process-filter-t ()
158 "Test setting process filter to t and back." ;; Bug#36591 158 "Test setting process filter to t and back." ;; Bug#36591
159 (with-timeout (60) 159 (with-timeout (60 (ert-fail "Test timed out"))
160 (with-temp-buffer 160 (with-temp-buffer
161 (let* ((print-level nil) 161 (let* ((print-level nil)
162 (print-length nil) 162 (print-length nil)
@@ -193,7 +193,7 @@
193(ert-deftest start-process-should-not-modify-arguments () 193(ert-deftest start-process-should-not-modify-arguments ()
194 "`start-process' must not modify its arguments in-place." 194 "`start-process' must not modify its arguments in-place."
195 ;; See bug#21831. 195 ;; See bug#21831.
196 (with-timeout (60) 196 (with-timeout (60 (ert-fail "Test timed out"))
197 (let* ((path (pcase system-type 197 (let* ((path (pcase system-type
198 ((or 'windows-nt 'ms-dos) 198 ((or 'windows-nt 'ms-dos)
199 ;; Make sure the file name uses forward slashes. 199 ;; Make sure the file name uses forward slashes.
@@ -212,7 +212,7 @@
212(ert-deftest make-process/noquery-stderr () 212(ert-deftest make-process/noquery-stderr ()
213 "Checks that Bug#30031 is fixed." 213 "Checks that Bug#30031 is fixed."
214 (skip-unless (executable-find "sleep")) 214 (skip-unless (executable-find "sleep"))
215 (with-timeout (60) 215 (with-timeout (60 (ert-fail "Test timed out"))
216 (with-temp-buffer 216 (with-temp-buffer
217 (let* ((previous-processes (process-list)) 217 (let* ((previous-processes (process-list))
218 (process (make-process :name "sleep" 218 (process (make-process :name "sleep"
@@ -243,7 +243,7 @@
243(ert-deftest make-process/mix-stderr () 243(ert-deftest make-process/mix-stderr ()
244 "Check that `make-process' mixes the output streams if STDERR is nil." 244 "Check that `make-process' mixes the output streams if STDERR is nil."
245 (skip-unless (executable-find "bash")) 245 (skip-unless (executable-find "bash"))
246 (with-timeout (60) 246 (with-timeout (60 (ert-fail "Test timed out"))
247 ;; Frequent random (?) failures on hydra.nixos.org, with no process output. 247 ;; Frequent random (?) failures on hydra.nixos.org, with no process output.
248 ;; Maybe this test should be tagged unstable? See bug#31214. 248 ;; Maybe this test should be tagged unstable? See bug#31214.
249 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 249 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
@@ -267,7 +267,7 @@
267(ert-deftest make-process-w32-debug-spawn-error () 267(ert-deftest make-process-w32-debug-spawn-error ()
268 "Check that debugger runs on `make-process' failure (Bug#33016)." 268 "Check that debugger runs on `make-process' failure (Bug#33016)."
269 (skip-unless (eq system-type 'windows-nt)) 269 (skip-unless (eq system-type 'windows-nt))
270 (with-timeout (60) 270 (with-timeout (60 (ert-fail "Test timed out"))
271 (let* ((debug-on-error t) 271 (let* ((debug-on-error t)
272 (have-called-debugger nil) 272 (have-called-debugger nil)
273 (debugger (lambda (&rest _) 273 (debugger (lambda (&rest _)
@@ -286,9 +286,9 @@
286 (should have-called-debugger)))) 286 (should have-called-debugger))))
287 287
288(ert-deftest make-process/file-handler/found () 288(ert-deftest make-process/file-handler/found ()
289 "Check that the :file-handler’ argument of make-process’ 289 "Check that the `:file-handler’ argument of `make-process’
290works as expected if a file name handler is found." 290works as expected if a file name handler is found."
291 (with-timeout (60) 291 (with-timeout (60 (ert-fail "Test timed out"))
292 (let ((file-handler-calls 0)) 292 (let ((file-handler-calls 0))
293 (cl-flet ((file-handler 293 (cl-flet ((file-handler
294 (&rest args) 294 (&rest args)
@@ -308,9 +308,9 @@ works as expected if a file name handler is found."
308 (should (= file-handler-calls 1))))))) 308 (should (= file-handler-calls 1)))))))
309 309
310(ert-deftest make-process/file-handler/not-found () 310(ert-deftest make-process/file-handler/not-found ()
311 "Check that the :file-handler’ argument of make-process’ 311 "Check that the `:file-handler’ argument of `make-process’
312works as expected if no file name handler is found." 312works as expected if no file name handler is found."
313 (with-timeout (60) 313 (with-timeout (60 (ert-fail "Test timed out"))
314 (let ((file-name-handler-alist ()) 314 (let ((file-name-handler-alist ())
315 (default-directory invocation-directory) 315 (default-directory invocation-directory)
316 (program (expand-file-name invocation-name invocation-directory))) 316 (program (expand-file-name invocation-name invocation-directory)))
@@ -319,9 +319,9 @@ works as expected if no file name handler is found."
319 :file-handler t)))))) 319 :file-handler t))))))
320 320
321(ert-deftest make-process/file-handler/disable () 321(ert-deftest make-process/file-handler/disable ()
322 "Check make-process’ works as expected if it shouldn’t use the 322 "Check `make-process’ works as expected if it shouldn’t use the
323file name handler." 323file name handler."
324 (with-timeout (60) 324 (with-timeout (60 (ert-fail "Test timed out"))
325 (let ((file-name-handler-alist (list (cons (rx bos "test-handler:") 325 (let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
326 #'process-tests--file-handler))) 326 #'process-tests--file-handler)))
327 (default-directory "test-handler:/dir/") 327 (default-directory "test-handler:/dir/")
@@ -340,7 +340,7 @@ file name handler."
340(ert-deftest make-process/stop () 340(ert-deftest make-process/stop ()
341 "Check that `make-process' doesn't accept a `:stop' key. 341 "Check that `make-process' doesn't accept a `:stop' key.
342See Bug#30460." 342See Bug#30460."
343 (with-timeout (60) 343 (with-timeout (60 (ert-fail "Test timed out"))
344 (should-error 344 (should-error
345 (make-process :name "test" 345 (make-process :name "test"
346 :command (list (expand-file-name invocation-name 346 :command (list (expand-file-name invocation-name
@@ -351,31 +351,31 @@ See Bug#30460."
351;; be the case for hydra.nixos.org, so disable them there for now. 351;; be the case for hydra.nixos.org, so disable them there for now.
352 352
353(ert-deftest lookup-family-specification () 353(ert-deftest lookup-family-specification ()
354 "network-lookup-address-info should only accept valid family symbols." 354 "`network-lookup-address-info' should only accept valid family symbols."
355 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 355 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
356 (with-timeout (60) 356 (with-timeout (60 (ert-fail "Test timed out"))
357 (should-error (network-lookup-address-info "google.com" 'both)) 357 (should-error (network-lookup-address-info "google.com" 'both))
358 (should (network-lookup-address-info "google.com" 'ipv4)) 358 (should (network-lookup-address-info "google.com" 'ipv4))
359 (when (featurep 'make-network-process '(:family ipv6)) 359 (when (featurep 'make-network-process '(:family ipv6))
360 (should (network-lookup-address-info "google.com" 'ipv6))))) 360 (should (network-lookup-address-info "google.com" 'ipv6)))))
361 361
362(ert-deftest lookup-unicode-domains () 362(ert-deftest lookup-unicode-domains ()
363 "Unicode domains should fail" 363 "Unicode domains should fail."
364 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 364 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
365 (with-timeout (60) 365 (with-timeout (60 (ert-fail "Test timed out"))
366 (should-error (network-lookup-address-info "faß.de")) 366 (should-error (network-lookup-address-info "faß.de"))
367 (should (network-lookup-address-info (puny-encode-domain "faß.de"))))) 367 (should (network-lookup-address-info (puny-encode-domain "faß.de")))))
368 368
369(ert-deftest unibyte-domain-name () 369(ert-deftest unibyte-domain-name ()
370 "Unibyte domain names should work" 370 "Unibyte domain names should work."
371 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 371 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
372 (with-timeout (60) 372 (with-timeout (60 (ert-fail "Test timed out"))
373 (should (network-lookup-address-info (string-to-unibyte "google.com"))))) 373 (should (network-lookup-address-info (string-to-unibyte "google.com")))))
374 374
375(ert-deftest lookup-google () 375(ert-deftest lookup-google ()
376 "Check that we can look up google IP addresses" 376 "Check that we can look up google IP addresses."
377 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 377 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
378 (with-timeout (60) 378 (with-timeout (60 (ert-fail "Test timed out"))
379 (let ((addresses-both (network-lookup-address-info "google.com")) 379 (let ((addresses-both (network-lookup-address-info "google.com"))
380 (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))) 380 (addresses-v4 (network-lookup-address-info "google.com" 'ipv4)))
381 (should addresses-both) 381 (should addresses-both)
@@ -384,9 +384,9 @@ See Bug#30460."
384 (should (network-lookup-address-info "google.com" 'ipv6))))) 384 (should (network-lookup-address-info "google.com" 'ipv6)))))
385 385
386(ert-deftest non-existent-lookup-failure () 386(ert-deftest non-existent-lookup-failure ()
387 "Check that looking up non-existent domain returns nil."
387 (skip-unless (not (getenv "EMACS_HYDRA_CI"))) 388 (skip-unless (not (getenv "EMACS_HYDRA_CI")))
388 (with-timeout (60) 389 (with-timeout (60 (ert-fail "Test timed out"))
389 "Check that looking up non-existent domain returns nil"
390 (should (eq nil (network-lookup-address-info "emacs.invalid"))))) 390 (should (eq nil (network-lookup-address-info "emacs.invalid")))))
391 391
392(defmacro process-tests--ignore-EMFILE (&rest body) 392(defmacro process-tests--ignore-EMFILE (&rest body)