-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.ros
executable file
·68 lines (58 loc) · 2.13 KB
/
test.ros
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp(ql:quickload '() :silent t)
)
(defpackage :ros.script.test
(:use :cl))
(in-package :ros.script.test)
(defparameter *lisps*
'(("sbcl-bin" . "SBCL")
("sbcl" . "SBCL")
("clisp" . "CLISP")
("clisp-head" . "CLISP")
("ccl-bin" . "Clozure Common Lisp")
("clasp" . "clasp")
("clasp-bin" . "clasp")
("cmu-bin" . "CMU Common Lisp")
("allegro" . "International Allegro CL Free Express Edition")
("abcl-bin" . "Armed Bear Common Lisp")
("npt" . "NPT")
("ecl" . "ECL")))
(defun cut-before (char text)
(let ((pos (position char text)))
(if pos
(subseq text 0 pos)
text)))
(defun main (&rest argv)
(declare (ignorable argv))
(handler-bind ((error (lambda (c)
(uiop:print-condition-backtrace c)
;; Not all implementation do quit with correct status code
;; in case if we just signal and error :(
;; Example of such implementations: CCL-BIN
(uiop:quit 1))))
(let ((needed-lisp (uiop:getenv "LISP")))
(unless needed-lisp
(error "Env variable LISP was not set."))
(let ((expected (or (cdr (assoc needed-lisp *lisps* :test #'string-equal))
(cdr (assoc (cut-before #\/ needed-lisp) *lisps* :test #'string-equal))))
(real-implementation (lisp-implementation-type)))
(unless expected
(error "This test does not support LISP=~A. The real-implementation=~A."
needed-lisp
real-implementation))
(unless (string-equal real-implementation
expected)
(error "Real implementation is \"~A\", but \"~A\" was expected when LISP=~A."
real-implementation
expected
needed-lisp))
(format t "Everything ok, we are running on \"~A\" as expected for LISP=~A."
real-implementation
needed-lisp)))))
;;; vim: set ft=lisp lisp: