Commit 8806c196 authored by Michael Albinus's avatar Michael Albinus
Browse files

Fix problems in tramp-test33-environment-variables

* test/lisp/net/tramp-tests.el (tramp-test33-environment-variables):
Use ${parameter:-word} construct.  Remove PS1 entry from
"printenv" output.
(tramp--test-check-files): Use "printenv".
parent d8c7bf66
Pipeline #3113 passed with stage
in 55 minutes and 22 seconds
...@@ -4407,7 +4407,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -4407,7 +4407,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}" envvar)))))) (format "echo -n ${%s:-bla}" envvar))))))
(unwind-protect (unwind-protect
;; Set the empty value. ;; Set the empty value.
...@@ -4419,7 +4419,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -4419,7 +4419,7 @@ 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}" envvar)))) (format "echo -n ${%s:-bla}" envvar))))
;; Variable is set. ;; Variable is set.
(should (should
(string-match (string-match
...@@ -4441,7 +4441,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -4441,7 +4441,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}" 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.
...@@ -4450,12 +4450,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -4450,12 +4450,14 @@ 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}" 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 "env"))))))))) ;; We must remove PS1, the output is truncated otherwise.
(funcall
this-shell-command-to-string "printenv | grep -v PS1")))))))))
;; This test is inspired by Bug#27009. ;; This test is inspired by Bug#27009.
(ert-deftest tramp-test33-environment-variables-and-port-numbers () (ert-deftest tramp-test33-environment-variables-and-port-numbers ()
...@@ -5303,7 +5305,7 @@ This requires restrictions of file name syntax." ...@@ -5303,7 +5305,7 @@ This requires restrictions of file name syntax."
;; of process output. So we unset it temporarily. ;; of process output. So we unset it temporarily.
(setenv "PS1") (setenv "PS1")
(with-temp-buffer (with-temp-buffer
(should (zerop (process-file "env" nil t nil))) (should (zerop (process-file "printenv" nil t nil)))
(goto-char (point-min)) (goto-char (point-min))
(should (should
(re-search-forward (re-search-forward
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment