1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-03 11:33:37 +00:00

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.
This commit is contained in:
Michael Albinus 2016-07-14 12:27:41 +02:00
parent 05ba7a0f83
commit 8f5a8b6915

View File

@ -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'."