Recently Written · git

clic

MIRROR ONLY Gopher client with pretty colours in Common Lisp

git clone https://github.com/equwal/clic

Log | Files | Refs


3rdparties/software/cl+ssl-20200427-git/test/run-on-many-lisps-and-openssls/run-on-many-lisps-and-openssls.lisp (3990 bytes)

1 (ql:quickload :test-grid-agent)
2 (ql:quickload :test-grid-utils)
3 (ql:quickload :cl-fad)
4 (ql:quickload :alexandria)
5 (ql:quickload :log4cl)
6 
7 (defpackage #:run-on-many-lisps-and-openssls
8   (:use :common-lisp)
9   (:export #:run
10            #:clean-fasls))
11 
12 (in-package :run-on-many-lisps-and-openssls)
13 
14 (defun fasl-root (test-run-dir)
15   (merge-pathnames "fasl/" test-run-dir))
16 
17 (defun sanitize-as-path (str)
18   ;; Substitute dots by hypens if our main process is CCL, it 
19   ;; prepends the > symbol before dots;
20   ;; for example: 1.1.0.36.mswinmt.1201-284e340 => 1>.1>.0>.36>.mswinmt.1201-284e340
21   ;; When we pass such a pathname to other lisps, they can't handle it.
22   (substitute #\- #\. str))
23 
24 (defun log-name (lisp openssl-release)
25   (sanitize-as-path
26    (string-downcase (concatenate 'string
27                                  (tg-agent::implementation-identifier lisp)
28                                  "-"
29                                  openssl-release))))
30 
31 (defun fasl-dir (test-run-dir lisp)
32   (merge-pathnames
33    (format nil
34            "~(~A~)/"
35            (sanitize-as-path (tg-agent::implementation-identifier lisp)))
36    (fasl-root test-run-dir)))
37 
38 (defun so-path (openssl-releases-dir openssl-release so-name)
39   (merge-pathnames (format nil "~A/lib/~A" openssl-release so-name)
40                    openssl-releases-dir))
41 
42 (defun run (&key test-run-description
43               test-run-dir
44               quicklisp-dir
45               lisps
46               openssl-releases
47               openssl-releases-dir
48               cl+ssl-location)
49   ;; (unless cl+ssl-location
50   ;;   (error "cl+ssl-location parameter is not specified and *load-truename* was not available at the load time."))
51 
52   (ensure-directories-exist test-run-dir)
53   
54   (let ((lisp-exe:*temp-dir* test-run-dir))
55     (flet ((run-lib-test (lisp openssl-release)
56              (tg-agent::proc-run-libtest
57               lisp
58               :cl+ssl
59               (cons :lisp (cons (tg-agent::implementation-identifier lisp)
60                                 test-run-description))
61               (merge-pathnames (log-name lisp openssl-release) test-run-dir)
62               quicklisp-dir
63               (fasl-dir test-run-dir lisp)
64               :eval-before-test `(progn
65                                    (set (read-from-string "asdf:*central-registry*")
66                                         (cons ,cl+ssl-location
67                                               (symbol-value (read-from-string "asdf:*central-registry*"))))
68                                    ,(when cl+ssl-location
69                                           `(cl-user::fncall "add-asdf-output-translation"
70                                                             ,cl+ssl-location
71                                                             ,(merge-pathnames "cl+ssl/" (fasl-dir test-run-dir lisp))))
72                                    (cl-user::fncall "ql:quickload" :cffi)
73                                    (cl-user::fncall "cffi:load-foreign-library" 
74                                                     ,(so-path openssl-releases-dir openssl-release "libcrypto.so"))
75                                    (cl-user::fncall "cffi:load-foreign-library"
76                                                     ,(so-path openssl-releases-dir openssl-release "libssl.so"))
77                                    (pushnew :cl+ssl-foreign-libs-already-loaded *features*)))))
78       (tg-utils::write-to-file
79        (alexandria:map-product (lambda (lisp openssl-release)
80                                  (list (tg-agent::implementation-identifier lisp)
81                                        openssl-release
82                                        (getf (run-lib-test lisp openssl-release)
83                                              :status)))
84                                lisps
85                                openssl-releases)
86        (merge-pathnames "results.lisp" test-run-dir)))))
87 
88 (defun clean-fasls (test-run-dir)
89   (cl-fad:delete-directory-and-files (fasl-root test-run-dir)))