[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 586bdd6f9a5: Fix unstable Proced refine tests
From: |
Eli Zaretskii |
Subject: |
master 586bdd6f9a5: Fix unstable Proced refine tests |
Date: |
Wed, 26 Jul 2023 10:09:43 -0400 (EDT) |
branch: master
commit 586bdd6f9a522b2e0a9e701c9b2079095e880180
Author: Laurence Warne <laurencewarne@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix unstable Proced refine tests
* test/lisp/proced-tests.el (proced-refine-test)
(proced-refine-with-update-test): Also check if the parent
process id of each process matches the process id refined
on before failing, since the refiner for process id returns
the children of a process in addition to the process itself.
(Bug#64800)
---
test/lisp/proced-tests.el | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el
index d53f25b00d8..bffbf5486d3 100644
--- a/test/lisp/proced-tests.el
+++ b/test/lisp/proced-tests.el
@@ -44,6 +44,17 @@
"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 refinment 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)))))))
+
(ert-deftest proced-format-test ()
(dolist (format '(short medium long verbose))
(proced--within-buffer
@@ -75,22 +86,21 @@
(ert-deftest proced-refine-test ()
;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin)))
(proced--within-buffer
- 'medium
+ 'verbose
'user
;; When refining on PID for process A, a process is kept if and only
- ;; if its PID are the same as process A, which more or less guarentees
- ;; the refinement will remove some processes.
+ ;; 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)))
(proced-refine)
(while (not (eobp))
- (proced--move-to-column "PID")
- (should (string= pid (word-at-point)))
+ (proced--assert-process-valid-pid-refinement pid)
(forward-line)))))
(ert-deftest proced-refine-with-update-test ()
(proced--within-buffer
- 'medium
+ 'verbose
'user
(proced--move-to-column "PID")
(let ((pid (word-at-point)))
@@ -101,8 +111,7 @@
;; processes again, causing the test to fail.
(proced-update)
(while (not (eobp))
- (proced--move-to-column "PID")
- (should (string= pid (word-at-point)))
+ (proced--assert-process-valid-pid-refinement pid)
(forward-line)))))
(ert-deftest proced-update-preserves-pid-at-point-test ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 586bdd6f9a5: Fix unstable Proced refine tests,
Eli Zaretskii <=