aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorGlenn Morris2018-01-17 13:41:07 -0500
committerGlenn Morris2018-01-17 13:41:07 -0500
commit188a9d99b8246e756aa2701bfdc9a8db57ce64c6 (patch)
tree5d6fbc3d8451a9627dfdf73bbd274722c896d619 /test/src
parent064395251f99eb85161ca7c8e36665e2bd0453f5 (diff)
downloademacs-188a9d99b8246e756aa2701bfdc9a8db57ce64c6.tar.gz
emacs-188a9d99b8246e756aa2701bfdc9a8db57ce64c6.zip
Add some test skip conditions
* test/lisp/vc/vc-bzr-tests.el (vc-bzr-test-bug9726) (vc-bzr-test-bug9781): Skip if bzr is faulty. * test/src/thread-tests.el: Skip if not compiled with threads.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/thread-tests.el76
1 files changed, 52 insertions, 24 deletions
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 244a51621b5..0e909d3e511 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -20,29 +20,35 @@
20;;; Code: 20;;; Code:
21 21
22(ert-deftest threads-is-one () 22(ert-deftest threads-is-one ()
23 "test for existence of a thread" 23 "Test for existence of a thread."
24 (skip-unless (fboundp 'make-thread))
24 (should (current-thread))) 25 (should (current-thread)))
25 26
26(ert-deftest threads-threadp () 27(ert-deftest threads-threadp ()
27 "test of threadp" 28 "Test of threadp."
29 (skip-unless (fboundp 'make-thread))
28 (should (threadp (current-thread)))) 30 (should (threadp (current-thread))))
29 31
30(ert-deftest threads-type () 32(ert-deftest threads-type ()
31 "test of thread type" 33 "Test of thread type."
34 (skip-unless (fboundp 'make-thread))
32 (should (eq (type-of (current-thread)) 'thread))) 35 (should (eq (type-of (current-thread)) 'thread)))
33 36
34(ert-deftest threads-name () 37(ert-deftest threads-name ()
35 "test for name of a thread" 38 "Test for name of a thread."
39 (skip-unless (fboundp 'make-thread))
36 (should 40 (should
37 (string= "hi bob" (thread-name (make-thread #'ignore "hi bob"))))) 41 (string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
38 42
39(ert-deftest threads-alive () 43(ert-deftest threads-alive ()
40 "test for thread liveness" 44 "Test for thread liveness."
45 (skip-unless (fboundp 'make-thread))
41 (should 46 (should
42 (thread-alive-p (make-thread #'ignore)))) 47 (thread-alive-p (make-thread #'ignore))))
43 48
44(ert-deftest threads-all-threads () 49(ert-deftest threads-all-threads ()
45 "simple test for all-threads" 50 "Simple test for all-threads."
51 (skip-unless (fboundp 'make-thread))
46 (should (listp (all-threads)))) 52 (should (listp (all-threads))))
47 53
48(defvar threads-test-global nil) 54(defvar threads-test-global nil)
@@ -51,7 +57,8 @@
51 (setq threads-test-global 23)) 57 (setq threads-test-global 23))
52 58
53(ert-deftest threads-basic () 59(ert-deftest threads-basic ()
54 "basic thread test" 60 "Basic thread test."
61 (skip-unless (fboundp 'make-thread))
55 (should 62 (should
56 (progn 63 (progn
57 (setq threads-test-global nil) 64 (setq threads-test-global nil)
@@ -61,7 +68,8 @@
61 threads-test-global))) 68 threads-test-global)))
62 69
63(ert-deftest threads-join () 70(ert-deftest threads-join ()
64 "test of thread-join" 71 "Test of `thread-join'."
72 (skip-unless (fboundp 'make-thread))
65 (should 73 (should
66 (progn 74 (progn
67 (setq threads-test-global nil) 75 (setq threads-test-global nil)
@@ -71,7 +79,8 @@
71 (not (thread-alive-p thread))))))) 79 (not (thread-alive-p thread)))))))
72 80
73(ert-deftest threads-join-self () 81(ert-deftest threads-join-self ()
74 "cannot thread-join the current thread" 82 "Cannot `thread-join' the current thread."
83 (skip-unless (fboundp 'make-thread))
75 (should-error (thread-join (current-thread)))) 84 (should-error (thread-join (current-thread))))
76 85
77(defvar threads-test-binding nil) 86(defvar threads-test-binding nil)
@@ -82,7 +91,8 @@
82 (setq threads-test-global 23)) 91 (setq threads-test-global 23))
83 92
84(ert-deftest threads-let-binding () 93(ert-deftest threads-let-binding ()
85 "simple test of threads and let bindings" 94 "Simple test of threads and let bindings."
95 (skip-unless (fboundp 'make-thread))
86 (should 96 (should
87 (progn 97 (progn
88 (setq threads-test-global nil) 98 (setq threads-test-global nil)
@@ -93,19 +103,23 @@
93 threads-test-global)))) 103 threads-test-global))))
94 104
95(ert-deftest threads-mutexp () 105(ert-deftest threads-mutexp ()
96 "simple test of mutexp" 106 "Simple test of `mutexp'."
107 (skip-unless (fboundp 'make-thread))
97 (should-not (mutexp 'hi))) 108 (should-not (mutexp 'hi)))
98 109
99(ert-deftest threads-mutexp-2 () 110(ert-deftest threads-mutexp-2 ()
100 "another simple test of mutexp" 111 "Another simple test of `mutexp'."
112 (skip-unless (fboundp 'make-thread))
101 (should (mutexp (make-mutex)))) 113 (should (mutexp (make-mutex))))
102 114
103(ert-deftest threads-mutex-type () 115(ert-deftest threads-mutex-type ()
104 "type-of mutex" 116 "type-of mutex."
117 (skip-unless (fboundp 'make-thread))
105 (should (eq (type-of (make-mutex)) 'mutex))) 118 (should (eq (type-of (make-mutex)) 'mutex)))
106 119
107(ert-deftest threads-mutex-lock-unlock () 120(ert-deftest threads-mutex-lock-unlock ()
108 "test mutex-lock and unlock" 121 "Test mutex-lock and unlock."
122 (skip-unless (fboundp 'make-thread))
109 (should 123 (should
110 (let ((mx (make-mutex))) 124 (let ((mx (make-mutex)))
111 (mutex-lock mx) 125 (mutex-lock mx)
@@ -113,7 +127,8 @@
113 t))) 127 t)))
114 128
115(ert-deftest threads-mutex-recursive () 129(ert-deftest threads-mutex-recursive ()
116 "test mutex-lock and unlock" 130 "Test mutex recursion."
131 (skip-unless (fboundp 'make-thread))
117 (should 132 (should
118 (let ((mx (make-mutex))) 133 (let ((mx (make-mutex)))
119 (mutex-lock mx) 134 (mutex-lock mx)
@@ -133,7 +148,8 @@
133 (mutex-unlock threads-mutex)) 148 (mutex-unlock threads-mutex))
134 149
135(ert-deftest threads-mutex-contention () 150(ert-deftest threads-mutex-contention ()
136 "test of mutex contention" 151 "Test of mutex contention."
152 (skip-unless (fboundp 'make-thread))
137 (should 153 (should
138 (progn 154 (progn
139 (setq threads-mutex (make-mutex)) 155 (setq threads-mutex (make-mutex))
@@ -153,7 +169,8 @@
153 (mutex-lock threads-mutex)) 169 (mutex-lock threads-mutex))
154 170
155(ert-deftest threads-mutex-signal () 171(ert-deftest threads-mutex-signal ()
156 "test signaling a blocked thread" 172 "Test signaling a blocked thread."
173 (skip-unless (fboundp 'make-thread))
157 (should 174 (should
158 (progn 175 (progn
159 (setq threads-mutex (make-mutex)) 176 (setq threads-mutex (make-mutex))
@@ -170,7 +187,8 @@
170 (setq threads-test-global 23)) 187 (setq threads-test-global 23))
171 188
172(ert-deftest threads-io-switch () 189(ert-deftest threads-io-switch ()
173 "test that accept-process-output causes thread switch" 190 "Test that `accept-process-output' causes thread switch."
191 (skip-unless (fboundp 'make-thread))
174 (should 192 (should
175 (progn 193 (progn
176 (setq threads-test-global nil) 194 (setq threads-test-global nil)
@@ -180,31 +198,37 @@
180 threads-test-global))) 198 threads-test-global)))
181 199
182(ert-deftest threads-condvarp () 200(ert-deftest threads-condvarp ()
183 "simple test of condition-variable-p" 201 "Simple test of `condition-variable-p'."
202 (skip-unless (fboundp 'make-thread))
184 (should-not (condition-variable-p 'hi))) 203 (should-not (condition-variable-p 'hi)))
185 204
186(ert-deftest threads-condvarp-2 () 205(ert-deftest threads-condvarp-2 ()
187 "another simple test of condition-variable-p" 206 "Another simple test of `condition-variable-p'."
207 (skip-unless (fboundp 'make-thread))
188 (should (condition-variable-p (make-condition-variable (make-mutex))))) 208 (should (condition-variable-p (make-condition-variable (make-mutex)))))
189 209
190(ert-deftest threads-condvar-type () 210(ert-deftest threads-condvar-type ()
191 "type-of condvar" 211 "type-of condvar"
212 (skip-unless (fboundp 'make-thread))
192 (should (eq (type-of (make-condition-variable (make-mutex))) 213 (should (eq (type-of (make-condition-variable (make-mutex)))
193 'condition-variable))) 214 'condition-variable)))
194 215
195(ert-deftest threads-condvar-mutex () 216(ert-deftest threads-condvar-mutex ()
196 "simple test of condition-mutex" 217 "Simple test of `condition-mutex'."
218 (skip-unless (fboundp 'make-thread))
197 (should 219 (should
198 (let ((m (make-mutex))) 220 (let ((m (make-mutex)))
199 (eq m (condition-mutex (make-condition-variable m)))))) 221 (eq m (condition-mutex (make-condition-variable m))))))
200 222
201(ert-deftest threads-condvar-name () 223(ert-deftest threads-condvar-name ()
202 "simple test of condition-name" 224 "Simple test of `condition-name'."
225 (skip-unless (fboundp 'make-thread))
203 (should 226 (should
204 (eq nil (condition-name (make-condition-variable (make-mutex)))))) 227 (eq nil (condition-name (make-condition-variable (make-mutex))))))
205 228
206(ert-deftest threads-condvar-name-2 () 229(ert-deftest threads-condvar-name-2 ()
207 "another simple test of condition-name" 230 "Another simple test of `condition-name'."
231 (skip-unless (fboundp 'make-thread))
208 (should 232 (should
209 (string= "hi bob" 233 (string= "hi bob"
210 (condition-name (make-condition-variable (make-mutex) 234 (condition-name (make-condition-variable (make-mutex)
@@ -222,6 +246,7 @@
222 246
223(ert-deftest thread-errors () 247(ert-deftest thread-errors ()
224 "Test what happens when a thread signals an error." 248 "Test what happens when a thread signals an error."
249 (skip-unless (fboundp 'make-thread))
225 (let (th1 th2) 250 (let (th1 th2)
226 (setq th1 (make-thread #'call-error "call-error")) 251 (setq th1 (make-thread #'call-error "call-error"))
227 (should (threadp th1)) 252 (should (threadp th1))
@@ -234,6 +259,7 @@
234 259
235(ert-deftest thread-sticky-point () 260(ert-deftest thread-sticky-point ()
236 "Test bug #25165 with point movement in cloned buffer." 261 "Test bug #25165 with point movement in cloned buffer."
262 (skip-unless (fboundp 'make-thread))
237 (with-temp-buffer 263 (with-temp-buffer
238 (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") 264 (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
239 (goto-char (point-min)) 265 (goto-char (point-min))
@@ -244,6 +270,7 @@
244 270
245(ert-deftest thread-signal-early () 271(ert-deftest thread-signal-early ()
246 "Test signaling a thread as soon as it is started by the OS." 272 "Test signaling a thread as soon as it is started by the OS."
273 (skip-unless (fboundp 'make-thread))
247 (let ((thread 274 (let ((thread
248 (make-thread #'(lambda () 275 (make-thread #'(lambda ()
249 (while t (thread-yield)))))) 276 (while t (thread-yield))))))
@@ -263,7 +290,8 @@
263 (condition-wait threads-condvar))) 290 (condition-wait threads-condvar)))
264 291
265(ert-deftest threads-condvar-wait () 292(ert-deftest threads-condvar-wait ()
266 "test waiting on conditional variable" 293 "Test waiting on conditional variable."
294 (skip-unless (fboundp 'make-thread))
267 (let ((cv-mutex (make-mutex)) 295 (let ((cv-mutex (make-mutex))
268 new-thread) 296 new-thread)
269 ;; We could have spurious threads from the previous tests still 297 ;; We could have spurious threads from the previous tests still