test-bundle.script 4.61 KB
Newer Older
1
;;; -*- Lisp -*-
2
(in-package :asdf-test)
3
4
5
6
7

;;;---------------------------------------------------------------------------
;;; Check to see if the bundle functionality is doing something.
;;;---------------------------------------------------------------------------

8
9
10
(initialize-source-registry '(:source-registry :ignore-inherited-configuration))
(clear-system :test-asdf/bundle-1)
(clear-system :test-asdf/bundle-2)
11
(when (find-package :test-package) (delete-package :test-package))
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
12

Elias Pipping's avatar
Elias Pipping committed
13
#+(and os-macosx ecl)
14
15
(leave-test "Bundle test doesn't work on Mac on this lisp." 0)

16
#+abcl
17
18
19
20
21
22
(when (and (member :abcl *features*)
           (os-macosx-p)
           ;; bundles don't work on pre-1.3.0
           (second (third (sys::arglist 'directory))))
  (leave-test "Bundle test doesn't work on Mac on this version of ABCL." 0))

23
#+(or (and ecl ecl-bytecmp) gcl)
24
25
(leave-test "bundles not on this implementation" 0)

Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
26
27
28
29
30
31
#+abcl
(let* ((version (lisp-implementation-version))
       (version-nums (subseq version 0 (position-if-not (lambda (x) (find x "0123456789.")) version))))
  (when (version< version-nums "1.2.0")
    (leave-test "Your old ABCL is known to fail this test script, so skipping it." 0)))

32
33
34
(defparameter *bundle-1* (output-file 'compile-bundle-op :test-asdf/bundle-1))
(defparameter *bundle-2* (output-file 'compile-bundle-op :test-asdf/bundle-2))
(defparameter *mono-bundle-2* (output-file 'monolithic-compile-bundle-op :test-asdf/bundle-2))
35
36
(DBG :test-bundle *bundle-1* *bundle-2*)
(assert-equal (list *bundle-2*)
37
              (input-files 'load-bundle-op :test-asdf/bundle-2))
38
39
(delete-file-if-exists *bundle-1*)
(delete-file-if-exists *bundle-2*)
40
(delete-file-if-exists *mono-bundle-2*)
41
(operate 'load-bundle-op :test-asdf/bundle-2)
42
(DBG "Check that the bundles were indeed created.")
43
44
(assert (probe-file *bundle-2*))
(assert (probe-file *bundle-1*))
45
(DBG "Check that the files were indeed loaded.")
46
47
(assert (symbol-value (find-symbol* :*file1* :test-package)))
(assert (symbol-value (find-symbol* :*file3* :test-package)))
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
48
49
50
51
52
53
54
55
(DBG "Unintern symbols, load the bundle, and check that the symbols are there again.")
(set (find-symbol* :*file1* :test-package) nil)
(set (find-symbol* :*file3* :test-package) nil)
(assert-equal nil (symbol-value (find-symbol* :*file1* :test-package)))
(assert-equal nil (symbol-value (find-symbol* :*file3* :test-package)))
(load (output-file 'compile-bundle-op :test-asdf/bundle-1))
(assert-equal t (symbol-value (find-symbol* :*file1* :test-package)))
(assert-equal t (symbol-value (find-symbol* :*file3* :test-package)))
56
(DBG "Now for the mono-fasl")
57
(operate 'monolithic-compile-bundle-op :test-asdf/bundle-2)
58
(assert (probe-file *mono-bundle-2*))
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
59
60
61
62
63
64
65
66
(DBG "Unintern symbols, load the monolithic bundle, and check that the symbols are there again.")
(set (find-symbol* :*file1* :test-package) nil)
(set (find-symbol* :*file3* :test-package) nil)
(assert-equal nil (symbol-value (find-symbol* :*file1* :test-package)))
(assert-equal nil (symbol-value (find-symbol* :*file3* :test-package)))
(load (output-file 'monolithic-compile-bundle-op :test-asdf/bundle-2))
(assert-equal t (symbol-value (find-symbol* :*file1* :test-package)))
(assert-equal t (symbol-value (find-symbol* :*file3* :test-package)))
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
67

68
#+(or ecl mkcl)
69
(progn
70
71
72
  (DBG "On ECL and MKCL, test dll-op and monolithic-dll-op")
  (DBG "Test the pre-compiled system feature")
  (require 'sockets)
73
  (progn
74
    (DBG "Test that we didn't break require for non-asdf modules")
Robert P. Goldman's avatar
Robert P. Goldman committed
75
    (pop #+ecl ext:*module-provider-functions* #+mkcl mk-ext:*module-provider-functions*)
76
    (require 'serve-event))
77
  (DBG "Create a DLL via dll-op")
78
  (operate 'dll-op :test-asdf/dll-test)
79
  (DBG "Load the DLL")
80
81
  (let ((dll (first (output-files 'dll-op :test-asdf/dll-test))))
    (si:load-foreign-module dll)
82
    (DBG "Load a library that knows how to use the DLL")
Elias Pipping's avatar
Elias Pipping committed
83
    (let* (#+(and mkcl os-windows) (compiler::*builder-default-libraries* (list (namestring dll))))
84
      (operate 'load-op :test-asdf/dll-user)))
85
  (DBG "Test that the DLL works")
86
  (assert-equal (sample-function) 42)
87
  (DBG "Create a DLL via monolithic-dll-op")
88
  (nest
Elias Pipping's avatar
Elias Pipping committed
89
   #+(and mkcl os-windows)
90
91
92
93
   (let* ((lib (first (output-files (operate 'lib-op :test-asdf/monodll-1) :test-asdf/monodll-1)))
          (compiler::*builder-default-libraries* (list (namestring lib)))))
   (operate 'monolithic-dll-op :test-asdf/monodll))

94
  (DBG "Use and test that DLL")
95
96
  (let ((dll (first (output-files 'monolithic-dll-op :test-asdf/monodll))))
    (si:load-foreign-module dll)
Elias Pipping's avatar
Elias Pipping committed
97
    (let* (#+(and mkcl os-windows) (compiler::*builder-default-libraries* (list (namestring dll))))
98
      (operate 'load-op :test-asdf/monodll-user)))
99
  (assert-equal (always-42) 42))
100
101

;;; TODO: test prebuilt-system.