[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/datetime 9ae65d8e7b 106/147: Improve `datetime--test' to p
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/datetime 9ae65d8e7b 106/147: Improve `datetime--test' to print last sent (or to be sent) commands on any error. |
Date: |
Fri, 31 Jan 2025 07:00:10 -0500 (EST) |
branch: elpa/datetime
commit 9ae65d8e7bde29a2c3cb8bbbd8648f71a5e29a66
Author: Paul Pogonyshev <pogonyshev@gmail.com>
Commit: Paul Pogonyshev <pogonyshev@gmail.com>
Improve `datetime--test' to print last sent (or to be sent) commands on any
error.
---
test/base.el | 92 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 50 insertions(+), 42 deletions(-)
diff --git a/test/base.el b/test/base.el
index 4064e1e4fc..59c9fdad6c 100644
--- a/test/base.el
+++ b/test/base.el
@@ -40,48 +40,56 @@
(defun datetime--test (command times)
(unless (listp times)
(setq times (list times)))
- (unless (process-live-p datetime--test-java-process)
- (let ((default-directory datetime--test-directory)
- (stderr (get-buffer-create "java-benchmark/stderr")))
- (with-current-buffer stderr
- (erase-buffer))
- (setq datetime--test-java-process (make-process :name "java-benchmark"
:buffer "java-benchmark" :stderr stderr
- :command '("java"
"ProcessTimestamp")))))
- (let* ((marker (process-mark datetime--test-java-process))
- (position (marker-position marker))
- (num-times (length times))
- (num-result-lines 0)
- result
- successful)
- (unwind-protect
- (with-current-buffer (marker-buffer marker)
- ;; It is much faster to give "tasks" to the remote process in
- ;; batch, then fetch the results.
- (dolist (time times)
- (process-send-string datetime--test-java-process
- (format "%s %s\n%s %s %s\n" command time
datetime--test-timezone datetime--test-locale datetime--test-pattern)))
- (while (< num-result-lines num-times)
- (while (or (= (marker-position marker) position) (/= (char-before
marker) ?\n))
- (accept-process-output datetime--test-java-process))
- (unless (process-live-p datetime--test-java-process)
- (error "ProcessTimestamp process exited unexpectedly with code
%d:\n%s"
- (process-exit-status datetime--test-java-process)
(with-current-buffer "java-benchmark/stderr" (buffer-string))))
- (while (> (marker-position marker) position)
- (goto-char position)
- (end-of-line)
- (let ((as-string (buffer-substring position (point))))
- (push (if (eq command 'format) as-string (car
(read-from-string as-string))) result))
- (beginning-of-line 2)
- (setq position (point)
- num-result-lines (1+ num-result-lines))))
- (setf successful t)
- (nreverse result))
- (unless successful
- (message "stderr of `java-benchmark':\n%s"
- (condition-case error
- (with-current-buffer "java-benchmark/stderr"
- (if (bobp) "[empty]" (buffer-string)))
- (error (format "[failed to retrieve: %S]" error))))))))
+ (with-temp-buffer
+ (let ((commands (current-buffer))
+ (stderr (get-buffer-create " java-benchmark/stderr")))
+ (unless (process-live-p datetime--test-java-process)
+ (let ((default-directory datetime--test-directory))
+ (with-current-buffer stderr
+ (erase-buffer))
+ (setq datetime--test-java-process (make-process :name
"java-benchmark" :buffer "java-benchmark" :stderr stderr
+ :command '("java"
"ProcessTimestamp")))))
+ (let* ((marker (process-mark datetime--test-java-process))
+ (position (marker-position marker))
+ (num-times (length times))
+ (num-result-lines 0)
+ result
+ successful)
+ (unwind-protect
+ (with-current-buffer (marker-buffer marker)
+ ;; It is much faster to give "tasks" to the remote process in
+ ;; batch, then fetch the results.
+ (with-current-buffer commands
+ (dolist (time times)
+ (insert (format "%s %s\n%s %s %s\n" command time
datetime--test-timezone datetime--test-locale datetime--test-pattern))))
+ (process-send-string datetime--test-java-process
(with-current-buffer commands (buffer-string)))
+ (while (< num-result-lines num-times)
+ (while (or (= (marker-position marker) position) (/=
(char-before marker) ?\n))
+ (accept-process-output datetime--test-java-process))
+ (unless (process-live-p datetime--test-java-process)
+ (error "ProcessTimestamp process exited unexpectedly with
code %d:\n%s"
+ (process-exit-status datetime--test-java-process)
(with-current-buffer stderr (buffer-string))))
+ (while (> (marker-position marker) position)
+ (goto-char position)
+ (end-of-line)
+ (let ((as-string (buffer-substring position (point))))
+ (push (if (eq command 'format) as-string (car
(read-from-string as-string))) result))
+ (beginning-of-line 2)
+ (setq position (point)
+ num-result-lines (1+ num-result-lines))))
+ (setf successful t)
+ (nreverse result))
+ (unless successful
+ (message "stderr of `java-benchmark':\n%s"
+ (condition-case error
+ (with-current-buffer stderr
+ (if (bobp) "[empty]" (buffer-string)))
+ (error (format "[failed to retrieve: %S]" error))))
+ (message "command(s) to be sent or have been sent to
`java-benchmark' last:\n%s"
+ (condition-case error
+ (with-current-buffer commands
+ (if (bobp) "[none]" (buffer-string)))
+ (error (format "[failed to retrieve: %S]"
error))))))))))
(provide 'test/base)
- [nongnu] elpa/datetime 32f62080f4 081/147: Fix building of parsing regexp in case there are run-together numeric groups in the pattern., (continued)
- [nongnu] elpa/datetime 32f62080f4 081/147: Fix building of parsing regexp in case there are run-together numeric groups in the pattern., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime afd711ce3d 083/147: Update copyright notices to include 2022., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 10d55deb5b 082/147: Also test on Emacs 28.1., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime cdbf529935 093/147: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 8b23c11eef 096/147: Bump actions/setup-java from 2 to 3, ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 2f8037f0ba 103/147: Implement timezone offset formatting (currently, only 'Z' in a Java pattern)., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 6762715a79 094/147: Enable Dependabot., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 462015a50d 108/147: Implement timezone offset parsing for all the various formats at once., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 58b7ac95ad 111/147: Fix a typo in `datetime-matching-regexp's support of eras, leading to eras never being matched at all., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 551e905ea5 115/147: Link to the latest release in the documentation., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 9ae65d8e7b 106/147: Improve `datetime--test' to print last sent (or to be sent) commands on any error.,
ELPA Syncer <=
- [nongnu] elpa/datetime 30bc4823bc 116/147: Expand documentation somewhat to include list of Java pattern elements and some examples., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 38a85cb352 121/147: Fix another bug in 'HarvestData' tool; no effect currently, but would be uncovered by future changes., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 9ff5066539 129/147: And yet another fix for 'HarvestData', for a bug that would be uncovered by future changes., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 348628bc3f 122/147: Reenable testing on macOS., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 51430e5c90 132/147: Make `datetime--determine-system-timezone` work on macOS (issue #11)., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 3d27814a09 133/147: Update copyright notices to include 2024., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime bde4287c1d 141/147: Improve CI workflow so that it is obvious when the problem is in byte-compilation and not in failing tests., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 388741774d 144/147: Use Emacs 29.3 instead of 29.1 for CI on Windows, in hope that weird charset(?)-related problems would be gone., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime a71c4abd79 139/147: Post-release version bump., ELPA Syncer, 2025/01/31
- [nongnu] elpa/datetime 38f0e180ae 147/147: Post-release version bump., ELPA Syncer, 2025/01/31