From 5b4b6d2319fa8594d4c8dd3078a72b45ec0505b8 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 14 Feb 2024 19:56:58 +0100 Subject: 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. --- .emacs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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. -- cgit v1.2.3