diff --git a/Makefile b/Makefile index 9f9917b..1d0a32d 100644 --- a/Makefile +++ b/Makefile @@ -171,8 +171,9 @@ $(BUNDLETESTD): $(BUNDLEDIR): mkdir -p $@ - $(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \ - --eval '(defvar *bundle-dir* "$@")' \ + $(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \ + --eval '(defvar *bundle-dir* "$@")' \ + --eval '(defvar *pwd* "$(PWD)/")' \ --eval '(defvar *ql-dist* "$(BUNDLEDIST)")' \ --load bundle/ql.lisp diff --git a/bundle/ql.lisp b/bundle/ql.lisp index 26e0138..dbaee73 100644 --- a/bundle/ql.lisp +++ b/bundle/ql.lisp @@ -12,7 +12,12 @@ (defvar *ql-dist-url-format* "http://beta.quicklisp.org/dist/quicklisp/~a/distinfo.txt") -(let ((dist (if (or (eq :latest *ql-dist*) +(let ((pkgs (append '("pgloader" "buildapp") + (getf (read-from-string + (uiop:read-file-string + (uiop:merge-pathnames* "pgloader.asd" *pwd*))) + :depends-on))) + (dist (if (or (eq :latest *ql-dist*) (string= "latest" *ql-dist*)) (cdr ;; available-versions is an alist of (date . url), and the @@ -21,5 +26,5 @@ (ql-dist:available-versions (ql-dist:dist "quicklisp")))) (format nil *ql-dist-url-format* *ql-dist*)))) (ql-dist:install-dist dist :prompt nil :replace t) - (ql:bundle-systems '("pgloader" "buildapp") :to *bundle-dir*)) + (ql:bundle-systems pkgs :to *bundle-dir*)) (quit) diff --git a/src/regress/regress.lisp b/src/regress/regress.lisp index 30a9470..5f0a3f8 100644 --- a/src/regress/regress.lisp +++ b/src/regress/regress.lisp @@ -28,21 +28,16 @@ ;; once we are done running the load-file, compare the loaded data with ;; our expected data file - (bind ((expected-subdir (directory-namestring - (asdf:system-relative-pathname - :pgloader "test/regress/expected/"))) - (expected-data-file (make-pathname :defaults load-file - :type "out" - :directory expected-subdir)) - ((target-conn target-table-name gucs) (parse-target-pg-db-uri load-file)) + (bind ((expected-data-source + (regression-test-expected-data-source load-file)) + + ((target-conn target-table-name gucs) + (parse-target-pg-db-uri load-file)) + (target-table (create-table target-table-name)) (*pg-settings* (pgloader.pgsql:sanitize-user-gucs gucs)) (*pgsql-reserved-keywords* (list-reserved-keywords target-conn)) - (expected-data-source - (parse-source-string-for-type - :copy (uiop:native-namestring expected-data-file))) - ;; change target table-name schema (expected-data-target (let ((e-d-t (clone-connection target-conn))) @@ -58,7 +53,8 @@ (expected-target-table (create-table (cons "expected" (table-name target-table))))) - (log-message :log "Comparing loaded data against ~s" expected-data-file) + (log-message :log "Comparing loaded data against ~s" + (cdr (pgloader.sources::md-spec expected-data-source))) ;; prepare expected table in "expected" schema (with-pgsql-connection (target-conn) @@ -130,3 +126,27 @@ join pg_type t on t.oid = a.atttypid where c.oid = '~:[~*~a~;~a.~a~]'::regclass and attnum > 0 order by attnum" schema schema table-name))) + + +;;; +;;; Helper functions +;;; +(defun regression-test-expected-data-source (load-file) + "Returns the source specification where to read the expected result for + the given LOAD-FILE." + + (let* ((load-file-dir (uiop:pathname-directory-pathname + (if (uiop:absolute-pathname-p load-file) + load-file + (uiop:merge-pathnames* load-file + (uiop:getcwd))))) + (expected-subdir (uiop:native-namestring + (uiop:merge-pathnames* "regress/expected/" + load-file-dir))) + (expected-data-file (make-pathname :defaults load-file + :type "out" + :directory expected-subdir)) + (expected-data-source (uiop:native-namestring expected-data-file))) + + (parse-source-string-for-type :copy expected-data-source))) +