Skip to content

Commit

Permalink
mk: Add make target "repro" for easy bug testing
Browse files Browse the repository at this point in the history
* mk/default.mk (REPRO_DEBUG): New custom variable enabling extra
debugging facilities in Emacs instance open by make repro.
(REPRO_ARGS): Extra arguments passed to Emacs by make repro.
(REPRO_INIT):
(REPRO): Define Emacs cmd for testing.
* mk/targets.mk (.PHONY):
(repro): Add new target.
* doc/org-manual.org (Feedback): Describe the new make target.
  • Loading branch information
yantar92 committed Jul 22, 2022
1 parent 99681ce commit b713b9a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions doc/org-manual.org
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ shown below.
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
#+end_src

If you are using Org mode version from Git repository, you can start
minimal session using make.

: # Bare Emacs
: make repro
: # or pass extra arguments
: make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org"

If an error occurs, a "backtrace" can be very useful---see below on
how to create one. Often a small example file helps, along with clear
information about:
Expand Down
21 changes: 21 additions & 0 deletions mk/default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave perl python
# extra packages to require for testing
BTEST_EXTRA =
# ess-site # load ESS for R tests
# Whether to activate extra debugging facilities for make repro.
REPRO_DEBUG ?= yes
# Extra arguments passed to Emacs for make repro.
# e.g. -l config.el /tmp/bug.org
REPRO_ARGS ?=
##->8-------------------------------------------------------------------
## YOU MAY NEED TO ADAPT THESE DEFINITIONS
##----------------------------------------------------------------------
Expand Down Expand Up @@ -93,6 +98,22 @@ BTEST = $(BATCH) $(BTEST_INIT) \
# should be useful for manual testing and verification of problems.
NOBATCH = $(EMACSQ) $(BTEST_INIT) -l org -f org-version

ifeq ($(REPRO_DEBUG), yes)
REPRO_INIT = --eval "(setq \
debug-on-error t\
debug-on-signal nil\
debug-on-quit nil\
org-element--cache-self-verify 'backtrace\
org-element--cache-self-verify-frequency 1.0\
org-element--cache-map-statistics t)"
else
REPRO_INIT =
endif

# Running a plain emacs with no config, this Org mode loaded, and
# debugging facilities activated.
REPRO = $(NOBATCH) $(REPRO_INIT) $(REPRO_ARGS)

# start Emacs with no user and site configuration
# EMACSQ = -vanilla # XEmacs
EMACSQ = $(EMACS) -Q
Expand Down
5 changes: 4 additions & 1 deletion mk/targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif
cleanlisp cleandoc cleandocs cleantest \
compile compile-dirty uncompiled \
config config-test config-exe config-all config-eol config-version \
vanilla
vanilla repro

CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
CONF_DEST = lispdir infodir datadir testdir
Expand Down Expand Up @@ -132,6 +132,9 @@ $(INSTSUB):
autoloads: lisp
$(MAKE) -C $< $@

repro: cleanall autoloads
-@$(REPRO) &

cleandirs:
$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)

Expand Down

0 comments on commit b713b9a

Please sign in to comment.