Commit 6ed10289 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Testing tweaks + Tests for loading from URL (disabled by default for security).

Thanks to Douglas Crosher for his URL tests!
parent 0ecbb463
Loading
Loading
Loading
Loading
+5 −3
Changes for Makefile: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -74,12 +74,14 @@ test-upgrade:
test-forward-references:
	if [ -f /usr/lib/sbcl/sbcl-dist.core ] ; then SBCL="/usr/bin/sbcl --core /usr/lib/sbcl/sbcl-dist.core" ; fi ; $${SBCL:-sbcl} --noinform --load ~/cl/asdf/asdf.lisp --eval '(sb-ext:quit)' 2>&1 | cmp - /dev/null

test: test-forward-references
do-test:
	@cd test; make clean;./run-tests.sh ${lisp} ${test-glob}

test: do-test test-forward-references

test-all: test-forward-references
	@for lisp in ${lisps} ; do \
		make test lisp=$$lisp || exit 1 ; \
		make do-test lisp=$$lisp || exit 1 ; \
	done

debian-package: mrproper
@@ -107,7 +109,7 @@ fix-remote-git-tags:


.PHONY: install archive archive-copy push website clean mrproper \
	upgrade-test test-forward-references test test-all \
	upgrade-test test-forward-references test do-test test-all \
	debian-package \
	replace-sbcl-asdf replace-ccl-asdf \
	fix-local-git-tags fix-remote-git-tags
+15 −5
Changes for test/compile-asdf.lisp: 15 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,11 @@
(proclaim '(optimize (speed 2) (safety 3) #-allegro (debug 3)))

(load (make-pathname :name "script-support" :defaults *load-pathname*))
#+ecl
(eval-when (:compile-toplevel :load-toplevel :execute)
  (shadow 'cl:compile-file :common-lisp-user))
#+ecl (defun compile-file (&rest args) (apply 'cl:compile-file args))
#+ecl (trace compile-file)

(cond
  ((not (probe-file *asdf-lisp*))
@@ -16,18 +21,23 @@
     (ensure-directories-exist *asdf-fasl*)
     (multiple-value-bind (result warnings-p errors-p)
         ;; style warnings shouldn't abort the compilation [2010/02/03:rpg]
         (handler-bind ((style-warning
         (handler-bind (#+sbcl (sb-c::simple-compiler-note #'muffle-warning)
                        #+ecl ((or c:compiler-note c::compiler-debug-note) #'muffle-warning)
                        (style-warning
                         #'(lambda (w)
                             (princ w *error-output*)
                             #+ecl
                             (format *error-output* "~&Got a ~S:~%~A~%" (type-of w) w)
                             #-ecl ;; escalate style-warnings to warnings - we don't want them.
                             (warn "Can you please fix ASDF to not emit style-warnings? Got:~%~A" w)
                             (muffle-warning w))))
           (compile-file *asdf-lisp* :output-file tmp :print t :verbose t))
       (declare (ignore result))
       (cond
         #-ecl ;; 10.7.1 from CVS has spurious warnings. Sigh.
         (warnings-p
          (leave-lisp "Testsuite failed: ASDF compiled with warnings" 1))
         (errors-p
          (leave-lisp "Testsuite failed: ASDF compiled with ERRORS" 2))
         #-ecl ;; ECL 10.7.1 has spurious warnings
         (warnings-p
          (leave-lisp "Testsuite failed: ASDF compiled with warnings" 1))
         (t
          (when (probe-file *asdf-fasl*)
            (delete-file *asdf-fasl*))

test/test-urls-1.asd

0 → 100644
+4 −0
Changes for test/test-urls-1.asd: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
;;; -*- Lisp -*-
(asdf:defsystem test-urls-1
  :pathname #p"http://www.scieneer.com/files/"
  :components ((:file "test")))
+36 −0
Changes for test/test-urls-1.script: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
;;; -*- Lisp -*-
(load "script-support")
(load-asdf)
#+scl
(require :http-library)

(quit-on-error
 (setf asdf:*central-registry* '(*default-pathname-defaults*))
 ;; Compare the source files with local versions before loading them.
 #+(and (or abcl scl) trust-the-net)
 (flet ((compare (url local)
	  (with-open-file (stream1 url :element-type 'character
				   :external-format :utf-8)
	    (with-open-file (stream2 local :element-type 'character
				     :external-format :utf-8)
	      (loop
		 (let ((ch1 (read-char stream1 nil nil))
		       (ch2 (read-char stream2 nil nil)))
		   (unless (eql ch1 ch2)
		     (error "Unexpected source content."))
		   (unless (and ch1 ch2)
		     (return))))))))
   (let* ((system (asdf:find-system "test-urls-1"))
	  (url (asdf:component-pathname
		(asdf:find-component system "test"))))
     (compare url "test.lisp"))

   (asdf:operate 'asdf:load-op 'test-urls-1)

   ;; test that it compiled
   (let* ((path (asdf:component-pathname
                 (asdf:find-component "test-urls-1" "test")))
          (test (asdf:compile-file-pathname* path))
          (test-date (file-write-date test)))
     (format t "~&test-urls-1 1: ~S ~S~%" test test-date)
     (assert test-date))))

test/test-urls-2.asd

0 → 100644
+3 −0
Changes for test/test-urls-2.asd: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
;;; -*- Lisp -*-
(asdf:defsystem test-urls-2
  :components ((:file "test")))
Loading