emacs config: Make C-c C-c execute the current test through ./run

* .dir-locals.el: Redefine C-c C-c in sh-mode and python-mode for
the tests/ subdirectory.c
* HACKING: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2017-03-28 21:24:39 +02:00
parent e86964fe81
commit 5f564c2b45
2 changed files with 36 additions and 1 deletions

View file

@ -6,4 +6,14 @@
(c++-mode . ((c-default-style . "gnu")
(indent-tab-mode . t)
(tab-width . 8)
(fill-column . 70))))
(fill-column . 70)))
("tests" . ((nil . ((eval . (defun spot/execute-test ()
"execute the current file through ../run"
(interactive)
(shell-command (concat "cd ..; ./run "
(buffer-file-name)
" &"))))))
(sh-mode . ((eval . (local-set-key
(kbd "C-c C-c") #'spot/execute-test))))
(python-mode . ((eval . (local-set-key (kbd "C-c C-c")
#'spot/execute-test)))))))

25
HACKING
View file

@ -109,6 +109,7 @@ another "magic touch":
touch doc/org-stamp
Silent Building with automake
-----------------------------
@ -120,6 +121,30 @@ annoying. To reduce this verbosity, just run:
make V=0
Executing a single test
-----------------------
All tests in subdirectories of tests/ are executed through the
tests/run script. That run script defines PATH and other environment
variables necessary so that Shell and Python scripts will use the
version of Spot under development. For instance to execute
tests/core/acc.test, do:
% cd tests
% ./run core/acc.test
A test run this way automatically executes in verbose mode. Any
temporary file generated by the script can be found in
tests/core/acc.dir/.
Alternatively, if you use emacs, the .dir-locals.el configuration at
the top of the project redefines the C-c C-c key for all shell and
python scripts under the tests/ directory. So if you are working on
tests/core/acc.test under emacs, hitting C-c C-c should be all you
need to execute it.
Debugging Libtool executables
-----------------------------