test-upgrade.lisp 7.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
(in-package :asdf-tools)

;;; Upgrade tests

(defparameter *default-upgrade-test-tags*
  ;; We return a list of entries in reverse chronological order,
  ;; which should also be more or less the order of decreasing relevance.
  '("REQUIRE" ;; a magic tag meaning whatever your implementation provides, if anything

    ;; The 3.1 series provides the asdf3.1 feature, meaning users can rely on
    ;; all the stabilization work done in 3.0 so far, plus extra developments
    ;; in UIOP, package-inferred-system, and more robustification.
13
    "3.1.4" ;; (2014-10-09) more bug fixes, source-registry cache
14
    "3.1.3" ;; (2014-07-24) a bug fix release for 3.1.2
15 16 17 18 19 20 21 22
    "3.1.2" ;; (2014-05-06) the first ASDF 3.1 release

    ;; The 3.0 series is a stable release of ASDF 3
    ;; with Robert Goldman taking over maintainership at 3.0.2.
    ;; 3.0.0 was just 2.33.10 promoted, but version-satisfies meant it was suddenly
    ;; not compatible with ASDF2 anymore, so we immediately released 3.0.1
    "3.0.3" ;; (2013-10-22) the last in the ASDF 3.0 series
    "3.0.2" ;; (2013-07-02) the first ASDF 3 in SBCL
23
    "3.0.1")) ;; (2013-05-16) the first stable ASDF 3 release
24

25 26
(defparameter *obsolete-upgrade-test-tags*
  '(;; 2.27 to 2.33 are Faré's "stable" ASDF 3 pre-releases
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    "2.32" ;; (2013-03-05) the first really stable ASDF 3 pre-release
    "2.27" ;; (2013-02-01) the first ASDF 3 pre-release

    ;; The ASDF 2 series
    ;; Note that 2.26.x is where the refactoring that begat ASDF 3 took place.
    ;; 2.26.61 is the last single-file, single-package ASDF.
    "2.26" ;; (2012-10-30) the last stable ASDF 2 release, long used by Quicklisp, SBCL, etc.
    "2.22" ;; (2012-06-12) used by debian wheezy, etc.
    "2.20" ;; (2012-01-18) in CCL 1.8, Ubuntu 12.04 LTS
    "2.019" ;; (2011-11-29) still included in LispWorks in 2014.
    "2.014.6" ;; (2011-04-06) first included in Quicklisp, and for some time.
    "2.011" ;; (2010-12-09) long used by CLISP 2.49, Debian squeeze, Ubuntu 10.04 LTS.
    "2.008" ;; (2010-09-10) somewhat stable checkpoint in the ASDF 2 series.
    "2.000" ;; (2010-05-31) first stable ASDF 2 release.

    ;; The original ASDF 1 series
    "1.369" ;; (2009-10-27) the last release by Gary King
    "1.85" ;; (2004-05-16) the last release by Daniel Barlow (not 1.37, which is the README revision!)
    "1.97")) ;; (2006-05-14) the last release before Gary King takes over

(defun get-upgrade-tags (&optional (x *upgrade-test-tags*))
48 49 50 51
  (cond
    ((eq x :default) *default-upgrade-test-tags*)
    ((or (eq x :old) (equal x '("old"))) *obsolete-upgrade-test-tags*)
    (t x)))
52 53

(defun extract-tagged-asdf (tag)
54 55
  "extract an asdf version from git
Use at a given tag, put it under build/asdf-${tag}.lisp"
56 57 58 59 60 61 62 63 64 65
  (with-asdf-dir ()
    (ensure-directories-exist (pn "build/"))
    (unless (string-equal tag "REQUIRE")
      (let ((file (pn (strcat "build/asdf-" tag ".lisp"))))
        (unless (probe-file file)
          (cond
            ((version<= tag "2.26.61")
             (git `(show (,tag ":asdf.lisp") (> ,file))))
            (t
             (ensure-directories-exist (pn "build/old/build/"))
66
             (run `(pipe (git archive ,tag) (tar "xfC" - ,(pn "build/old/"))))
67
             (run `(make) :directory (pn "build/old/"))
68 69
             (rename-file-overwriting-target (pn "build/old/build/asdf.lisp") file)))))))
  (success))
70 71

(deftestcmd extract-all-tagged-asdf (upgrade-tags)
72
  "extract all asdf tags used for upgrade"
73 74
  (map () 'extract-tagged-asdf upgrade-tags)
  (success))
75

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
(defalias extract extract-all-tagged-asdf)

(defparameter *upgrade-test-methods* :default)

(defparameter *all-upgrade-test-methods*
  '((:load-asdf-lisp :load-asdf-lisp-clean)
    (:load-asdf-lisp :load-asdf-system)
    (:load-asdf-lisp :compile-load-asdf-upgrade)
    (:load-asdf-lisp :load-asdf-fasl)
    (() :load-asdf-fasl)
    (:load-asdf-lisp-and-test-uiop :load-asdf-fasl)))

(defun get-upgrade-methods (&optional (x *upgrade-test-methods*))
  (if (eq x :default) *all-upgrade-test-methods* x))

(defun valid-upgrade-test-p (lisp tag method)
  (declare (ignore method))
  (or
   (string-equal tag "REQUIRE") ;; we are hopefully always able to upgrade from REQUIRE
   (ecase lisp
     ;; ABCL makes it damn slow. Also, for some reason, we punt on anything earlier than 2.25,
     ;; and only need to test it once, below for 2.24.
     ((:abcl) (version<= "2.24" tag))

     ;; CCL fasl numbering broke loading of old asdf 2.0
     ((:ccl) (or (version< tag "2.0") (version<= "2.20" tag)))

103 104 105
     ;; CLASP is only supported as of 3.1.4.3
     ((:clasp) (version<= "3.1.4.3" tag))

106 107 108
     ;; My old Ubuntu 10.04LTS clisp 2.44.1 came wired in
     ;; with an antique ASDF 1.374 from CLC that can't be removed.
     ;; More recent CLISPs work.
109 110
     ;; 2.00[0-7] use UID, which fails on some old CLISPs,
     ;; but these old ASDF versions still can be loaded and upgraded from.
111
     ;; Note that for the longest time, CLISP has included 2.011 in its distribution.
112
     ;; However, whether we punt or don't punt, these should all work.
113 114 115 116 117 118 119
     ((:clisp) t)

     ;; CMUCL has problems with 2.32 and earlier because of
     ;; the redefinition of system's superclass component.
     ((:cmucl) (version<= "2.33" tag))

     ;; Skip many ECL tests, for various ASDF issues
120
     ((:ecl :ecl_bytecodes) (version<= "2.21" tag))
121 122 123 124

     ;; GCL 2.7.0 from late November 2013 is required, with ASDF 3.1.2
     ((:gcl) (version<= "3.1.2" tag))

125 126 127
     ;; LispWorks is fine, but ASDF 3.0.3 has a bug and can't be loaded.
     ((:lispworks) (equal "3.0.3" tag))

128 129 130 131 132
     ;; MKCL is only supported starting with specific versions 2.24, 2.26.x, 3.0.3.0.x, so skip.
     ((:mkcl) (version<= "3.1.2" tag))

     ;; XCL support starts with ASDF 2.014.2
     ;; — It also dies during upgrade trying to show the backtrace.
133 134
     ;; We recommend you replace XCL's asdf using:
     ;;     ./tools/asdf-tools install-asdf xcl
135 136 137
     ((:xcl) (version<= "2.15" tag))

     ;; all clear on these implementations
138
     ((:allegro :sbcl :scl) t))))
139 140

(deftestcmd test-upgrade (lisp upgrade-tags upgrade-methods)
141 142
  "run upgrade tests
Use the preferred lisp implementation"
143 144 145 146 147 148 149 150 151
  (nest
   (with-asdf-dir ())
   (let ((log (newlogfile "upgrade" lisp)))
     ;; Remove stale FASLs from ASDF 1.x,
     ;; especially since different implementations may have the same fasl type
     (dolist (pattern '("build/*.*f*" "uiop/*.*f*" "test/*.*f*"))
       (map () 'delete-file (directory* pattern))))
   (loop :for tag :in upgrade-tags :do
     (loop :for method :in upgrade-methods
152 153 154
           :for description
             = (format nil "Testing ASDF upgrade on ~(~A~) from ~A to ~A using method ~(~{~A~^:~}~)"
                       lisp tag *version* method)
155
           :when (valid-upgrade-test-p lisp tag method) :do
156
             (success-if (and
157 158 159 160 161 162
                          (extract-tagged-asdf tag)
                          (run-test-lisp description
                           `((load "test/script-support.lisp")
                             (asdf-test::test-upgrade ,@method ,tag))
                           :lisp lisp :log log))
                         description))
163 164
    :finally (progn (log! log "Upgrade test succeeded for ~(~A~)" lisp)
                    (return (success))))))
165 166 167

(defalias u test-upgrade)