improve zo-{parse,marshal} test

After a RacketCS build, a random ".zo" file may not work for the
current Racket variant, so only try ".zo" files that can work.
This commit is contained in:
Matthew Flatt 2018-06-27 17:21:54 -06:00
parent fc7c4bb42c
commit 9c104a8ea4

View File

@ -61,7 +61,15 @@ exec racket -t "$0" -- -s -t 60 -v -R $*
(for ([sp (in-list (maybe-randomize-list (directory-list p)))])
(for-zos ! (build-path p sp)))]
[(regexp-match #rx"\\.zo$" p-str)
(! p-str)]))
(when (valid-bytecode? p-str)
(! p-str))]))
(define (valid-bytecode? f)
;; Make sure the file makes sense for the current platform
(with-handlers ([exn:fail:read? (lambda (exn) #f)])
(parameterize ([read-accept-compiled #t])
(call-with-input-file* f read))
#t))
(define-runtime-path zo-test-worker-path "zo-test-worker.rkt")
(define racket-path (path->string (find-exe)))