all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <Michael.Albinus@gmx.de>
To: Andrea Corallo <acorallo@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Flickering tests
Date: Fri, 05 Jul 2024 09:36:32 +0200	[thread overview]
Message-ID: <87bk3c70jj.fsf@gmx.de> (raw)
In-Reply-To: <yp134oqjq7n.fsf@fencepost.gnu.org> (Andrea Corallo's message of "Wed, 03 Jul 2024 14:16:44 -0400")

[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]

Andrea Corallo <acorallo@gnu.org> writes:

Hi Andrea,

> Mmmh not sure is possible but also desirable, we want to be able to run
> as many tests as possible even with -jN.

Last days, I've digged further into this. I still couldn't provoke the
error (my machine has only 8 processing units). However, ...

>> Btw, could you check whether the D-Bus tests flickery goes away if we
>> tag dbus-test05-register-signal-with-nils as :unstable?
>
> From the bunch of test I did seems this is solving, I'll mark it as
> :unstable for now till a better solution is found.

... I've found suspicious code in this test. Usually, all tests work
deterministic. A method call or a signal is raised, and the returned
message from D-Bus is analyzed. But in this test, a signal handler with
a wildcard filter is registered. That means, *any* signal from D-Bus is
catched, also signals which aren't relevant for this test. The more
pressure you give on the system ("make -j96"), the more likely it is.

So I have modified the signal handler to handle only signals we're
interested in. See the appended patch. Could you, pls, check whether it
helps? I guess we need it only in the master branch, because the problem
appears only in dbus-test.el. dbusbind.c and dbus.el are OK.

> Thanks
>
>   Andrea

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2851 bytes --]

diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index b3337132fb6..0e0996b373e 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,28 @@ 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
+    (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."
@@ -804,6 +820,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
@@ -842,6 +866,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 ()

  reply	other threads:[~2024-07-05  7:36 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 [this message]
2024-07-09  8:39             ` Andrea Corallo
2024-07-09  8:49               ` Michael Albinus
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=87bk3c70jj.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.