emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b092a9a 2/2: Adapt `accept-process-output' argument


From: Michael Albinus
Subject: [Emacs-diffs] master b092a9a 2/2: Adapt `accept-process-output' arguments in tramp-tests
Date: Tue, 29 Jan 2019 11:26:28 -0500 (EST)

branch: master
commit b092a9afe613b3ff31071f9f01be743611501f64
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Adapt `accept-process-output' arguments in tramp-tests
    
    * test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
    (tramp-test30-make-process, tramp-test31-interrupt-process)
    (tramp-test32-shell-command)
    (tramp--test-shell-command-to-string-asynchronously)
    (tramp-test43-asynchronous-requests):
    Adapt `accept-process-output' arguments.
---
 test/lisp/net/tramp-archive-tests.el |  2 +-
 test/lisp/net/tramp-tests.el         | 40 +++++++++++++++---------------------
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index 0d0062e..1d9de39 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -515,7 +515,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name tramp-archive-test-archive)
-       (files '("." ".." "bar"  "baz.tar" "foo.hrd" "foo.lnk" "foo.txt")))
+       (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt")))
     (unwind-protect
        (progn
          (should (file-directory-p tmp-name))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 7fa25f1..c52f009 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3818,7 +3818,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`start-file-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3836,7 +3836,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`start-file-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3857,7 +3857,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`start-file-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3890,7 +3890,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`make-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3910,7 +3910,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`make-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3935,7 +3935,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; Read output.
            (with-timeout (10 (ert-fail "`make-process' timed out"))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3958,8 +3958,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (delete-process proc)
            ;; Read output.
            (with-timeout (10 (ert-fail "`make-process' timed out"))
-             (while (process-live-p proc)
-               (accept-process-output proc 0.1)))
+             (while (accept-process-output proc 0 nil t)))
            (should (string-equal (buffer-string) "killed\n")))
 
        ;; Cleanup.
@@ -3980,7 +3979,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (with-current-buffer stderr
                (with-timeout (10 (ert-fail "`make-process' timed out"))
                  (while (= (point-min) (point-max))
-                   (accept-process-output proc 0.1)))
+                   (while (accept-process-output proc 0 nil t))))
                (should
                 (string-equal (buffer-string) "cat: /: Is a directory\n"))))
 
@@ -4007,7 +4006,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
          (should (numberp (process-get proc 'remote-pid)))
          (should (interrupt-process proc))
          ;; Let the process accept the interrupt.
-          (accept-process-output proc 1 nil 0)
+         (while (accept-process-output proc nil nil 0))
          (should-not (process-live-p proc))
          ;; An interrupted process cannot be interrupted, again.
          (should-error (interrupt-process proc) :type 'error))
@@ -4056,10 +4055,8 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
             (current-buffer))
            ;; Read output.
            (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
-             (while (< (- (point-max) (point-min))
-                       (1+ (length (file-name-nondirectory tmp-name))))
-               (accept-process-output
-                (get-buffer-process (current-buffer)) 0.1)))
+             (while (accept-process-output
+                     (get-buffer-process (current-buffer)) nil nil t)))
            ;; `ls' could produce colorized output.
            (goto-char (point-min))
            (while
@@ -4087,10 +4084,8 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
             (format "%s\n" (file-name-nondirectory tmp-name)))
            ;; Read output.
            (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
-             (while (< (- (point-max) (point-min))
-                       (1+ (length (file-name-nondirectory tmp-name))))
-               (accept-process-output
-                (get-buffer-process (current-buffer)) 0.1)))
+             (while (accept-process-output
+                     (get-buffer-process (current-buffer)) nil nil t)))
            ;; `ls' could produce colorized output.
            (goto-char (point-min))
            (while
@@ -4112,10 +4107,9 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
   "Like `shell-command-to-string', but for asynchronous processes."
   (with-temp-buffer
     (async-shell-command command (current-buffer))
-    (with-timeout (10)
-      (while (get-buffer-process (current-buffer))
-       (accept-process-output (get-buffer-process (current-buffer)) 0.1)))
-    (accept-process-output nil 0.1)
+    (with-timeout (10 (ert-fail "`async-shell-command-to-string' timed out"))
+      (while (accept-process-output
+             (get-buffer-process (current-buffer)) nil nil t)))
     (buffer-substring-no-properties (point-min) (point-max))))
 
 ;; This test is inspired by Bug#23952.
@@ -5359,7 +5353,7 @@ process sentinels.  They shall not disturb each other."
                     (should (file-attributes file)))
                   ;; Send string to process.
                   (process-send-string proc (format "%s\n" (buffer-name buf)))
-                  (accept-process-output proc 0.1 nil 0)
+                  (while (accept-process-output proc 0 nil 0))
                   ;; Give the watchdog a chance.
                   (read-event nil nil 0.01)
                   (tramp--test-message



reply via email to

[Prev in Thread] Current Thread [Next in Thread]