Each tests gets its own planet directory

This commit is contained in:
Jay McCarthy 2011-11-15 07:23:05 -07:00
parent c0f8fef313
commit 34b64f40a9

View File

@ -90,6 +90,21 @@
(define-syntax-rule (with-temporary-directory e) (define-syntax-rule (with-temporary-directory e)
(call-with-temporary-directory (lambda () e))) (call-with-temporary-directory (lambda () e)))
(define (call-with-temporary-planet-directory thunk)
(define tempdir
(build-path (current-directory)
(symbol->string (gensym 'planetdir))))
(dynamic-wind
(lambda ()
(make-directory* tempdir))
(lambda ()
(with-env (["PLTPLANETDIR" (path->string tempdir)])
(thunk)))
(lambda ()
(delete-directory/files tempdir))))
(define-syntax-rule (with-temporary-planet-directory e)
(call-with-temporary-planet-directory (lambda () e)))
(define (call-with-temporary-home-directory thunk) (define (call-with-temporary-home-directory thunk)
(define new-dir (define new-dir
(make-temporary-file (make-temporary-file
@ -260,6 +275,7 @@
(format ":~a" (format ":~a"
(cpu->child (cpu->child
(current-worker)))]) (current-worker)))])
(with-temporary-planet-directory
(with-temporary-home-directory (with-temporary-home-directory
(with-temporary-directory (with-temporary-directory
(run/collect/wait/log (run/collect/wait/log
@ -267,7 +283,7 @@
#:timeout pth-timeout #:timeout pth-timeout
#:env (current-env) #:env (current-env)
(first l) (first l)
(rest l)))))))) (rest l)))))))))
(λ () (λ ()
(semaphore-post dir-sema)))))] (semaphore-post dir-sema)))))]
[else [else