[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot ee41f06 22/45: Slightly robustify test engine
From: |
João Távora |
Subject: |
[elpa] externals/eglot ee41f06 22/45: Slightly robustify test engine |
Date: |
Thu, 22 Nov 2018 19:15:30 -0500 (EST) |
branch: externals/eglot
commit ee41f06e15151160513932e94c1d654d2474c9a3
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Slightly robustify test engine
No longer do tests break because of servers take a long time to
shutdown, or even fail to do so properly. This is common in "slow"
servers such as eclipse-jdt in slow systems (such as mine).
* eglot-tests.el (eglot--call-with-fixture): Rework. Shutdown
server after tests but demoting errors.
(eglot--tests-connect): Always sync-connect here.
---
eglot-tests.el | 46 ++++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 7bd457b..74c0eac 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -72,8 +72,8 @@ then restored."
(default-directory fixture-directory)
file-specs created-files
syms-to-restore
- buffers-to-delete new-servers
- cleanup-events-et-cetera-p)
+ new-servers
+ test-body-successful-p)
(dolist (spec fixture)
(cond ((symbolp spec)
(push (cons spec (symbol-value spec)) syms-to-restore)
@@ -86,27 +86,31 @@ then restored."
(let ((eglot-connect-hook
(lambda (server) (push server new-servers))))
(setq created-files (mapcan #'eglot--make-file-or-dir file-specs))
- (funcall fn)
- (setq cleanup-events-et-cetera-p t))
+ (prog1 (funcall fn)
+ (setq test-body-successful-p t)))
+ (eglot--message
+ "Test body was %s" (if test-body-successful-p "OK" "A FAILURE"))
(unwind-protect
(let ((eglot-autoreconnect nil))
(mapc (lambda (server)
- (eglot-shutdown
- server nil 10 (not cleanup-events-et-cetera-p)))
+ (condition-case oops
+ (eglot-shutdown
+ server nil 3 (not test-body-successful-p))
+ (error
+ (message "[eglot] Non-critical shutdown error after
test: %S"
+ oops))))
(cl-remove-if-not #'jsonrpc-running-p new-servers)))
- (setq buffers-to-delete
- (delete nil (mapcar #'find-buffer-visiting created-files)))
- (cl-loop for (sym . val) in syms-to-restore
- do (set sym val))
- (eglot--message
- "Killing project buffers %s, deleting %s, restoring %s, killing
server %s"
- (mapconcat #'buffer-name buffers-to-delete ", ")
- default-directory
- (mapcar #'car syms-to-restore)
- (mapcar #'jsonrpc-name new-servers))
- (dolist (buf buffers-to-delete) ;; have to save otherwise will get
prompted
- (with-current-buffer buf (save-buffer) (kill-buffer)))
- (delete-directory fixture-directory 'recursive)))))
+ (let ((buffers-to-delete
+ (delete nil (mapcar #'find-buffer-visiting created-files))))
+ (eglot--message "Killing %s, wiping %s, restoring %s"
+ buffers-to-delete
+ default-directory
+ (mapcar #'car syms-to-restore))
+ (cl-loop for (sym . val) in syms-to-restore
+ do (set sym val))
+ (dolist (buf buffers-to-delete) ;; have to save otherwise will get
prompted
+ (with-current-buffer buf (save-buffer) (kill-buffer)))
+ (delete-directory fixture-directory 'recursive))))))
(cl-defmacro eglot--with-timeout (timeout &body body)
(declare (indent 1) (debug t))
@@ -222,7 +226,9 @@ Pass TIMEOUT to `eglot--with-timeout'."
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
(defun eglot--tests-connect (&optional timeout)
- (eglot--with-timeout (or timeout 2)
+ (let* ((timeout (or timeout 2))
+ (eglot-sync-connect t)
+ (eglot-connect-timeout timeout))
(apply #'eglot--connect (eglot--guess-contact))))
(ert-deftest eclipse-connect ()
- [elpa] externals/eglot aefa498 20/45: Larger margin for printing test failure backtraces, (continued)
- [elpa] externals/eglot aefa498 20/45: Larger margin for printing test failure backtraces, João Távora, 2018/11/22
- [elpa] externals/eglot 19aded0 17/45: Remove duplicates from imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 504fd25 14/45: Fix misspelling of "outstanding" (#74), João Távora, 2018/11/22
- [elpa] externals/eglot a406190 07/45: Per #63: Allow function contacts to be interactive, João Távora, 2018/11/22
- [elpa] externals/eglot 27696d6 23/45: Use the container name of a symbol in imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls connection, João Távora, 2018/11/22
- [elpa] externals/eglot 22e5c57 18/45: Don't ignore unknown SymbolKinds in imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 5ee05f9 16/45: Require subr-x at compile time (#139), João Távora, 2018/11/22
- [elpa] externals/eglot d9c3696 15/45: Fix #138: accept deprecated field in SymbolInformation, João Távora, 2018/11/22
- [elpa] externals/eglot 82ae4f6 21/45: Re-enable eclipse-jdt tests, João Távora, 2018/11/22
- [elpa] externals/eglot ee41f06 22/45: Slightly robustify test engine,
João Távora <=
- [elpa] externals/eglot faf93ad 13/45: * eglot-tests.el: Disable eclipse connection tests., João Távora, 2018/11/22
- [elpa] externals/eglot c664f40 28/45: * eglot.el (eglot-client-capabilities): Mention supported SymbolKinds., João Távora, 2018/11/22
- [elpa] externals/eglot edc6538 32/45: Fix a bug introduced by previous bugfix, João Távora, 2018/11/22
- [elpa] externals/eglot d6e0ba3 31/45: * eglot-tests.el (eclipse-connect): Increase connect timeout to 20., João Távora, 2018/11/22
- [elpa] externals/eglot 31bfe21 24/45: Add support for code action literals, João Távora, 2018/11/22
- [elpa] externals/eglot 11cd074 29/45: Support ocaml-language-server out of the box (#149), João Távora, 2018/11/22
- [elpa] externals/eglot 7b4ed97 33/45: Fix #124: add ability to move to LSP-precise columns, João Távora, 2018/11/22
- [elpa] externals/eglot f2ccb77 25/45: Simplify eglot-code-action. Fix compilation warning, João Távora, 2018/11/22
- [elpa] externals/eglot 2a410e9 30/45: Move constants to top instead of forward-declaring, João Távora, 2018/11/22
- [elpa] externals/eglot f74a80f 27/45: Make imenu hierarchical, João Távora, 2018/11/22