-
Notifications
You must be signed in to change notification settings - Fork 35
/
test-bundle-asd.script
79 lines (61 loc) · 3.05 KB
/
test-bundle-asd.script
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
69
70
71
72
73
74
75
76
77
78
79
;;; -*- Lisp -*-
(in-package :asdf-test)
(use-package :asdf)
;;;---------------------------------------------------------------------------
;;; Test for GitLab issue 23
;;;---------------------------------------------------------------------------
#+(or (and ecl ecl-bytecmp) gcl)
(leave-test "bundles not implemented on this implementation" 0)
(defparameter *test-system-name* "deliver-bundle")
(asdf:initialize-source-registry '(:source-registry
(:directory :here)
:ignore-inherited-configuration))
(asdf:clear-system *test-system-name*)
(defparameter *constructed-asdf-file*
(output-file (make-operation 'deliver-asd-op)
(find-system *test-system-name*)))
(ignore-errors (delete-file *constructed-asdf-file*))
(DBG "Writing ASD system definition file:" *constructed-asdf-file*)
(operate 'deliver-asd-op *test-system-name*)
(defun load-constructed-asd-file (&optional (constructed-file *constructed-asdf-file*))
(with-open-file (str constructed-file)
(let* ((sexps
(uiop:with-safe-io-syntax (:package :asdf-user)
(uiop:read-file-forms str))))
(or (find-if #'(lambda (x) (and (listp x) (eq (car x) 'defsystem))) sexps)
(error "Unable to find generated defsystem.")))))
(defparameter *defsystem-sexpr*
(load-constructed-asd-file))
(DBG "ASDF-created system definition is:")
(DBG (format nil "~s" *defsystem-sexpr*))
(assert (equalp (second *defsystem-sexpr*) *test-system-name*))
(assert (eq (getf *defsystem-sexpr* :class) 'asdf/bundle:prebuilt-system))
(assert (equalp (getf *defsystem-sexpr* :components)
#-(or clasp ecl mkcl)
`((:compiled-file ,(format nil "~a--system" *test-system-name*)))
#+(or clasp ecl mkcl)
'((:COMPILED-FILE "deliver-bundle"))))
#+(and (or clasp ecl mkcl) linux)
(assert (equalp (getf *defsystem-sexpr* :lib)
"deliver-bundle.a"))
(assert (not (getf *defsystem-sexpr* :defsystem-depends-on)))
(assert (equalp (getf *defsystem-sexpr* :depends-on) (list "test1"))
nil "Dependencies for bundled system are incorrect.")
(ignore-errors (delete-file *constructed-asdf-file*))
(operate 'monolithic-deliver-asd-op *test-system-name*)
(setf *defsystem-sexpr*
(load-constructed-asd-file))
(DBG "ASDF-created MONOLITHIC system definition is:")
(DBG (format nil "~s" *defsystem-sexpr*))
(assert (equalp (second *defsystem-sexpr*) *test-system-name*))
(assert (eq (getf *defsystem-sexpr* :class) 'asdf/bundle:prebuilt-system))
(assert (equalp (getf *defsystem-sexpr* :components)
#-(or clasp ecl mkcl)
`((:compiled-file ,(format nil "~a--all-systems" *test-system-name*)))
#+ (or clasp ecl mkcl)
'((:COMPILED-FILE "deliver-bundle--all-systems"))))
#+(and (or clasp ecl mkcl) linux)
(assert (equalp (getf *defsystem-sexpr* :lib)
"deliver-bundle--all-systems.a"))
(assert (not (getf *defsystem-sexpr* :defsystem-depends-on)))
(assert (not (getf *defsystem-sexpr* :depends-on)))