]> git.eshelyaron.com Git - emacs.git/commitdiff
Suppress timers in Tramp operations
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 16 Dec 2017 09:47:06 +0000 (10:47 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 16 Dec 2017 09:47:06 +0000 (10:47 +0100)
* lisp/net/tramp.el (tramp-accept-process-output):
* lisp/net/tramp-adb.el (tramp-adb-handle-start-file-process):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-start-file-process):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process): Suppress timers.

* test/lisp/net/tramp-tests.el (tramp-test41-asynchronous-requests):
Use $REMOTE_PARALLEL_PROCESSES.  Flush cache prior file operations.
Add instrumentation messages.

lisp/net/tramp-adb.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el
test/lisp/net/tramp-tests.el

index d06031f1a6798204aa9418e26407d91dd3c86b47..c614acfa4db8ab25258522472bd4362f84c54cda 100644 (file)
@@ -1037,7 +1037,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
            (or (null program) tramp-process-connection-type))
           (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
           (name1 name)
-          (i 0))
+          (i 0)
+          ;; We do not want to run timers.
+          timer-list timer-idle-list)
 
       (while (get-process name1)
        ;; NAME must be unique as process name.
index 361e4c3e30036472e413eed75beaf2e6fb4b140e..96a0d8490721107ae7a45a729717a812c0db59cf 100644 (file)
@@ -2473,7 +2473,9 @@ The method used must be an out-of-band method."
              ;; The default directory must be remote.
              (let ((default-directory
                      (file-name-directory (if t1 filename newname)))
-                   (process-environment (copy-sequence process-environment)))
+                   (process-environment (copy-sequence process-environment))
+                   ;; We do not want to run timers.
+                   timer-list timer-idle-list)
                ;; Set the transfer process properties.
                (tramp-set-connection-property
                 v "process-name" (buffer-name (current-buffer)))
@@ -2894,7 +2896,9 @@ the result will be a local, non-Tramp, file name."
           ;; We do not want to raise an error when
           ;; `start-file-process' has been started several times in
           ;; `eshell' and friends.
-          (tramp-current-connection nil)
+          tramp-current-connection
+          ;; We do not want to run timers.
+          timer-list timer-idle-list
           p)
 
       (while (get-process name1)
index ec689aea15f8f49977423367de16adb21046dd91..fee14df991eef277a343bbf82ea8763b2ed0585b 100644 (file)
@@ -457,7 +457,9 @@ pass to the OPERATION."
                               (expand-file-name
                                tramp-temp-name-prefix
                                (tramp-compat-temporary-file-directory))))
-                  (args      (list (concat "//" host "/" share) "-E")))
+                  (args      (list (concat "//" host "/" share) "-E"))
+                  ;; We do not want to run timers.
+                  timer-list timer-idle-list)
 
              (if (not (zerop (length user)))
                  (setq args (append args (list "-U" user)))
@@ -739,7 +741,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
          (let* ((share     (tramp-smb-get-share v))
                 (localname (replace-regexp-in-string
                             "\\\\" "/" (tramp-smb-get-localname v)))
-                (args      (list (concat "//" host "/" share) "-E")))
+                (args      (list (concat "//" host "/" share) "-E"))
+                ;; We do not want to run timers.
+                timer-list timer-idle-list)
 
            (if (not (zerop (length user)))
                (setq args (append args (list "-U" user)))
@@ -1215,6 +1219,8 @@ component is used as the target of the symlink."
     (let* ((name (file-name-nondirectory program))
           (name1 name)
           (i 0)
+          ;; We do not want to run timers.
+          timer-list timer-idle-list
           input tmpinput outbuf command ret)
 
       ;; Determine input.
@@ -1391,7 +1397,9 @@ component is used as the target of the symlink."
                           "\\\\" "/" (tramp-smb-get-localname v)))
               (args      (list (concat "//" host "/" share) "-E" "-S"
                                (replace-regexp-in-string
-                                "\n" "," acl-string))))
+                                "\n" "," acl-string)))
+              ;; We do not want to run timers.
+              timer-list timer-idle-list)
 
          (if (not (zerop (length user)))
              (setq args (append args (list "-U" user)))
@@ -1471,7 +1479,9 @@ component is used as the target of the symlink."
           (command (mapconcat 'identity (cons program args) " "))
           (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
           (name1 name)
-          (i 0))
+          (i 0)
+          ;; We do not want to run timers.
+          timer-list timer-idle-list)
       (unwind-protect
          (save-excursion
            (save-restriction
index 3129984afc6599bf64105248da5692dc4c392f34..01a3e44c73e7c00b77d5d66c2ea0500d0376cb3e 100644 (file)
@@ -3833,7 +3833,9 @@ connection buffer."
 This is needed in order to hide `last-coding-system-used', which is set
 for process communication also."
   (with-current-buffer (process-buffer proc)
-    (let (buffer-read-only last-coding-system-used)
+    (let (buffer-read-only last-coding-system-used
+         ;; We do not want to run timers.
+         timer-list timer-idle-list)
       ;; Under Windows XP, `accept-process-output' doesn't return
       ;; sometimes.  So we add an additional timeout.  JUST-THIS-ONE
       ;; is set due to Bug#12145.  It is an integer, in order to avoid
index 5fb3162769b53fd286533ce314ca4b48b051a6e0..1bcd3a0f98bfc02119158690a211b256cdd81eaa 100644 (file)
 ;; remote host, set this environment variable to "/dev/null" or
 ;; whatever is appropriate on your system.
 
+;; For slow remote connections, `tramp-test41-asynchronous-requests'
+;; might be too heavy.  Setting $REMOTE_PARALLEL_PROCESSES to a proper
+;; value less than 10 could help.
+
 ;; A whole test run can be performed calling the command `tramp-test-all'.
 
 ;;; Code:
@@ -4504,8 +4508,13 @@ process sentinels.  They shall not disturb each other."
            (inhibit-message t)
           ;; Do not run delayed timers.
           (timer-max-repeats 0)
-          ;; Number of asynchronous processes for test.
-           (number-proc 10)
+          ;; Number of asynchronous processes for test.  Tests on
+          ;; some machines handle less parallel processes.
+           (number-proc
+            (or
+             (ignore-errors
+               (string-to-number (getenv "REMOTE_PARALLEL_PROCESSES")))
+             10))
            ;; On hydra, timings are bad.
            (timer-repeat
             (cond
@@ -4571,14 +4580,20 @@ process sentinels.  They shall not disturb each other."
                 (set-process-filter
                  proc
                  (lambda (proc string)
+                   (tramp--test-message
+                    "Process filter %s %s %s" proc string (current-time-string))
                    (with-current-buffer (process-buffer proc)
                      (insert string))
                    (unless (zerop (length string))
+                    (dired-uncache (process-get proc 'foo))
                      (should (file-attributes (process-get proc 'foo))))))
                 ;; Add process sentinel.
                 (set-process-sentinel
                  proc
                  (lambda (proc _state)
+                   (tramp--test-message
+                    "Process sentinel %s %s" proc (current-time-string))
+                  (dired-uncache (process-get proc 'foo))
                    (should-not (file-attributes (process-get proc 'foo)))))))
 
             ;; Send a string.  Use a random order of the buffers.  Mix
@@ -4594,6 +4609,7 @@ process sentinels.  They shall not disturb each other."
                   (tramp--test-message
                    "Start action %d %s %s" count buf (current-time-string))
                   ;; Regular operation prior process action.
+                 (dired-uncache file)
                   (if (= count 0)
                       (should-not (file-attributes file))
                     (should (file-attributes file)))
@@ -4602,7 +4618,10 @@ process sentinels.  They shall not disturb each other."
                   (accept-process-output proc 0.1 nil 0)
                   ;; Give the watchdog a chance.
                   (read-event nil nil 0.01)
+                  (tramp--test-message
+                   "Continue action %d %s %s" count buf (current-time-string))
                   ;; Regular operation post process action.
+                 (dired-uncache file)
                   (if (= count 2)
                       (should-not (file-attributes file))
                     (should (file-attributes file)))