Debian Codegraph @

test/run-on-many-lisps-and-openssls/run-on-many-lisps-and-openssls.lisp

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