[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 831bef1: * test/lisp/net/tramp-tests.el (tramp--tes
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master 831bef1: * test/lisp/net/tramp-tests.el (tramp--test-check-files): Make it robust. |
Date: |
Fri, 23 Dec 2016 08:31:40 +0000 (UTC) |
branch: master
commit 831bef1a469356b82892c163f33c9c65ccd75c7c
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
* test/lisp/net/tramp-tests.el (tramp--test-check-files): Make it robust.
---
test/lisp/net/tramp-tests.el | 53 ++++++++++++++----------------------------
1 file changed, 17 insertions(+), 36 deletions(-)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 3d92dff..22b60db 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2169,18 +2169,6 @@ This requires restrictions of file name syntax."
(process-environment process-environment))
(unwind-protect
(progn
- ;; Add environment variables.
- (dolist (elt files)
- ;; The check command (heredoc file) does not support
- ;; environment variables with leading spaces.
- (let* ((elt (replace-regexp-in-string "^\\s-+" "" elt))
- (envvar (concat "VAR_" (upcase (md5 elt)))))
- (setenv envvar elt)))
-
- ;; We force a reconnect, in order to have a clean environment.
- (tramp-cleanup-connection
- (tramp-dissect-file-name tramp-test-temporary-file-directory)
- 'keep-debug 'keep-password)
(make-directory tmp-name1)
(make-directory tmp-name2)
@@ -2310,30 +2298,23 @@ This requires restrictions of file name syntax."
;; Check, that environment variables are set correctly.
(when (and tramp--test-expensive-test (tramp--test-sh-p))
- (dolist (elt process-environment)
- (when (string-match "^VAR_" elt)
- (let* ((default-directory tramp-test-temporary-file-directory)
- (shell-file-name "/bin/sh")
- (heredoc (md5 (current-time-string)))
- (envvar (car (split-string elt "=" t)))
- (file1 (tramp-compat-file-name-unquote
- (expand-file-name "bar" tmp-name1))))
- ;; Cleanup.
- (ignore-errors (delete-file file1))
- ;; Save the variable in a file. The echo command
- ;; does not work properly, it suppresses leading/
- ;; trailing spaces as well as tabs.
- (shell-command-to-string
- (format
- "cat <<%s >%s\n$%s\n%s"
- heredoc (file-remote-p file1 'localname) envvar heredoc))
- (with-temp-buffer
- (insert-file-contents file1)
- (should
- (string-equal
- (buffer-string) (concat (getenv envvar) "\n"))))
- (delete-file file1)
- (should-not (file-exists-p file1)))))))
+ (dolist (elt files)
+ (let ((envvar (concat "VAR_" (upcase (md5 elt))))
+ (default-directory tramp-test-temporary-file-directory)
+ (process-environment process-environment))
+ (setenv envvar elt)
+ ;; The value of PS1 could confuse Tramp's detection
+ ;; of process output. So we unset it temporarily.
+ (setenv "PS1")
+ (with-temp-buffer
+ (should (zerop (process-file "env" nil t nil)))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (format
+ "^%s=%s$"
+ (regexp-quote envvar)
+ (regexp-quote (getenv envvar))))))))))
;; Cleanup.
(ignore-errors (delete-directory tmp-name1 'recursive))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 831bef1: * test/lisp/net/tramp-tests.el (tramp--test-check-files): Make it robust.,
Michael Albinus <=