Cleanup junk files in a bunch of racket tests.
This commit is contained in:
parent
793ee71e69
commit
dd9d85feec
|
@ -1503,6 +1503,9 @@
|
|||
(err/rt-test (filesystem-root-list) (fs-reject? 'filesystem-root-list))
|
||||
(err/rt-test (find-system-path 'temp-dir) (fs-reject? 'find-system-path)))
|
||||
|
||||
;; Cleanup files created above
|
||||
(for ([f '("tmp1" "tmp2" "tmp3")] #:when (file-exists? f)) (delete-file f))
|
||||
|
||||
;; Network - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
(define (net-reject? who host port what)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
(write-to-file "\u03BB" tmp-name #:exists 'truncate)
|
||||
(test #"\"\316\273\"" file->bytes tmp-name)
|
||||
(test "\u03BB" file->value tmp-name)
|
||||
(define tmp-name "tmp0-filelib")
|
||||
(when (file-exists? tmp-name) (delete-file tmp-name))
|
||||
|
||||
(define-syntax-rule (err/rt-chk-test (op arg ...))
|
||||
(err/rt-test (op arg ...) (check-msg 'op)))
|
||||
|
|
|
@ -860,22 +860,26 @@
|
|||
(define am-s (compile-m (a-expr #t) '()))
|
||||
(define b-s (compile-m b-expr (list a-s)))
|
||||
|
||||
(define (go a-s)
|
||||
(parameterize ([current-namespace (make-base-namespace)])
|
||||
(parameterize ([read-accept-compiled #t])
|
||||
(eval (read (open-input-bytes a-s)))
|
||||
(define temp-dir (find-system-path 'temp-dir))
|
||||
(define dir (build-path temp-dir "compiled"))
|
||||
(make-directory* dir)
|
||||
(define dir-existed? (directory-exists? dir))
|
||||
(unless dir-existed? (make-directory dir))
|
||||
|
||||
(define (go a-s)
|
||||
(parameterize ([current-namespace (make-base-namespace)]
|
||||
[read-accept-compiled #t])
|
||||
(eval (read (open-input-bytes a-s)))
|
||||
(with-output-to-file (build-path dir "check-gen_rkt.zo")
|
||||
#:exists 'truncate
|
||||
(lambda () (write-bytes b-s)))
|
||||
((dynamic-require (build-path temp-dir "check-gen.rkt") 'b) 10)
|
||||
(delete-file (build-path dir "check-gen_rkt.zo")))))
|
||||
((dynamic-require (build-path temp-dir "check-gen.rkt") 'b) 10)))
|
||||
;; Triger JIT generation with constant function as `a':
|
||||
(go a-s)
|
||||
;; Check that we don't crash when trying to use a different `a':
|
||||
(err/rt-test (go am-s) exn:fail?))
|
||||
(err/rt-test (go am-s) exn:fail?)
|
||||
;; Cleanup
|
||||
(delete-file (build-path dir "check-gen_rkt.zo"))
|
||||
(unless dir-existed? (delete-directory dir)))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
(Section 'parameters)
|
||||
|
||||
(let ([p (open-output-file "tmp5" #:exists 'replace)])
|
||||
(define temp-compiled-file
|
||||
(path->string (build-path (find-system-path 'temp-dir) "param-temp-file")))
|
||||
|
||||
(let ([p (open-output-file temp-compiled-file #:exists 'replace)])
|
||||
(display (compile '(cons 1 2)) p)
|
||||
(close-output-port p))
|
||||
|
||||
|
@ -201,7 +204,7 @@
|
|||
#f)
|
||||
(list read-accept-compiled
|
||||
(list #t #f)
|
||||
'(let ([p (open-input-file "tmp5")])
|
||||
`(let ([p (open-input-file ,temp-compiled-file)])
|
||||
(dynamic-wind
|
||||
void
|
||||
(lambda () (void (read p)))
|
||||
|
@ -345,7 +348,7 @@
|
|||
|
||||
(list current-load
|
||||
(list (current-load) (lambda (f e) (error "This won't do it")))
|
||||
'(load "tmp5")
|
||||
`(load ,temp-compiled-file)
|
||||
exn:fail?
|
||||
(list "bad setting" zero-arg-proc one-arg-proc))
|
||||
(list current-eval
|
||||
|
@ -523,4 +526,6 @@
|
|||
; Test current-library-collection-paths?
|
||||
; Test require-library-use-compiled?
|
||||
|
||||
(when (file-exists? temp-compiled-file) (delete-file temp-compiled-file))
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -57,14 +57,12 @@
|
|||
(test-pipe #t))
|
||||
(let ([test-file
|
||||
(lambda (commit-eof?)
|
||||
(let ([p (begin
|
||||
(with-output-to-file "tmp8"
|
||||
(lambda ()
|
||||
(write-string "hello"))
|
||||
#:exists 'truncate/replace)
|
||||
(open-input-file "tmp8"))])
|
||||
(with-output-to-file "tmp8" #:exists 'truncate/replace
|
||||
(lambda () (write-string "hello")))
|
||||
(define p (open-input-file "tmp8"))
|
||||
(test-hello-port p commit-eof?)
|
||||
(close-input-port p)))])
|
||||
(close-input-port p)
|
||||
(delete-file "tmp8"))])
|
||||
(test-file #f)
|
||||
(test-file #t))
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
(load-relative "loadtest.rktl")
|
||||
|
||||
(Section 'serialization)
|
||||
|
@ -485,7 +484,8 @@
|
|||
(define s (dynamic-require `(submod ,fn main) 's))
|
||||
(let ([o (open-output-bytes)])
|
||||
(write s o)
|
||||
(test s read (open-input-string (get-output-string o)))))
|
||||
(test s read (open-input-string (get-output-string o))))
|
||||
(delete-file fn))
|
||||
|
||||
|
||||
;; ----------------------------------------
|
||||
|
|
|
@ -458,4 +458,6 @@
|
|||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(for ([f (list tmpfile tmpfile2)] #:when (file-exists? f)) (delete-file f))
|
||||
|
||||
(report-errs)
|
||||
|
|
Loading…
Reference in New Issue
Block a user