1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
* Tests
** Running
Somehow I can never remember how to ask =make= how to run a specific
set of tests.
tl;dr, running =$testcases_regexp= from =test/$testfile.el=, to test
changes in =lisp/$sourcefile.el=:
#+begin_src sh
make -C test $testfile \
TEST_LOAD_EL=yes \
TEST_BACKTRACE_LINE_LENGTH=nil \
SELECTOR="\"$testcases_regexp\"" \
EMACS_EXTRAOPT="-l ../lisp/$sourcefile.el"
#+end_src
Relevant bits from test/Makefile:
#+begin_src makefile
## filename.log: run tests from filename.el(c) if .log file needs updating
## filename: re-run tests from filename.el(c), with no logging
#+end_src
#+begin_src makefile
# Whether to run tests from .el files in preference to .elc, we do
# this by default since it gives nicer stacktraces.
# If you just want a pass/fail, setting this to no is much faster.
export TEST_LOAD_EL ?= \
$(if $(findstring $(MAKECMDGOALS), all check check-maybe),no,yes)
#+end_src
#+begin_src makefile
TEST_RUN_ERT = --batch --eval '(ert-run-tests-batch-and-exit (quote ${SELECTOR_ACTUAL}))' ${WRITE_LOG}
#+end_src
#+begin_src makefile
ifdef SELECTOR
SELECTOR_ACTUAL=$(SELECTOR)
#+end_src
Selector documentation from ~ert-select-tests~:
#+begin_quote
Valid SELECTORs:
nil -- Selects the empty set.
t -- Selects UNIVERSE.
:new -- Selects all tests that have not been run yet.
:failed, :passed -- Select tests according to their most recent result.
:expected, :unexpected -- Select tests according to their most recent result.
a string -- A regular expression selecting all tests with matching names.
a test -- (i.e., an object of the ert-test data-type) Selects that test.
a symbol -- Selects the test that the symbol names, signals an
‘ert-test-unbound’ error if none.
(member TESTS...) -- Selects the elements of TESTS, a list of tests
or symbols naming tests.
(eql TEST) -- Selects TEST, a test or a symbol naming a test.
(and SELECTORS...) -- Selects the tests that match all SELECTORS.
(or SELECTORS...) -- Selects the tests that match any of the SELECTORS.
(not SELECTOR) -- Selects all tests that do not match SELECTOR.
(tag TAG) -- Selects all tests that have TAG on their tags list.
A tag is an arbitrary label you can apply when you define a test.
(satisfies PREDICATE) -- Selects all tests that satisfy PREDICATE.
PREDICATE is a function that takes an ert-test object as argument,
and returns non-nil if it is selected.
#+end_quote
* Third-party packages
** forge
*** build
Use =config.mk= to set =LOAD_PATH=:
#+begin_src makefile
find-lib = $(dir $(shell emacs -Q -batch \
-eval "(require 'find-func)" \
-eval "(package-initialize)" \
-eval "(require '$(1))" \
-eval "(princ (find-library-name \"$(1)\"))"))
sources = ~/src/emacs/magit/lisp
elpa = \
closql \
compat \
dash \
emacsql \
ghub \
markdown-mode \
transient \
treepy \
with-editor \
yaml
elpa_dirs = $(foreach d,$(elpa),$(call find-lib,$(d)))
LOAD_PATH = $(addprefix -L ,$(elpa_dirs) $(sources))
#+end_src
*** load sources
~emacs -Q -L ./lisp~ does not seem to work: after running
~(package-initialize)~, =M-x find-library forge= returns the instance
installed under ~package-user-dir~.
This can be circumvented with ~(setq pacakge-load-list '((forge nil)
all))~.
Full command line for easy startup:
#+begin_src sh
emacs -Q -L ./lisp \
-eval "(setq pacakge-load-list '((forge nil) all))" \
-f package-initialize \
#+end_src
|