Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 50 additions & 18 deletions run-tests.ros
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ exec ros -Q -- $0 "$@"
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp
(ql:quickload "trivial-backtrace"
(ql:quickload (list "trivial-backtrace"
"log4cl")
:silent t)
#+(or sbcl ccl)
(ql:quickload "cl-coveralls"
Expand All @@ -30,6 +31,9 @@ exec ros -Q -- $0 "$@"

(defun guess-test-system-name (primary-system-name)
(check-type primary-system-name string)
(format t "TRACE: Guessing test system name for ~A~%"
primary-system-name)

(loop for template in *test-system-name-templates*
for system-name = (format nil template
primary-system-name)
Expand All @@ -50,6 +54,9 @@ exec ros -Q -- $0 "$@"

(let ((test-system-name
(guess-test-system-name primary-system-name)))
(format t "TRACE: guessed test system name is ~A~%"
test-system-name)

(ql:quickload test-system-name
:silent t)
;; ASDF:TEST-SYSTEM always returns T
Expand Down Expand Up @@ -89,27 +96,46 @@ exec ros -Q -- $0 "$@"
"Please specify ASDF system as a first argument.~%")
(uiop:quit 1))

(let* ((user-script (unless (interactive-stream-p *standard-input*)
(uiop:slurp-stream-forms *standard-input*)))
(let* ((user-script-as-str
(unless (interactive-stream-p *standard-input*)
(format t "TRACE: reading user-script from standard input~%")
(let* ((raw (uiop:slurp-stream-string *standard-input*))
(stripped (string-trim '(#\Newline #\Space #\Tab)
raw)))
(unless (zerop (length stripped))
stripped))))
(user-script
(when user-script-as-str
(format t "TRACE: parsing this user-input:~%~A~%"
user-script-as-str)
(let ((stream (make-string-input-stream user-script-as-str)))
(uiop:with-safe-io-syntax ()
(uiop:slurp-stream-forms stream)))))
(coveralls-repo-token
(let* ((value (uiop:getenv "COVERALLS_REPO_TOKEN"))
;; Sometimes user might want to use multiline
;; YAML format to make expression more readable.
;; In this case the value might contain hanging
;; spaces and new-lines.
(value (string-trim '(#\Newline #\Space) value)))
(cond
((or (null value)
;; When using GH Actions expressions like:
;; ${{ matrix.lisp == 'sbcl-bin' && secrets.github_token }}
;; the value will be 'false' for any lisp other than 'sbcl-bin'
(string-equal value "false")
(string-equal value ""))
nil)
(t value))))
(progn
(format t "TRACE: makeing coveralls repo token~%")

(let* ((value (uiop:getenv "COVERALLS_REPO_TOKEN"))
;; Sometimes user might want to use multiline
;; YAML format to make expression more readable.
;; In this case the value might contain hanging
;; spaces and new-lines.
(value (string-trim '(#\Newline #\Space) value)))
(cond
((or (null value)
;; When using GH Actions expressions like:
;; ${{ matrix.lisp == 'sbcl-bin' && secrets.github_token }}
;; the value will be 'false' for any lisp other than 'sbcl-bin'
(string-equal value "false")
(string-equal value ""))
nil)
(t value)))))
(result
(progn
(format t "TRACE: makign result 1~%")

(when coveralls-repo-token
(format t "TRACE: makign result 2~%")
;; This will enable data collection
;; inside with-coveralls:
(setf (uiop:getenv "COVERALLS")
Expand All @@ -118,16 +144,22 @@ exec ros -Q -- $0 "$@"
(setf (uiop:getenv "COVERALLS_REPO_TOKEN")
coveralls-repo-token))

(format t "TRACE: makign result 3~%")
(with-coveralls (:exclude (list ".qlot/"))
(format t "TRACE: makign result 4~%")
(cond
(user-script
(format t "TRACE: processing user-script:~%~S~%"
user-script-as-str)
(loop with form-results
for form in user-script
do (setf form-results
(eval form))
finally (return form-results)))
;; default tests runner
(t
(format t "TRACE: running tests for system \"~A\"~%"
system)
(run-tests system)))))))
(unless result
(uiop:quit 2))))
Expand Down