test-bundle.script 3.56 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))
12

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)

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)))
48
(DBG "Now for the mono-fasl")
49
(operate 'monolithic-compile-bundle-op :test-asdf/bundle-2)
50
(assert (probe-file *mono-bundle-2*))
51

52
#+(or ecl mkcl)
53
(progn
54 55 56
  (DBG "On ECL and MKCL, test dll-op and monolithic-dll-op")
  (DBG "Test the pre-compiled system feature")
  (require 'sockets)
57
  (progn
58
    (DBG "Test that we didn't break require for non-asdf modules")
59
    (pop #+ecl ext:*module-provider-functions* #+mkcl mk-ext:*module-provider-functions*)
60
    (require 'serve-event))
61
  (DBG "Create a DLL via dll-op")
62
  (operate 'dll-op :test-asdf/dll-test)
63
  (DBG "Load the DLL")
64 65
  (let ((dll (first (output-files 'dll-op :test-asdf/dll-test))))
    (si:load-foreign-module dll)
66
    (DBG "Load a library that knows how to use the DLL")
67
    (let* (#+(and mkcl os-windows) (compiler::*builder-default-libraries* (list (namestring dll))))
68
      (operate 'load-op :test-asdf/dll-user)))
69
  (DBG "Test that the DLL works")
70
  (assert-equal (sample-function) 42)
71
  (DBG "Create a DLL via monolithic-dll-op")
72
  (nest
73
   #+(and mkcl os-windows)
74 75 76 77
   (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))

78
  (DBG "Use and test that DLL")
79 80
  (let ((dll (first (output-files 'monolithic-dll-op :test-asdf/monodll))))
    (si:load-foreign-module dll)
81
    (let* (#+(and mkcl os-windows) (compiler::*builder-default-libraries* (list (namestring dll))))
82
      (operate 'load-op :test-asdf/monodll-user)))
83
  (assert-equal (always-42) 42))
84 85

;;; TODO: test prebuilt-system.