branch: externals/hyperbole
commit 38110ee8f77c226d069c57968107ff2c930f2843
Author: bw <[email protected]>
Commit: bw <[email protected]>
Makefile - Change running of ert tests from interactively to batch
This puts backtraces for test failures into the *Messages* buffer
for quick issue resolution.
---
ChangeLog | 14 ++++++++++++++
Makefile | 12 ++++++------
test/hib-kbd-tests.el | 9 +++------
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1f4c750361..1a63095476 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-01-05 Bob Weiner <[email protected]>
+
+* Makefile (test-all): Change 'ert-run-tests-interactively' to
+ 'ert-run-tests-batch' because this shows tracebacks of any tests that
+ fail in the *Messages* buffer, speeding debugging. Although it does
+ have the side-effect of not producing the interactive *ert* buffer that
+ lets you jump to test source. However, you can paste the test results
+ into another Emacs and use Hyperbole to jump to test/symbol definitions.
+ (test-all-output): Save outputs including backtraces written
+ to *Messages* buffer in file "ERT-OUTPUT".
+
+* test/hib-kbd-tests.el (kbd-key-hy-demo-factorial-test): Remove use of *ert*
+ buffer which may not exist if run in batch mode.
+
* hyrolo.el (hyrolo-any-file-type-problem-p): If problem occurs within a 'let',
then show backtrace so know where the let-binding was set.
diff --git a/Makefile b/Makefile
index 291cf6300a..b1f97d9d99 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
# Author: Bob Weiner
#
# Orig-Date: 15-Jun-94 at 03:42:38
-# Last-Mod: 3-Jan-24 at 03:06:38 by Bob Weiner
+# Last-Mod: 5-Jan-24 at 02:24:26 by Bob Weiner
#
# Copyright (C) 1994-2023 Free Software Foundation, Inc.
# See the file HY-COPY for license information.
@@ -464,7 +464,7 @@ packageclean:
tests: test
test: test-ert
-# enable-local-variables setting needed so local-variables set in files like
+# enable-local-variables setting needed so local variables set in files like
# FAST-DEMO are automatically obeyed without prompting when testing.
LET_VARIABLES = (auto-save-default) (enable-local-variables :all)
LOAD_TEST_ERT_FILES=$(patsubst %,(load-file \"%\"),${TEST_ERT_FILES})
@@ -479,19 +479,19 @@ test-all:
ifeq ($(TERM), dumb)
ifneq (,$(findstring .apple.,$(DISPLAY)))
# Found, on MacOS
- TERM=xterm-256color $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ((auto-save-default))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-interactively t))"
+ TERM=xterm-256color $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ((auto-save-default))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-batch t) (switch-to-buffer
\"*Messages*\"))"
else
# Not found, set TERM so tests will at least run within parent Emacs
session
- TERM=vt100 $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-interactively t))"
+ TERM=vt100 $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-batch t) (switch-to-buffer
\"*Messages*\"))"
endif
else
# Typical case, run emacs normally
- $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-interactively t))"
+ $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES))
$(LOAD_TEST_ERT_FILES) (ert-run-tests-batch t) (switch-to-buffer
\"*Messages*\"))"
endif
batch-tests: test-all-output
test-all-output:
- $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES) (ert-quiet
t)) $(LOAD_TEST_ERT_FILES) (ert-run-tests-interactively t) (with-current-buffer
\"*ert*\" (append-to-file (point-min) (point-max) \"ERT-OUTPUT\"))
(kill-emacs))"
+ $(EMACS) --quick $(PRELOADS) --eval "(load-file
\"test/hy-test-dependencies.el\")" --eval "(let ($(LET_VARIABLES) (ert-quiet
t)) $(LOAD_TEST_ERT_FILES) (ert-run-tests-batch t) (with-current-buffer
\"*Messages*\" (append-to-file (point-min) (point-max) \"ERT-OUTPUT\"))
(kill-emacs))"
@echo "# Results written to file: ERT-OUTPUT"
# Hyperbole install tests - Verify that hyperbole can be installed
diff --git a/test/hib-kbd-tests.el b/test/hib-kbd-tests.el
index 87f50c4769..74c67b824e 100644
--- a/test/hib-kbd-tests.el
+++ b/test/hib-kbd-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 25-Dec-23 at 23:30:20 by Mats Lidell
+;; Last-Mod: 5-Jan-24 at 02:08:48 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -26,6 +26,7 @@
(declare-function hy-test-helpers:should-last-message "hy-test-helpers")
(ert-deftest kbd-key-hy-about-test ()
+ "Test if HY-ABOUT file is displayed properly from the Hyperbole menus."
(skip-unless (not noninteractive))
(unwind-protect
(progn
@@ -35,14 +36,10 @@
(kill-buffer "HY-ABOUT")))
(ert-deftest kbd-key-hy-demo-factorial-test ()
+ "Test if factorial button from DEMO file works properly."
(skip-unless (not noninteractive))
(unwind-protect
(let ((enable-local-variables nil))
- ;; Preload demo files to avoid race with *ert* buffer and set
- ;; *ert* buffer current
- (hypb:display-file-with-logo "DEMO")
- (set-buffer "*ert*")
-
(should (hact 'kbd-key "C-u C-h h d d"))
(hy-test-helpers:consume-input-events)
(should (string= (buffer-name (current-buffer)) "DEMO"))