summaryrefslogtreecommitdiff
path: root/test/lib-src
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2017-09-06 20:06:57 -0400
committerGlenn Morris <rgm@gnu.org>2017-09-06 20:06:57 -0400
commita0e3f715fc4882518fa737318c4d07ef7870bd90 (patch)
treef659a37f2b2274ad9ed429da9935fc1b2923b686 /test/lib-src
parent1436ce83d39112c44c434e95d6bd2e2320b5c73d (diff)
downloademacs-a0e3f715fc4882518fa737318c4d07ef7870bd90.tar.gz
emacs-a0e3f715fc4882518fa737318c4d07ef7870bd90.tar.bz2
emacs-a0e3f715fc4882518fa737318c4d07ef7870bd90.zip
Skip emacsclient tests if --enable-profiling was used
* test/lib-src/emacsclient-tests.el (emacsclient-test-call-emacsclient): Make it a macro. Handle "Profiling timer expired" return from emacsclient. (Bug#28319) (emacsclient-test-alternate-editor-allows-arguments) (emacsclient-test-alternate-editor-allows-quotes): Update for above.
Diffstat (limited to 'test/lib-src')
-rw-r--r--test/lib-src/emacsclient-tests.el35
1 files changed, 19 insertions, 16 deletions
diff --git a/test/lib-src/emacsclient-tests.el b/test/lib-src/emacsclient-tests.el
index 3a2396f7817..4b7fa47989d 100644
--- a/test/lib-src/emacsclient-tests.el
+++ b/test/lib-src/emacsclient-tests.el
@@ -31,26 +31,29 @@
"emacsclient")
"The emacsclient binary to test.")
-(defun emacsclient-test-call-emacsclient ()
- "Run emacsclient."
- (call-process emacsclient-test-emacs nil nil nil
- "--server-file" (expand-file-name "non-existent-file" invocation-directory)
- "foo"))
+(defmacro emacsclient-test-call-emacsclient (editor)
+ "Run emacsclient with ALTERNATE_EDITOR set to EDITOR."
+ `(let* ((process-environment
+ (cons (concat "ALTERNATE_EDITOR=" ,editor) process-environment))
+ (stat (call-process emacsclient-test-emacs nil nil nil
+ "--server-file"
+ (expand-file-name "non-existent-file"
+ invocation-directory)
+ "foo")))
+ ;; Skip if emacsclient was compiled with -pg (bug#28319).
+ ;; Use ert--skip-unless rather than skip-unless to silence compiler.
+ (ert--skip-unless (not (and (stringp stat)
+ (string-match-p "rofiling" stat))))
+ (should (eq 0 stat))))
(ert-deftest emacsclient-test-alternate-editor-allows-arguments ()
- (let ((process-environment process-environment))
- (setenv "ALTERNATE_EDITOR" (concat
- (expand-file-name invocation-name invocation-directory)
- " --batch"))
- (should (eq 0 (emacsclient-test-call-emacsclient)))))
+ (emacsclient-test-call-emacsclient
+ (concat (expand-file-name invocation-name invocation-directory) " --batch")))
(ert-deftest emacsclient-test-alternate-editor-allows-quotes ()
- (let ((process-environment process-environment))
- (setenv "ALTERNATE_EDITOR" (concat
- "\""
- (expand-file-name invocation-name invocation-directory)
- "\"" " --batch"))
- (should (eq 0 (emacsclient-test-call-emacsclient)))))
+ (emacsclient-test-call-emacsclient
+ (concat "\"" (expand-file-name invocation-name invocation-directory)
+ "\"" " --batch")))
(provide 'emacsclient-tests)
;;; emacsclient-tests.el ends here