aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-12-02 17:27:16 +0100
committerMattias EngdegÄrd2022-12-02 17:32:22 +0100
commit4b3eb928fed4b236d1ae06ae7d9d51a4466554d2 (patch)
tree0dfd10c96c71d3bf4df887827b225abf53781263
parent1b567f5a67de1151b76b279311a73a7bf7174c12 (diff)
downloademacs-4b3eb928fed4b236d1ae06ae7d9d51a4466554d2.tar.gz
emacs-4b3eb928fed4b236d1ae06ae7d9d51a4466554d2.zip
Fix server-tests run noninteractively (bug#59742)
This may or may not fix the test run from CI. * test/lisp/server-tests.el (server-tests/can-create-frames-p): Don't attempt to create frames if TERM=dumb, which what we have if run from M-x compile (for instance). (server-tests/server-force-stop/keeps-frames): Delete created frame so that it doesn't cause trouble for other tests.
-rw-r--r--test/lisp/server-tests.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el
index f8ecd046f2b..c7813e2aefc 100644
--- a/test/lisp/server-tests.el
+++ b/test/lisp/server-tests.el
@@ -21,9 +21,12 @@
21 21
22(require 'ert) 22(require 'ert)
23(require 'server) 23(require 'server)
24(require 'cl-lib)
24 25
25(defconst server-tests/can-create-frames-p 26(defconst server-tests/can-create-frames-p
26 (not (memq system-type '(windows-nt ms-dos))) 27 (and (not (memq system-type '(windows-nt ms-dos)))
28 ;; TERM=dumb is what we get when running from `compile'.
29 (not (equal (getenv "TERM") "dumb")))
27 "Non-nil if we can create a new frame in the tests. 30 "Non-nil if we can create a new frame in the tests.
28Some tests below need to create new frames for the emacsclient. 31Some tests below need to create new frames for the emacsclient.
29However, this doesn't work on all platforms. In particular, 32However, this doesn't work on all platforms. In particular,
@@ -188,8 +191,9 @@ tests that `server-force-stop' doesn't delete frames (and even
188then, requires a few tricks to run as a regression test). So 191then, requires a few tricks to run as a regression test). So
189long as this works, the problem in bug#58877 shouldn't occur." 192long as this works, the problem in bug#58877 shouldn't occur."
190 (skip-unless server-tests/can-create-frames-p) 193 (skip-unless server-tests/can-create-frames-p)
191 (let ((starting-frame-count (length (frame-list))) 194 (let* ((starting-frames (frame-list))
192 terminal) 195 (starting-frame-count (length starting-frames))
196 terminal)
193 (unwind-protect 197 (unwind-protect
194 (server-tests/with-server 198 (server-tests/with-server
195 (server-tests/with-client emacsclient '("-c") 'exit 199 (server-tests/with-client emacsclient '("-c") 'exit
@@ -214,6 +218,9 @@ long as this works, the problem in bug#58877 shouldn't occur."
214 (when (and terminal 218 (when (and terminal
215 (eq (terminal-live-p terminal) t) 219 (eq (terminal-live-p terminal) t)
216 (not (eq system-type 'windows-nt))) 220 (not (eq system-type 'windows-nt)))
217 (delete-terminal terminal))))) 221 (delete-terminal terminal)))
222 ;; Delete the created frame.
223 (delete-frame (car (cl-set-difference (frame-list) starting-frames))
224 t)))
218 225
219;;; server-tests.el ends here 226;;; server-tests.el ends here