[functional-tests/temp-file] temp-file-sized
This commit is contained in:
parent
de2e243408
commit
970cd314de
@ -7,8 +7,10 @@
|
|||||||
with-dir
|
with-dir
|
||||||
with-temp-file-thunk
|
with-temp-file-thunk
|
||||||
with-temp-file-containing-thunk
|
with-temp-file-containing-thunk
|
||||||
|
with-temp-file-sized-thunk
|
||||||
with-temp-file
|
with-temp-file
|
||||||
with-temp-file-containing
|
with-temp-file-containing
|
||||||
|
with-temp-file-sized
|
||||||
disable-unlink)
|
disable-unlink)
|
||||||
|
|
||||||
(import (chezscheme)
|
(import (chezscheme)
|
||||||
@ -87,6 +89,26 @@
|
|||||||
(with-temp-file-containing (rest ...)
|
(with-temp-file-containing (rest ...)
|
||||||
b1 b2 ...))))))
|
b1 b2 ...))))))
|
||||||
|
|
||||||
|
(define (with-temp-file-sized-thunk size fn)
|
||||||
|
(with-temp-file-thunk
|
||||||
|
(lambda (path)
|
||||||
|
(let ((cmd (fmt #f (dsp "fallocate -l ") (wrt size) (dsp " ") (dsp path))))
|
||||||
|
(system cmd)
|
||||||
|
(fn path)))))
|
||||||
|
|
||||||
|
(define-syntax with-temp-file-sized
|
||||||
|
(syntax-rules ()
|
||||||
|
((_ ((v size)) b1 b2 ...)
|
||||||
|
(with-temp-file-sized-thunk
|
||||||
|
size
|
||||||
|
(lambda (v)
|
||||||
|
b1 b2 ...)))
|
||||||
|
|
||||||
|
((_ ((v size) rest ...) b1 b2 ...)
|
||||||
|
(with-temp-file-sized-thunk
|
||||||
|
size (lambda (v)
|
||||||
|
(with-temp-file-sized (rest ...) b1 b2 ...))))))
|
||||||
|
|
||||||
;;-------------------------
|
;;-------------------------
|
||||||
|
|
||||||
(define should-unlink #t)
|
(define should-unlink #t)
|
||||||
|
Loading…
Reference in New Issue
Block a user