summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gpgscm/ffi.c2
-rw-r--r--tests/gpgscm/tests.scm13
-rw-r--r--tests/openpgp/run-tests.scm4
3 files changed, 14 insertions, 5 deletions
diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index c37bf1daa..57de28614 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -1248,7 +1248,7 @@ ffi_init (scheme *sc, const char *argv0, int argc, const char **argv)
ffi_define_function (sc, open);
ffi_define_function (sc, fdopen);
ffi_define_function (sc, close);
- ffi_define_function (sc, mkdtemp);
+ ffi_define_function_name (sc, "_mkdtemp", mkdtemp);
ffi_define_function (sc, unlink);
ffi_define_function (sc, unlink_recursively);
ffi_define_function (sc, rename);
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index f97b22e66..8283ebad9 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -247,10 +247,19 @@
(chdir ,cwd-sym)
,result-sym)))
+;; Make a temporary directory. If arguments are given, they are
+;; joined using path-join, and must end in a component ending in
+;; "XXXXXX". If no arguments are given, a suitable location and
+;; generic name is used.
+(define (mkdtemp . components)
+ (_mkdtemp (if (null? components)
+ (path-join (getenv "TMP") "gpgscm-XXXXXX")
+ (apply path-join components))))
+
(macro (with-temporary-working-directory form)
(let ((result-sym (gensym)) (cwd-sym (gensym)) (tmp-sym (gensym)))
`(let* ((,cwd-sym (getcwd))
- (,tmp-sym (mkdtemp (path-join (getenv "TMP") "gpgscm-XXXXXX")))
+ (,tmp-sym (mkdtemp))
(_ (chdir ,tmp-sym))
(,result-sym (begin ,@(cdr form))))
(chdir ,cwd-sym)
@@ -259,7 +268,7 @@
(define (make-temporary-file . args)
(canonical-path (path-join
- (mkdtemp (path-join (getenv "TMP") "gpgscm-XXXXXX"))
+ (mkdtemp)
(if (null? args) "a" (car args)))))
(define (remove-temporary-file filename)
diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
index 367c64116..e3b6b6a47 100644
--- a/tests/openpgp/run-tests.scm
+++ b/tests/openpgp/run-tests.scm
@@ -128,7 +128,7 @@
(unlink-recursively t::directory)
(t::report)) results::procs)
(exit (results::report)))
- (let* ((wd (mkdtemp "gpgscm-XXXXXX"))
+ (let* ((wd (mkdtemp))
(test (car tests'))
(test' (test::set-directory wd))
(setup' (setup::set-directory wd)))
@@ -154,7 +154,7 @@
(unlink-recursively t::directory))
results::procs)
(exit (results::report)))
- (let* ((wd (mkdtemp "gpgscm-XXXXXX"))
+ (let* ((wd (mkdtemp))
(test (car tests'))
(test' (test::set-directory wd))
(setup' (setup::set-directory wd)))