From: Laurence Warne <laurencewarne@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: mattiase@acm.org, 73441@debbugs.gnu.org, Sam James <sam@gentoo.org>
Subject: bug#73441: 31.0.50; Unstable proced-refine-test failure
Date: Sat, 26 Oct 2024 16:44:27 +0100 [thread overview]
Message-ID: <CAE2oLqhZR0yL9RBpX-CMKkFpCv99stOGwc1m2di1BEiFfcnQMg@mail.gmail.com> (raw)
In-Reply-To: <87ldycjflg.fsf@gmx.de>
[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]
Hi Michael,
Thanks for taking a look! Ah I see, I thought that refining on the PID of
a process only filtered the buffer to show the process and it's direct
children but looking at 'proced-filter-children' this doesn't appear to be
the case.
I've attached a patch which changes the refinement tests to use the simpler
CPU refinement behaviour (keep everything with %CPU >= process at point),
which appears to work well.
On the downside, whilst running the new tests I noticed an occasional flake
with the 'proced-update-preserves-pid-at-point-test' test. Unfortunately I
still can't find the root cause after debugging it for a while so I've
marked it as unstable in the patch for now as well.
Thanks, Laurence
[-- Attachment #1.2: Type: text/html, Size: 916 bytes --]
[-- Attachment #2: 0001-Fix-flakey-proced-refine-tests-Bug-73441.patch --]
[-- Type: text/x-patch, Size: 4429 bytes --]
From 151d90f01a1eab26cd0c2ba14dbd2b0175d50645 Mon Sep 17 00:00:00 2001
From: Laurence Warne <laurencewarne@gmail.com>
Date: Sat, 26 Oct 2024 11:05:56 +0100
Subject: [PATCH] Fix flakey proced refine tests (Bug#73441)
* test/lisp/proced-tests.el (proced-refine-test)
(proced-refine-with-update-test): Use the much simpler CPU refinement
for testing 'proced-refine'. The previous tests made the incorrect
assumption that refining on the PID of process A only filtered the
buffer to contain process A and its children, whereas in actuality
the children of process A's children, their children, and so on will
also be shown.
(proced-update-preserves-pid-at-point-test): Mark as unstable.
---
test/lisp/proced-tests.el | 43 ++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el
index 6f16a241146..b612e172ffb 100644
--- a/test/lisp/proced-tests.el
+++ b/test/lisp/proced-tests.el
@@ -43,18 +43,14 @@ proced--assert-emacs-pid-in-buffer
(defun proced--move-to-column (attribute)
"Move to the column under ATTRIBUTE in the current proced buffer."
- (move-to-column (string-match attribute proced-header-line)))
-
-(defun proced--assert-process-valid-pid-refinement (pid)
- "Fail unless the process at point could be present after a refinement using PID."
- (proced--move-to-column "PID")
- (let ((pid-equal (string= pid (word-at-point))))
- (should
- (or pid-equal
- ;; Guard against the unlikely event a platform doesn't support PPID
- (when (string-match "PPID" proced-header-line)
- (proced--move-to-column "PPID")
- (string= pid (word-at-point)))))))
+ (move-to-column (string-match attribute proced-header-line))
+ ;; Sometimes the column entry does not fill the whole column.
+ (while (= (char-after (point)) ?\s) (forward-char)))
+
+(defun proced--assert-process-valid-cpu-refinement (cpu)
+ "Fail unless the process at point could be present after a refinement using CPU."
+ (proced--move-to-column "%CPU")
+ (should (>= (thing-at-point 'number) cpu)))
(ert-deftest proced-format-test ()
(dolist (format '(short medium long verbose))
@@ -85,26 +81,24 @@ proced-color-test
(proced--assert-emacs-pid-in-buffer))))
(ert-deftest proced-refine-test ()
- ;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin)))
(proced--within-buffer
'verbose
'user
- ;; When refining on PID for process A, a process is kept if and only
- ;; if its PID is the same as process A, or its parent process is
- ;; process A.
- (proced--move-to-column "PID")
- (let ((pid (word-at-point)))
+ ;; When refining on %CPU for process A, a process is kept if and only
+ ;; if its %CPU is greater than or equal to that of process A.
+ (proced--move-to-column "%CPU")
+ (let ((cpu (thing-at-point 'number)))
(proced-refine)
(while (not (eobp))
- (proced--assert-process-valid-pid-refinement pid)
+ (proced--assert-process-valid-cpu-refinement cpu)
(forward-line)))))
(ert-deftest proced-refine-with-update-test ()
(proced--within-buffer
'verbose
'user
- (proced--move-to-column "PID")
- (let ((pid (word-at-point)))
+ (proced--move-to-column "%CPU")
+ (let ((cpu (thing-at-point 'number)))
(proced-refine)
;; Don't use (proced-update t) since this will reset `proced-process-alist'
;; and it's possible the process refined on would have exited by that
@@ -112,10 +106,13 @@ proced-refine-with-update-test
;; processes again, causing the test to fail.
(proced-update)
(while (not (eobp))
- (proced--assert-process-valid-pid-refinement pid)
+ (proced--assert-process-valid-cpu-refinement cpu)
(forward-line)))))
(ert-deftest proced-update-preserves-pid-at-point-test ()
+ ;; FIXME: Occasionally the cursor inexplicably changes to the first line which
+ ;; causes the test to file when the line isn't the Emacs process.
+ :tags '(:unstable)
(proced--within-buffer
'medium
'user
@@ -128,7 +125,7 @@ proced-update-preserves-pid-at-point-test
(old-window (get-buffer-window)))
(select-window new-window)
(with-current-buffer "*Proced*"
- (proced-update t t))
+ (proced-update))
(select-window old-window)
(should (= pid (proced-pid-at-point)))))))
--
2.39.5
next prev parent reply other threads:[~2024-10-26 15:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 13:19 bug#73441: 31.0.50; Unstable proced-refine-test failure Sam James
2024-09-27 13:00 ` Laurence Warne
2024-10-15 14:52 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-25 16:46 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 15:44 ` Laurence Warne [this message]
2024-10-26 16:59 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 11:16 ` Laurence Warne
2024-10-27 11:47 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 12:07 ` Eli Zaretskii
2024-10-27 15:53 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-29 7:51 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-29 21:26 ` Laurence Warne
2024-10-30 14:15 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30 18:25 ` Laurence Warne
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=CAE2oLqhZR0yL9RBpX-CMKkFpCv99stOGwc1m2di1BEiFfcnQMg@mail.gmail.com \
--to=laurencewarne@gmail.com \
--cc=73441@debbugs.gnu.org \
--cc=mattiase@acm.org \
--cc=michael.albinus@gmx.de \
--cc=sam@gentoo.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.