summaryrefslogtreecommitdiff
path: root/test/all.lisp
blob: b0a731b17d3c7c7b2be48011244c9787bf59ad7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; SPDX-License-Identifier: EUPL-1.2
;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com>
(defpackage :ukkoclot/test/all
  (:documentation "Main test runner package.")
  (:use :c2cl :fiveam
   :ukkoclot/test/rw-lock)
  (:import-from :bt2 :with-timeout)
  (:import-from :uiop)
  (:export #:*should-quit* #:run-tests))
(in-package :ukkoclot/test/all)

(defvar *should-quit* nil
  "Bind as true if `run-tests' should exit the process with 0 or 1.

Useful for CI.")

;; TODO: Maybe I should signal on failure instead :thinking:
(defun run-tests ()
  "Run all tests"
  (with-timeout (100)
    (let ((status (run-all-tests)))
      (when *should-quit*
        (format t "~2&BTW Ignore the fatal ERROR condition below")
        (cond
          (status (format t "~&!GREAT SUCCESS!~2%")
                  (uiop:quit 0))
          (t (format t "~&!!! TESTS R FUCKED MATE !!!~2%")
             (uiop:quit 1)))))))