summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2024-02-14 19:56:58 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2024-03-02 12:14:59 +0100
commit5b4b6d2319fa8594d4c8dd3078a72b45ec0505b8 (patch)
tree0144d04420f4b6fb950c7f00ddaaebd905198f93
parent40775ea8dc96d7e930626b7daf9f9cb199b77528 (diff)
downloaddotfiles-5b4b6d2319fa8594d4c8dd3078a72b45ec0505b8.tar.xz
Add helper to run Emacs testcase
It's probably more idiomatic to run a testcase you are developing in your own session, using 'M-x ert' commands? I figure starting a fresh Emacs cannot hurt.
-rw-r--r--.emacs23
1 files changed, 23 insertions, 0 deletions
diff --git a/.emacs b/.emacs
index 99771bf..cb9c1fe 100644
--- a/.emacs
+++ b/.emacs
@@ -474,6 +474,29 @@
(lambda ()
(ibuffer-switch-to-saved-filter-groups "my/ibuffer-groups")))
+;;; Development helpers.
+(defun my/emacs-run-testcase ()
+ (interactive)
+ (require 'which-func)
+ (let* ((emacs-root (project-root (project-current)))
+ (testfile (file-name-sans-extension
+ (file-relative-name
+ buffer-file-name (file-name-concat
+ emacs-root "test"))))
+ (cores (string-to-number
+ (shell-command-to-string "nproc --all")))
+ (options
+ `(("SELECTOR" . ,(which-function))
+ ("TEST_BACKTRACE_LINE_LENGTH" . nil)))
+ (options-list
+ (seq-map
+ (lambda (opt) (format "%s=%s" (car opt) (cdr opt)))
+ options))
+ (compile-command
+ (format "make -j%s && make -C test %s %s"
+ cores testfile (string-join options-list " "))))
+ (call-interactively 'project-compile)))
+
;;; Helper functions and miscellaneous settings.
;;;; French quick toggle.