Use new --prepend-library option to build and test the plugins.
authorMatt Birkholz <matt@birchwood-abbey.net>
Tue, 8 Mar 2016 18:49:59 +0000 (11:49 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Tue, 8 Mar 2016 18:49:59 +0000 (11:49 -0700)
36 files changed:
src/blowfish/Makefile.am
src/blowfish/blowfish-check.sh [new file with mode: 0755]
src/blowfish/check-scm [deleted file]
src/blowfish/check.scm [deleted file]
src/blowfish/compile.scm
src/blowfish/optiondb.scm [new file with mode: 0644]
src/gdbm/Makefile.am
src/gdbm/check-scm [deleted file]
src/gdbm/check.scm [deleted file]
src/gdbm/compile.scm
src/gdbm/gdbm-check.sh [new file with mode: 0755]
src/gdbm/optiondb.scm [new file with mode: 0644]
src/mcrypt/Makefile.am
src/mcrypt/check-scm [deleted file]
src/mcrypt/check.scm [deleted file]
src/mcrypt/compile.scm
src/mcrypt/mcrypt-check.sh [new file with mode: 0755]
src/mcrypt/optiondb.scm [new file with mode: 0644]
src/md5/Makefile.am
src/md5/check-scm [deleted file]
src/md5/check.scm [deleted file]
src/md5/compile.scm
src/md5/md5-check.sh [new file with mode: 0755]
src/md5/optiondb.scm [new file with mode: 0644]
src/mhash/Makefile.am
src/mhash/check-scm [deleted file]
src/mhash/check.scm [deleted file]
src/mhash/compile.scm
src/mhash/mhash-check.sh [new file with mode: 0755]
src/mhash/optiondb.scm [new file with mode: 0644]
tests/ffi/Makefile.am
tests/ffi/optiondb.scm [new file with mode: 0644]
tests/ffi/test-ffi [deleted file]
tests/ffi/test-ffi-wrapper.scm
tests/ffi/test-ffi.scm
tests/ffi/test-ffi.sh [new file with mode: 0755]

index c8fdbde843a1fc6da2a6e9154b498fc951a67619..34591f9d8182ecdb754ac506552f5cd114389002 100644 (file)
@@ -58,13 +58,14 @@ blowfish-const.scm: blowfish-const
 
 blowfish.bin blowfish.bci blowfish.com blowfish-@MIT_SCHEME_OS_SUFFIX@.pkd: \
   blowfish.scm blowfish-const.bin blowfish-types.bin
-       echo '(load "compile.scm")' | $(MIT_SCHEME_EXE) --batch-mode
+       echo '(load "compile.scm")' \
+       | $(MIT_SCHEME_EXE) --prepend-library . --batch-mode
 
 CLEANFILES = blowfish-const* blowfish-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-CLEANFILES += test
 
-TESTS = check-scm
+TESTS = blowfish-check.sh
+CLEANFILES += test
 
 install-data-hook:
        echo '(update-optiondb "$(DESTDIR)$(scmlibdir)/")' \
diff --git a/src/blowfish/blowfish-check.sh b/src/blowfish/blowfish-check.sh
new file mode 100755 (executable)
index 0000000..470c8d6
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Test the BLOWFISH option.
+
+set -e
+${MIT_SCHEME_EXE} --prepend-library . <<EOF
+(load-option 'BLOWFISH)
+(load "blowfish-check" (->environment '(blowfish)))
+EOF
diff --git a/src/blowfish/check-scm b/src/blowfish/check-scm
deleted file mode 100755 (executable)
index 4f89998..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo '(load "check.scm")' | ${MIT_SCHEME_EXE}
diff --git a/src/blowfish/check.scm b/src/blowfish/check.scm
deleted file mode 100644 (file)
index 2c6c1be..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#| -*-Scheme-*- |#
-
-;;;; Test the BLOWFISH option.
-
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
-   (load "blowfish-check" (->environment '(blowfish)))))
\ No newline at end of file
index d42c8b7c312759cd0ec384d9e34e00b55c6db446..29b4c5bf961ce33214764f4ed828617910fb1c22 100644 (file)
@@ -4,10 +4,5 @@
 
 (load-option 'CREF)
 (load-option 'FFI)
-(with-working-directory-pathname (directory-pathname (current-load-pathname))
-  (lambda ()
-    (with-system-library-directories
-       '("./")
-      (lambda ()
-       (compile-file "blowfish" '() (->environment '(RUNTIME)))))
-    (cref/generate-constructors "blowfish" 'ALL)))
\ No newline at end of file
+(compile-file "blowfish" '() (->environment '(RUNTIME)))
+(cref/generate-constructors "blowfish" 'ALL)
\ No newline at end of file
diff --git a/src/blowfish/optiondb.scm b/src/blowfish/optiondb.scm
new file mode 100644 (file)
index 0000000..24ddca0
--- /dev/null
@@ -0,0 +1,11 @@
+#| -*-Scheme-*- |#
+
+;;;; Test optiondb, includes the installed system's optiondb.
+
+(define-load-option 'BLOWFISH
+  (standard-system-loader "."))
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
index 5709e13e4209166a239c2e648441041f1a34fc43..2374b878297bcd435034243c2ba1520c73238964 100644 (file)
@@ -56,13 +56,14 @@ gdbm-const.scm: gdbm-const
        ./gdbm-const
 
 gdbm.bin gdbm.bci gdbm.com gdbm-unx.pkd: gdbm.scm gdbm-const.bin gdbm-types.bin
-       echo '(load "compile.scm")' | $(MIT_SCHEME_EXE) --batch-mode
+       echo '(load "compile.scm")' \
+       | $(MIT_SCHEME_EXE) --prepend-library . --batch-mode
 
 CLEANFILES = gdbm-const* gdbm-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-CLEANFILES += test
 
-TESTS = check-scm
+TESTS = gdbm-check.sh
+CLEANFILES += gdbm-check.db
 
 install-data-hook:
        echo '(update-optiondb "$(DESTDIR)$(scmlibdir)/")' \
diff --git a/src/gdbm/check-scm b/src/gdbm/check-scm
deleted file mode 100755 (executable)
index 4f89998..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo '(load "check.scm")' | ${MIT_SCHEME_EXE}
diff --git a/src/gdbm/check.scm b/src/gdbm/check.scm
deleted file mode 100644 (file)
index 62b8095..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#| -*-Scheme-*- |#
-
-;;;; Test the GDBM option.
-
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
-   (load "gdbm-check" (->environment '(gdbm)))))
\ No newline at end of file
index 2479f78ec45df06d7f11934873fc2c09a4fe00a4..685ee26c3ce82a6ba0b9abaabff8c50a0c8ac355 100644 (file)
@@ -4,10 +4,5 @@
 
 (load-option 'CREF)
 (load-option 'FFI)
-(with-working-directory-pathname (directory-pathname (current-load-pathname))
-  (lambda ()
-    (with-system-library-directories
-       '("./")
-      (lambda ()
-       (compile-file "gdbm" '() (->environment '(RUNTIME)))))
-    (cref/generate-constructors "gdbm" 'ALL)))
\ No newline at end of file
+(compile-file "gdbm" '() (->environment '(RUNTIME)))
+(cref/generate-constructors "gdbm" 'ALL)
\ No newline at end of file
diff --git a/src/gdbm/gdbm-check.sh b/src/gdbm/gdbm-check.sh
new file mode 100755 (executable)
index 0000000..805c281
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Test the GDBM option.
+
+set -e
+${MIT_SCHEME_EXE} --prepend-library . <<EOF
+(load-option 'GDBM)
+(load "gdbm-check" (->environment '(gdbm)))
+EOF
diff --git a/src/gdbm/optiondb.scm b/src/gdbm/optiondb.scm
new file mode 100644 (file)
index 0000000..12e8fe2
--- /dev/null
@@ -0,0 +1,9 @@
+#| -*-Scheme-*- |#
+
+(define-load-option 'GDBM
+  (standard-system-loader "."))
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
index 6c1cddbd855b29db7e362bd0c2db9c3f15901a31..8a230cb8b03475d222c25fce589ac6ae0ea4397c 100644 (file)
@@ -57,13 +57,14 @@ mcrypt-const.scm: mcrypt-const
 
 mcrypt.bin mcrypt.bci mcrypt.com mcrypt-unx.pkd: \
     mcrypt.scm mcrypt-const.bin mcrypt-types.bin
-       echo '(load "compile.scm")' | $(MIT_SCHEME_EXE) --batch-mode
+       echo '(load "compile.scm")' \
+       | $(MIT_SCHEME_EXE) --prepend-library . --batch-mode
 
 CLEANFILES = mcrypt-const* mcrypt-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-CLEANFILES += test
 
-TESTS = check-scm
+TESTS = mcrypt-check.sh
+CLEANFILES += encrypted decrypted
 
 install-data-hook:
        echo '(update-optiondb "$(DESTDIR)$(scmlibdir)/")' \
diff --git a/src/mcrypt/check-scm b/src/mcrypt/check-scm
deleted file mode 100755 (executable)
index 4f89998..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo '(load "check.scm")' | ${MIT_SCHEME_EXE}
diff --git a/src/mcrypt/check.scm b/src/mcrypt/check.scm
deleted file mode 100644 (file)
index f47a4ed..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#| -*-Scheme-*- |#
-
-;;;; Test the MCRYPT option.
-
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
-   (load "mcrypt-check" (->environment '(mcrypt)))))
\ No newline at end of file
index c5576c077bb2a4c0999b351e5d0c04e92a5b65d7..a83ce932ec8b50a10a2d98ebb4edc6ab83be3e2f 100644 (file)
@@ -4,10 +4,5 @@
 
 (load-option 'CREF)
 (load-option 'FFI)
-(with-working-directory-pathname (directory-pathname (current-load-pathname))
-  (lambda ()
-    (with-system-library-directories
-       '("./")
-      (lambda ()
-       (compile-file "mcrypt" '() (->environment '(RUNTIME)))))
-    (cref/generate-constructors "mcrypt" 'ALL)))
\ No newline at end of file
+(compile-file "mcrypt" '() (->environment '(RUNTIME)))
+(cref/generate-constructors "mcrypt" 'ALL)
\ No newline at end of file
diff --git a/src/mcrypt/mcrypt-check.sh b/src/mcrypt/mcrypt-check.sh
new file mode 100755 (executable)
index 0000000..553337d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Test the MCRYPT option.
+
+set -e
+${MIT_SCHEME_EXE} --prepend-library . <<EOF
+(load-option 'MCRYPT)
+(load "mcrypt-check" (->environment '(mcrypt)))
+EOF
diff --git a/src/mcrypt/optiondb.scm b/src/mcrypt/optiondb.scm
new file mode 100644 (file)
index 0000000..c442a1a
--- /dev/null
@@ -0,0 +1,9 @@
+#| -*-Scheme-*- |#
+
+(define-load-option 'MCRYPT
+  (standard-system-loader "."))
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
index 132ed7a50a0134736965a00549b172c35677c9ba..0f894dd248d974439cc3b3294b198c626a3799f4 100644 (file)
@@ -57,13 +57,14 @@ md5-const.scm: md5-const
        ./md5-const
 
 md5.bin md5.bci md5.com md5-unx.pkd: md5.scm md5-const.bin md5-types.bin
-       echo '(load "compile.scm")' | $(MIT_SCHEME_EXE) --batch-mode
+       echo '(load "compile.scm")' \
+       | $(MIT_SCHEME_EXE) --prepend-library . --batch-mode
 
 CLEANFILES = md5-const* md5-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-CLEANFILES += test
 
-TESTS = check-scm
+TESTS = md5-check.sh
+CLEANFILES += sample
 
 install-data-hook:
        echo '(update-optiondb "$(DESTDIR)$(scmlibdir)/")' \
diff --git a/src/md5/check-scm b/src/md5/check-scm
deleted file mode 100755 (executable)
index 4f89998..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo '(load "check.scm")' | ${MIT_SCHEME_EXE}
diff --git a/src/md5/check.scm b/src/md5/check.scm
deleted file mode 100644 (file)
index 060027a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#| -*-Scheme-*- |#
-
-;;;; Test the MD5 option.
-
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
-   (load "md5-check" (->environment '(md5)))))
\ No newline at end of file
index 93bc0da8beb42c57f3cd4292e5dfc7a2b98801b6..ddf0ede07e7011e01edd39ea4ead7f76b081e04d 100644 (file)
@@ -4,10 +4,5 @@
 
 (load-option 'CREF)
 (load-option 'FFI)
-(with-working-directory-pathname (directory-pathname (current-load-pathname))
-  (lambda ()
-    (with-system-library-directories
-       '("./")
-      (lambda ()
-       (compile-file "md5" '() (->environment '(RUNTIME)))))
-    (cref/generate-constructors "md5" 'ALL)))
\ No newline at end of file
+(compile-file "md5" '() (->environment '(RUNTIME)))
+(cref/generate-constructors "md5" 'ALL)
\ No newline at end of file
diff --git a/src/md5/md5-check.sh b/src/md5/md5-check.sh
new file mode 100755 (executable)
index 0000000..a8f05d0
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Test the MD5 option.
+
+set -e
+${MIT_SCHEME_EXE} --prepend-library . <<EOF
+(load-option 'MD5)
+(load "md5-check" (->environment '(md5)))
+EOF
diff --git a/src/md5/optiondb.scm b/src/md5/optiondb.scm
new file mode 100644 (file)
index 0000000..bb18b93
--- /dev/null
@@ -0,0 +1,9 @@
+#| -*-Scheme-*- |#
+
+(define-load-option 'MD5
+  (standard-system-loader "."))
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
index aab510bb5d31b6b0bc17d15d692607a2627f4dd2..f5f1f93472c58597d882407796d237f8a4110471 100644 (file)
@@ -57,13 +57,14 @@ mhash-const.scm: mhash-const
 
 mhash.bin mhash.bci mhash.com mhash-unx.pkd: \
     mhash.scm mhash-const.bin mhash-types.bin
-       echo '(load "compile.scm")' | $(MIT_SCHEME_EXE) --batch-mode
+       echo '(load "compile.scm")' \
+       | $(MIT_SCHEME_EXE) --prepend-library . --batch-mode
 
 CLEANFILES = mhash-const* mhash-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-CLEANFILES += test
 
-TESTS = check-scm
+TESTS = mhash-check.sh
+CLEANFILES += sample
 
 install-data-hook:
        echo '(update-optiondb "$(DESTDIR)$(scmlibdir)/")' \
diff --git a/src/mhash/check-scm b/src/mhash/check-scm
deleted file mode 100755 (executable)
index 4f89998..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo '(load "check.scm")' | ${MIT_SCHEME_EXE}
diff --git a/src/mhash/check.scm b/src/mhash/check.scm
deleted file mode 100644 (file)
index a03b9f7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#| -*-Scheme-*- |#
-
-;;;; Test the MHASH option.
-
-(load "make")
-(with-system-library-directories
- '("./")
- (lambda ()
-   (load "mhash-check" (->environment '(mhash)))))
\ No newline at end of file
index 9719d778101918d1987c6064ce728be96644afb2..1103428d81e9da44815ed763cfb50545f8bd36ff 100644 (file)
@@ -4,10 +4,5 @@
 
 (load-option 'CREF)
 (load-option 'FFI)
-(with-working-directory-pathname (directory-pathname (current-load-pathname))
-  (lambda ()
-    (with-system-library-directories
-       '("./")
-      (lambda ()
-       (compile-file "mhash" '() (->environment '(RUNTIME)))))
-    (cref/generate-constructors "mhash" 'ALL)))
\ No newline at end of file
+(compile-file "mhash" '() (->environment '(RUNTIME)))
+(cref/generate-constructors "mhash" 'ALL)
\ No newline at end of file
diff --git a/src/mhash/mhash-check.sh b/src/mhash/mhash-check.sh
new file mode 100755 (executable)
index 0000000..038ded0
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Test the MHASH option.
+
+set -e
+${MIT_SCHEME_EXE} --prepend-library . <<EOF
+(load-option 'MHASH)
+(load "mhash-check" (->environment '(mhash)))
+EOF
diff --git a/src/mhash/optiondb.scm b/src/mhash/optiondb.scm
new file mode 100644 (file)
index 0000000..f4b04f3
--- /dev/null
@@ -0,0 +1,9 @@
+#| -*-Scheme-*- |#
+
+(define-load-option 'MHASH
+  (standard-system-loader "."))
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
index 5f996252d10f48d88121fff5c2bdd1b523bd60f1..c2a98f1911018874764b2f665d0f2e1b6ec53432 100644 (file)
@@ -54,5 +54,3 @@ ffi-test.bin ffi-test.bci ffi-test.com ffi-test-unx.pkd: \
 
 CLEANFILES = ffi-test-const* ffi-test-shim.c
 CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
-
-TESTS = test-ffi
diff --git a/tests/ffi/optiondb.scm b/tests/ffi/optiondb.scm
new file mode 100644 (file)
index 0000000..e605f2d
--- /dev/null
@@ -0,0 +1,8 @@
+#| -*-Scheme-*- |#
+
+;;;; Test optiondb, includes the installed system's optiondb.
+
+(further-load-options
+ (merge-pathnames "optiondb"
+                 (cadr (access library-directory-path
+                               (->environment '(runtime pathname))))))
\ No newline at end of file
diff --git a/tests/ffi/test-ffi b/tests/ffi/test-ffi
deleted file mode 100755 (executable)
index c296e99..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-echo '(load "test-ffi.scm")' \
-| ../../src/microcode/scheme --library ../../src/lib --batch-mode
index 54e444b59d7523e59ad756b07dab40fc8963e748..36058b5f57d1f6e18ab516e02dc21063d71110d2 100644 (file)
@@ -2,14 +2,15 @@
 
 (C-include "ffi-test")
 
-(define test-ffi
-  (let ((libdir (merge-pathnames "./")))
-    (named-lambda (test-ffi)
-      (with-system-library-directories (list libdir)
-       (lambda ()
-         (test-ffi*))))))
+(define (assert-equal value expected . properties)
+  (if (not (equal? value expected))
+      (error "Assert-equal failed:" value expected properties)))
 
-(define (test-ffi*)
+(define (assert-= value expected . properties)
+  (if (not (equal? value expected))
+      (error "Assert-= failed:" value expected properties)))
+
+(define (test-ffi)
   (let* ((struct (malloc (c-sizeof "TestStruct") '|TestStruct|))
         (string "input string")
         (pi (* 4 (atan 1 1)))
index ba4724c32aae97616ad7b50daab9708cd329d9f2..5d4e8065d96f88c6131a27e7c850e88ec82d71bf 100644 (file)
@@ -30,19 +30,17 @@ USA.
   (lambda ()
     (let ((port (notification-output-port)))
       (fresh-line port)
-      (write-string "make all in tests/ffi/" port)
+      (write-string "./autobuild.sh in tests/ffi/" port)
       (newline port))
     (let ((status (run-synchronous-subprocess "sh" '("./autobuild.sh"))))
       (if (not (zero? status))
-         (begin
-           (write-string "../tests/ffi/test-ffi.scm:0: Test FFI build failed."
-                         (notification-output-port))
-           (error "Test FFI build failed:" status))
-         (begin
-           (parameterize ((param:suppress-loading-message? #t))
-             (load-option 'FFI))
-           (with-system-library-directories '("./")
-             (lambda ()
-               (compile-file "test-ffi-wrapper")))
-           (load "test-ffi-wrapper")
-           (define-test 'ffi test-ffi))))))
\ No newline at end of file
+         (error "Test FFI build failed:" status)))
+    (define-test 'ffi
+      (let ((cwd (working-directory-pathname)))
+       (named-lambda (test-ffi)
+         (with-working-directory-pathname cwd
+           (lambda ()
+             (let ((status
+                    (run-synchronous-subprocess "sh" '("./test-ffi.sh"))))
+               (if (not (zero? status))
+                   (error "Test FFI check failed:" status))))))))))
\ No newline at end of file
diff --git a/tests/ffi/test-ffi.sh b/tests/ffi/test-ffi.sh
new file mode 100755 (executable)
index 0000000..8793b0c
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+../../src/microcode/scheme --library .:../../src/lib --batch-mode <<EOF
+(begin
+  (parameterize ((param:suppress-loading-message? #t))
+    (load-option 'FFI))
+  (compile-file "test-ffi-wrapper")
+  (load "test-ffi-wrapper")
+  (test-ffi))
+EOF