unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Laurence Warne <laurencewarne@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: contovob@tcd.ie, mattias.engdegard@gmail.com, 63550@debbugs.gnu.org
Subject: bug#63550: proced-refine-with-update-test is racy
Date: Sun, 21 May 2023 19:45:16 +0100	[thread overview]
Message-ID: <CAE2oLqiVzn_+Efj-yUZf959VZezXO2wjmaurrRcUvFYZ17p_xw@mail.gmail.com> (raw)
In-Reply-To: <83pm6uq6c9.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1369 bytes --]

One thing I've noticed about the failing test is that we should probably
use `(proced-update)` instead of `(proced-update t)` so as not to refresh
`proced-process-alist` (I've attached a patch).  When I first saw this, I
thought this would fix the failure as I thought what might have been
happening was that the process used for the refinement might have exited
between proced being called, and then `(proced-update t)` being called, but
I think the test should still pass in this case (though I've optimistically
used 'fix' in the patch commit (: ).

Mattias (or Basil), are you able to provide a backtrace?

> Is mocking out the real Proced display a good idea in this case?
> These tests test the ability to manipulate real-life process-attribute
> displays, so showing they work in synthetic environment verifies only
> part of the functionality, no?

Since systems will likely have a variety of processes running at a time, I
think you are right, mocking will result in less coverage, but then again
the processes and their attributes people have running on their machines
are not consistent.  Perhaps we could use mocking, but only for features
which are difficult to test otherwise, like refinements?

Maybe I was too fast to jump to using mocking and it's tangential to this
issue, though I'd still be interested to see if the (mocking patch) fixes
the issue.

[-- Attachment #1.2: Type: text/html, Size: 1581 bytes --]

[-- Attachment #2: 0001-Fix-unstable-proced-test.patch --]
[-- Type: text/x-patch, Size: 1144 bytes --]

From 59782731876e62898ee3ee2a912c935bf6b21254 Mon Sep 17 00:00:00 2001
From: Laurence Warne <laurencewarne@gmail.com>
Date: Sun, 21 May 2023 18:59:43 +0100
Subject: [PATCH] Fix unstable proced test

Fix unstable proced test by omitting the revert parameter in
'proced-update'.

* test/lisp/proced-tests.el (proced-refine-with-update-test): Do not
use revert parameter when calling 'proced-update'.
---
 test/lisp/proced-tests.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el
index d69414cf43a..fa65772076f 100644
--- a/test/lisp/proced-tests.el
+++ b/test/lisp/proced-tests.el
@@ -89,14 +89,13 @@ proced-refine-test
        (forward-line)))))
 
 (ert-deftest proced-refine-with-update-test ()
-  :tags '(:unstable)   ; There seems to be an update race here.
   (proced--within-buffer
    'medium
    'user
    (proced--move-to-column "PID")
    (let ((pid (word-at-point)))
      (proced-refine)
-     (proced-update t)
+     (proced-update)
      (while (not (eobp))
        (proced--move-to-column "PID")
        (should (string= pid (word-at-point)))
-- 
2.30.2


  reply	other threads:[~2023-05-21 18:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17  9:38 bug#63550: proced-refine-with-update-test is racy Mattias Engdegård
2023-05-17 11:44 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21  8:37   ` Laurence Warne
2023-05-21 11:20     ` Eli Zaretskii
2023-05-21 18:45       ` Laurence Warne [this message]
2023-05-24  7:56         ` Mattias Engdegård
2023-05-27 19:14           ` Laurence Warne
2023-05-28 11:39             ` Mattias Engdegård

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE2oLqiVzn_+Efj-yUZf959VZezXO2wjmaurrRcUvFYZ17p_xw@mail.gmail.com \
    --to=laurencewarne@gmail.com \
    --cc=63550@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=eliz@gnu.org \
    --cc=mattias.engdegard@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).