From: Michael Albinus <Michael.Albinus@gmx.de>
To: Andrea Corallo <acorallo@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Flickering tests
Date: Tue, 09 Jul 2024 10:49:32 +0200 [thread overview]
Message-ID: <87wmlvvtk3.fsf@gmx.de> (raw)
In-Reply-To: <yp1a5irez7e.fsf@fencepost.gnu.org> (Andrea Corallo's message of "Tue, 09 Jul 2024 04:39:33 -0400")
[-- Attachment #1: Type: text/plain, Size: 710 bytes --]
Andrea Corallo <acorallo@gnu.org> writes:
> Hi Michael,
Hi Andrea,
> I tried your patch and seems to solve (for my few tries at least). But
> why do you think we need it only on master? Before being marked as
> unstable the test was flickering on emacs-30 as well.
The test isn't super-important, filtering it out on the emacs-30 branch
by tagging it :unstable doesn't matter really. I've proposed this,
because the emacs-30 branch should be kept stable. But if you like, I
could install it there.
Note, that I have improved the patch meanwhile. The test
dbus-test08-register-monitor seems to be vulnerable as well. The patch
looks meanwhile as appended.
> Thanks
>
> Andrea
Best regards, Michael.
[-- Attachment #2: Type: text/x-patch, Size: 5611 bytes --]
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index a217c92b1f7..78ae79b8711 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -25,7 +25,7 @@
(require 'ert-x)
(require 'dbus)
-(defvar dbus-debug nil)
+(defvar dbus-debug)
(declare-function dbus-get-unique-name "dbusbind.c" (bus))
(defconst dbus--test-enabled-session-bus
@@ -732,12 +732,29 @@ dbus-test04-call-method-timeout
;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
+(defvar dbus--test-event-expected nil
+ "The expected event in `dbus--test-signal-handler'.")
+
(defvar dbus--test-signal-received nil
"Received signal value in `dbus--test-signal-handler'.")
(defun dbus--test-signal-handler (&rest args)
"Signal handler for `dbus-test*-signal' and `dbus-test08-register-monitor'."
- (setq dbus--test-signal-received args))
+ (ignore-error dbus-error
+ (message "%S" last-input-event)
+ (let ((last-input-event last-input-event))
+ (when (or (null dbus--test-event-expected)
+ (and (equal (dbus-event-bus-name last-input-event)
+ (dbus-event-bus-name dbus--test-event-expected))
+ (equal (dbus-event-message-type last-input-event)
+ (dbus-event-message-type dbus--test-event-expected))
+ (equal (dbus-event-service-name last-input-event)
+ (dbus-event-service-name dbus--test-event-expected))
+ (equal (dbus-event-path-name last-input-event)
+ (dbus-event-path-name dbus--test-event-expected))
+ (equal (dbus-event-member-name last-input-event)
+ (dbus-event-member-name dbus--test-event-expected))))
+ (setq dbus--test-signal-received args)))))
(defun dbus--test-timeout-handler (&rest _ignore)
"Timeout handler, reporting a failed test."
@@ -796,7 +813,6 @@ dbus-test05-register-signal-with-nils
"Check signal registration for an own service.
SERVICE, PATH, INTERFACE and SIGNAL are ‘nil’. This is interpreted as a
wildcard for the respective argument."
- :tags '(:unstable)
(skip-unless dbus--test-enabled-session-bus)
(dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))
@@ -805,6 +821,14 @@ dbus-test05-register-signal-with-nils
(handler #'dbus--test-signal-handler)
registered)
+ ;; Filter received signals in signal handler.
+ (setq dbus--test-event-expected
+ `(dbus-event :session ,dbus-message-type-signal
+ 0 ;; Serial number doesn't matter.
+ ,(dbus-get-unique-name :session)
+ nil ;; Destination doesn't matter.
+ ,dbus--test-path ,dbus--test-interface ,member ,handler))
+
;; Register signal handler.
(should
(equal
@@ -843,6 +867,7 @@ dbus-test05-register-signal-with-nils
(should-not (dbus-unregister-object registered)))
;; Cleanup.
+ (setq dbus--test-event-expected nil)
(dbus-unregister-service :session dbus--test-service)))
(ert-deftest dbus-test06-register-property ()
@@ -1934,19 +1959,32 @@ dbus-test08-register-monitor
(skip-unless dbus--test-enabled-session-bus)
(unwind-protect
- (let (registered)
+ (let ((member "Member")
+ (handler #'dbus--test-signal-handler)
+ registered)
+
+ ;; Filter received signals in signal handler.
+ (setq dbus--test-event-expected
+ `(dbus-event :session-private ,dbus-message-type-signal
+ 0 ;; Serial number doesn't matter.
+ ,(dbus-get-unique-name :session)
+ nil ;; Destination doesn't matter.
+ ,dbus--test-path ,dbus--test-interface ,member ,handler))
+
+ ;; Register monitor.
(should
(equal
- (setq registered
- (dbus-register-monitor :session #'dbus--test-signal-handler))
- '((:monitor :session-private)
- (nil nil dbus--test-signal-handler))))
+ (setq
+ registered
+ (dbus-register-monitor :session handler))
+ `((:monitor :session-private)
+ (nil nil ,handler))))
;; Send a signal, shall be traced.
(setq dbus--test-signal-received nil)
(dbus-send-signal
:session dbus--test-service dbus--test-path
- dbus--test-interface "Foo" "foo")
+ dbus--test-interface member "foo")
(with-timeout (1 (dbus--test-timeout-handler))
(while (null dbus--test-signal-received)
(read-event nil nil 0.1)))
@@ -1959,13 +1997,18 @@ dbus-test08-register-monitor
(setq dbus--test-signal-received nil)
(dbus-send-signal
:session dbus--test-service dbus--test-path
- dbus--test-interface "Foo" "foo")
+ dbus--test-interface member "foo")
(with-timeout (1 (ignore))
(while (null dbus--test-signal-received)
(read-event nil nil 0.1)))
- (should-not dbus--test-signal-received))
+ (should-not dbus--test-signal-received)
+
+ ;; Unregister monitor.
+ ;; TODO: This seems to be a noop. And it returns nil.
+ (dbus-unregister-object registered))
;; Cleanup.
+ (setq dbus--test-event-expected nil)
(dbus-unregister-service :session dbus--test-service)))
(ert-deftest dbus-test09-get-managed-objects ()
next prev parent reply other threads:[~2024-07-09 8:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 9:47 Flickering tests Andrea Corallo
2024-07-02 12:43 ` Andrea Corallo
2024-07-03 1:47 ` john muhl
2024-07-03 7:25 ` Andrea Corallo
2024-07-03 20:14 ` Stefan Kangas
2024-07-04 19:41 ` john muhl
2024-07-02 14:28 ` Michael Albinus
2024-07-02 15:25 ` Andrea Corallo
2024-07-03 14:52 ` Andrea Corallo
2024-07-03 15:39 ` Michael Albinus
2024-07-03 18:16 ` Andrea Corallo
2024-07-05 7:36 ` Michael Albinus
2024-07-09 8:39 ` Andrea Corallo
2024-07-09 8:49 ` Michael Albinus [this message]
2024-07-09 9:47 ` Andrea Corallo
2024-07-09 10:47 ` Michael Albinus
2024-07-09 12:30 ` Andrea Corallo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wmlvvtk3.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=acorallo@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.