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:
parent
05ba7a0f83
commit
8f5a8b6915
1 changed files with 9 additions and 13 deletions
|
@ -1604,10 +1604,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||||
(async-shell-command command (current-buffer))
|
(async-shell-command command (current-buffer))
|
||||||
;; Suppress nasty messages.
|
;; Suppress nasty messages.
|
||||||
(set-process-sentinel (get-buffer-process (current-buffer)) nil)
|
(set-process-sentinel (get-buffer-process (current-buffer)) nil)
|
||||||
(while
|
(while (get-buffer-process (current-buffer))
|
||||||
(and (get-buffer-process (current-buffer))
|
(accept-process-output (get-buffer-process (current-buffer)) 0.1))
|
||||||
(eq (process-status (get-buffer-process (current-buffer))) 'run))
|
(accept-process-output)
|
||||||
(accept-process-output (get-buffer-process (current-buffer)) 1))
|
|
||||||
(buffer-substring-no-properties (point-min) (point-max))))
|
(buffer-substring-no-properties (point-min) (point-max))))
|
||||||
|
|
||||||
;; This test is inspired by Bug#23952.
|
;; 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-find-foreign-file-name-handler tramp-test-temporary-file-directory)
|
||||||
'tramp-sh-file-name-handler))
|
'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
|
(dolist (this-shell-command-to-string
|
||||||
'(;; Synchronously.
|
'(;; Synchronously.
|
||||||
shell-command-to-string
|
shell-command-to-string
|
||||||
|
@ -1644,7 +1640,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||||
"foo"
|
"foo"
|
||||||
(funcall
|
(funcall
|
||||||
this-shell-command-to-string
|
this-shell-command-to-string
|
||||||
(format "echo -n ${%s:?bla}; sleep 1" envvar))))))
|
(format "echo -n ${%s:?bla}" envvar))))))
|
||||||
|
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
;; Set the empty value.
|
;; Set the empty value.
|
||||||
|
@ -1656,12 +1652,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||||
"bla"
|
"bla"
|
||||||
(funcall
|
(funcall
|
||||||
this-shell-command-to-string
|
this-shell-command-to-string
|
||||||
(format "echo -n ${%s:?bla}; sleep 1" envvar))))
|
(format "echo -n ${%s:?bla}" envvar))))
|
||||||
;; Variable is set.
|
;; Variable is set.
|
||||||
(should
|
(should
|
||||||
(string-match
|
(string-match
|
||||||
(regexp-quote envvar)
|
(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.
|
;; We force a reconnect, in order to have a clean environment.
|
||||||
(tramp-cleanup-connection
|
(tramp-cleanup-connection
|
||||||
|
@ -1678,7 +1674,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||||
"foo"
|
"foo"
|
||||||
(funcall
|
(funcall
|
||||||
this-shell-command-to-string
|
this-shell-command-to-string
|
||||||
(format "echo -n ${%s:?bla}; sleep 1" envvar))))
|
(format "echo -n ${%s:?bla}" envvar))))
|
||||||
(let ((process-environment
|
(let ((process-environment
|
||||||
(cons envvar process-environment)))
|
(cons envvar process-environment)))
|
||||||
;; Variable is unset.
|
;; Variable is unset.
|
||||||
|
@ -1687,12 +1683,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||||
"bla"
|
"bla"
|
||||||
(funcall
|
(funcall
|
||||||
this-shell-command-to-string
|
this-shell-command-to-string
|
||||||
(format "echo -n ${%s:?bla}; sleep 1" envvar))))
|
(format "echo -n ${%s:?bla}" envvar))))
|
||||||
;; Variable is unset.
|
;; Variable is unset.
|
||||||
(should-not
|
(should-not
|
||||||
(string-match
|
(string-match
|
||||||
(regexp-quote envvar)
|
(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 ()
|
(ert-deftest tramp-test30-vc-registered ()
|
||||||
"Check `vc-registered'."
|
"Check `vc-registered'."
|
||||||
|
|
Loading…
Add table
Reference in a new issue