branch: externals/plz
commit 4736d5242ab5b2e40ca5d50d9c8380e2ee0d49b1
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>
Tests: (plz-test-wait) Change to function, test process argument
I'm not sure if the recent changes I made caused a race condition of
some kind (whether in the library or just the tests), but this seems
to fix the tests that were failing, and it didn't need to be a macro,
anyway.
---
tests/test-plz.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 10812b06d9..6cc3f3397f 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -43,11 +43,18 @@
;;;; Macros
-(cl-defmacro plz-test-wait (process &optional (seconds 0.1) (times 100))
+(cl-defun plz-test-wait (process &optional (seconds 0.1) (times 100))
"Wait for SECONDS seconds TIMES times for PROCESS to finish."
- `(cl-loop for i upto ,times ;; 10 seconds
- while (equal 'run (process-status ,process))
- do (sleep-for ,seconds)))
+ (when process
+ ;; Sometimes it seems that the process is killed, the THEN
+ ;; function called by its sentinel, and its buffer killed, all
+ ;; before this function gets called with the process argument;
+ ;; when that happens, tests that use this can fail. Testing
+ ;; whether PROCESS is non-nil seems to fix it, but it's possible
+ ;; that something funny is going on...
+ (cl-loop for i upto times ;; 10 seconds
+ while (equal 'run (process-status process))
+ do (sleep-for seconds))))
;;;; Functions