From 8f5a8b69157ed73f14faed6d3dd943d65bce9264 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 14 Jul 2016 12:27:41 +0200 Subject: [PATCH] Improve timing in `tramp-test29-environment-variables' * test/automated/tramp-tests.el (tramp-test--shell-command-to-string-asynchronously): Add additional `accept-process-output' call. (tramp-test29-environment-variables): Remove additional sleep calls. --- test/automated/tramp-tests.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index cc90d1950cd..34d8d6ad495 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1604,10 +1604,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (async-shell-command command (current-buffer)) ;; Suppress nasty messages. (set-process-sentinel (get-buffer-process (current-buffer)) nil) - (while - (and (get-buffer-process (current-buffer)) - (eq (process-status (get-buffer-process (current-buffer))) 'run)) - (accept-process-output (get-buffer-process (current-buffer)) 1)) + (while (get-buffer-process (current-buffer)) + (accept-process-output (get-buffer-process (current-buffer)) 0.1)) + (accept-process-output) (buffer-substring-no-properties (point-min) (point-max)))) ;; This test is inspired by Bug#23952. @@ -1620,9 +1619,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-sh-file-name-handler)) - ;; Implementation note: There is a "sleep 1" at the end of every - ;; test. Otherwise, the scripts could return too early, without - ;; expected output. (dolist (this-shell-command-to-string '(;; Synchronously. shell-command-to-string @@ -1644,7 +1640,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "foo" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))))) + (format "echo -n ${%s:?bla}" envvar)))))) (unwind-protect ;; Set the empty value. @@ -1656,12 +1652,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "bla" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) ;; Variable is set. (should (string-match (regexp-quote envvar) - (funcall this-shell-command-to-string "set; sleep 1"))))) + (funcall this-shell-command-to-string "set"))))) ;; We force a reconnect, in order to have a clean environment. (tramp-cleanup-connection @@ -1678,7 +1674,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "foo" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) (let ((process-environment (cons envvar process-environment))) ;; Variable is unset. @@ -1687,12 +1683,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "bla" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) ;; Variable is unset. (should-not (string-match (regexp-quote envvar) - (funcall this-shell-command-to-string "set; sleep 1"))))))))) + (funcall this-shell-command-to-string "set"))))))))) (ert-deftest tramp-test30-vc-registered () "Check `vc-registered'." -- 2.39.2