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

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

Thanks to Douglas Crosher for his URL tests!
parent 0ecbb463
......@@ -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
......@@ -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*))
......
;;; -*- Lisp -*-
(asdf:defsystem test-urls-1
:pathname #p"http://www.scieneer.com/files/"
:components ((:file "test")))
;;; -*- 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))))
;;; -*- Lisp -*-
(asdf:defsystem test-urls-2
:components ((:file "test")))
;;; -*- Lisp -*-
(load "script-support")
(load-asdf)
#+scl
(require :http-library)
(quit-on-error
(setf asdf:*central-registry* '("http://www.scieneer.com/files/"))
;; 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 ((url (asdf:system-definition-pathname "test-urls-2")))
(compare url "test-urls-2.asd"))
(let* ((system (asdf:find-system "test-urls-2"))
(url (asdf:component-pathname
(asdf:find-component system "test"))))
(compare url "test.lisp"))
(asdf:operate 'asdf:load-op 'test-urls-2)
;; Test that it compiled
(let* ((path (asdf:component-pathname
(asdf:find-component "test-urls-2" "test")))
(test (asdf:compile-file-pathname* path))
(test-date (file-write-date test)))
(format t "~&test-urls-2 1: ~S ~S~%" test test-date)
(assert test-date))))
;;;; Example lisp code.
(defun tst (x)
(1+ x))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment