1 ;; -*- mode: emacs-lisp; lexical-binding: t; -*-
2 ;; Copyright Leo Butler (leo.butler@umanitoba.ca) 2020
3 ;; Released under the terms of GPLv3+
5 ;; Usage: in *ielm* execute
6 ;; (load "rtest-imaxima.el")
7 ;; (imaxima-rtests :program "/path/to/maxima/script" :lisps '(list of enabled lisps))
10 ;; imaxima-run-test : batches a single regression test file using a single lisp
11 ;; imaxima-run-test-in-shell : launches a fresh emacs session, sets the imaxima-maxima-program, loads this file into the session and then runs imaxima-run-test
12 ;; imaxima-rtests : loops over a list of regression test files and lisps and calls imaxima-run-test-in-shell on each pair (file lisp)
16 (let ((imaxima-enabled-lisps '(gcl ecl sbcl clisp
))
17 (imaxima-rtest-files '("./rtest_imaxima.mac"))
18 (this-file "./rtest-imaxima.el"))
19 (cl-defun imaxima-run-test
21 (let* ((kill-buffer-query-functions '())
22 (imaxima-maxima-options (format "%s --lisp=%s" imaxima-maxima-options lisp
))
23 (imaxima-use-maxima-mode-flag nil
)
24 (rtest-cmd (format "batch(\"%s\",'test);\n" file
))
26 (comint-send-string (get-buffer-process "*imaxima*") rtest-cmd
))))
27 (message imaxima-maxima-options
)
28 (message imaxima-maxima-program
)
29 (add-hook 'imaxima-startup-hook do-it t
)
30 (save-excursion (imaxima))
31 (remove-hook 'imaxima-startup-hook do-it
)
33 (cl-defun imaxima-run-test-in-shell (file lisp
)
34 (let ((cmd (format "emacs --no-desktop --execute='(progn (defvar imaxima-maxima-program \"%s\") (load \"%s\") (imaxima-run-test \"%s\" \"%s\"))'" imaxima-maxima-program this-file file lisp
))
35 (out (format "*rtest-imaxima-%s*" lisp
))
36 (err (format "*rtest-imaxima-%s-err*" lisp
)))
37 (async-shell-command cmd out err
)))
38 (cl-defun imaxima-rtests
39 (&key
((:program imaxima-maxima-program
)) (files imaxima-rtest-files
) (lisps imaxima-enabled-lisps
))
40 (mapcar #'(lambda (lisp) (mapcar #'(lambda (file) (imaxima-run-test-in-shell file lisp
)) files
)) lisps
))
43 ; end of rtest-imaxima.el