[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d5f9a07 4/4: Add D-Bus method-call reentrant test
From: |
Michael Albinus |
Subject: |
master d5f9a07 4/4: Add D-Bus method-call reentrant test |
Date: |
Wed, 30 Sep 2020 05:27:37 -0400 (EDT) |
branch: master
commit d5f9a07862b941a53f89e6016594daee6560ff84
Author: Hugh Daschbach <hdasch@fastmail.com>
Commit: Michael Albinus <michael.albinus@gmx.de>
Add D-Bus method-call reentrant test
* test/lisp/net/dbus-tests.el (dbus--tests-method-reentry-handler):
New defun.
(dbus-test04-method-reentry): New test. (Bug#43251)
---
test/lisp/net/dbus-tests.el | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index e0c63b2..3e70475 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -632,6 +632,40 @@ This includes initialization and closing the bus."
;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
+(defun dbus--test-method-reentry-handler (&rest args)
+ "Method handler for `dbus-test04-method-reentry'."
+ (dbus-get-all-managed-objects :session dbus--test-service dbus--test-path)
+ 42)
+
+(ert-deftest dbus-test04-method-reentry ()
+ "Check receiving method call while awaiting response.
+Ensure that incoming method calls are handled when call to `dbus-call-method'
+is in progress."
+ ;; Simulate application registration (Bug#43251)
+ (skip-unless dbus--test-enabled-session-bus)
+ (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))
+
+ (unwind-protect
+ (let ((method "Rentry"))
+ (should
+ (equal
+ (dbus-register-method
+ :session dbus--test-service dbus--test-path
+ dbus--test-interface method #'dbus--test-method-reentry-handler)
+ `((:method :session ,dbus--test-interface ,method)
+ (,dbus--test-service ,dbus--test-path
+ dbus--test-method-reentry-handler))))
+
+ (should
+ (=
+ (dbus-call-method
+ :session dbus--test-service dbus--test-path
+ dbus--test-interface method)
+ 42)))
+
+ ;; Cleanup.
+ (dbus-unregister-service :session dbus--test-service)))
+
(ert-deftest dbus-test04-call-method-timeout ()
"Verify `dbus-call-method' request timeout."
:tags '(:expensive-test)