src/Makefile.am, src/test-base.lisp: Check version numbers match.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 09:58:38 +0000 (10:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 6 Sep 2015 23:19:53 +0000 (00:19 +0100)
We have version numbers in two places, and that's no good, but I can't
see a good way of generating the Lisp package version from the Git
version, so I'm just going to add a test that they match.

It's not a perfect test, but it ought to do.

src/Makefile.am
src/test-base.lisp

index 5b8aa21..b10f673 100644 (file)
@@ -129,7 +129,9 @@ check-local:
        ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
        $(CL_LAUNCH) -l $(LISPSYS) -s sod-test +I -S $$true_srcdir/: \
                -i '(handler-case ;\
-                     (asdf:test-system "sod") ;\
+                     (progn ;\
+                       (setf sod-test:*build-version* "$(VERSION)") ;\
+                       (asdf:test-system "sod")) ;\
                      (error (cond) ;\
                        (format *error-output* "ERR: ~A~%" cond) ;\
                        (cl-launch:quit 1)))'
index ffc8e19..f7210ab 100644 (file)
                               rather than `~A'."
                          object print string))))
 
+(defclass base-test (test-case) ())
+(add-test *sod-test-suite* (get-suite base-test))
+
+(export '*build-version*)
+(defvar *build-version* nil)
+
+(def-test-method check-version ((test base-test) :run nil)
+  (unless (or (null *build-version*)
+             (and (>= (length *build-version*) (length *sod-version*))
+                  (string= *build-version* *sod-version*
+                           :end1 (length *sod-version*))))
+    (failure "Build version ~A doesn't match package version ~A."
+            *build-version* *sod-version*)))
+
 (defun run-tests (&optional which)
   (textui-test-run (acond
                     ((null which) *sod-test-suite*)