diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-02-11 23:04:33 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-02-15 10:05:37 +0100 |
commit | cb5b3a38e0c91f6b4c6b9ce9770649c6486c331a (patch) | |
tree | c3e0c92782a03113d584d88c240105906008031e /guile/modules | |
parent | fcf6f8427c55e8b068ada8735098b46597dadc71 (diff) | |
download | gnutls-cb5b3a38e0c91f6b4c6b9ce9770649c6486c331a.tar.gz |
guile: tests: Add Guile 2.2 compatibility layer.
This allows tests to run with Guile 2.1/2.2.
* guile/modules/gnutls/build/tests.scm (define-replacement) [guile-2]:
New macro.
(uniform-vector-read!, uniform-vector-write) [guile-2]: New procedures.
* doc/gnutls-guile.texi (Guile Preparations): Mention 2.2.
Diffstat (limited to 'guile/modules')
-rw-r--r-- | guile/modules/gnutls/build/tests.scm | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/guile/modules/gnutls/build/tests.scm b/guile/modules/gnutls/build/tests.scm index 5a03ce7474..2fe6be2a85 100644 --- a/guile/modules/gnutls/build/tests.scm +++ b/guile/modules/gnutls/build/tests.scm @@ -67,8 +67,29 @@ process exits upon failure." ((_ args ...) body)))))) (export define-syntax-rule)) - (else - #t)) + + (else ;2.0 and 2.2 + (use-modules (rnrs io ports) + (rnrs bytevectors)) + + (define-syntax-rule (define-replacement (name args ...) body ...) + ;; Define a compatibility replacement for NAME, if needed. + (define-public name + (if (module-defined? the-scm-module 'name) + (module-ref the-scm-module 'name) + (lambda (args ...) + body ...)))) + + ;; 'uniform-vector-read!' and 'uniform-vector-write' are deprecated in 2.0 + ;; and absent in 2.2. + + (define-replacement (uniform-vector-read! buf port) + (get-bytevector-n! port buf + 0 (bytevector-length buf))) + + (define-replacement (uniform-vector-write buf port) + (put-bytevector port buf)))) + (define-syntax-rule (with-child-process pid parent child) "Fork and evaluate expression PARENT in the current process, with PID bound @@ -76,3 +97,7 @@ to the PID of its child process; the child process evaluated CHILD." (call-with-child-process (lambda () child) (lambda (pid) parent))) + +;;; Local Variables: +;;; eval: (put 'define-replacement 'scheme-indent-function 1) +;;; End: |