From 9c104a8ea48e3408bfe3e47d435ddcce450e0f03 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 27 Jun 2018 17:21:54 -0600 Subject: [PATCH] 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. --- pkgs/compiler-test/tests/compiler/zo-test.rkt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/compiler-test/tests/compiler/zo-test.rkt b/pkgs/compiler-test/tests/compiler/zo-test.rkt index 6bd475bbaa..8841a97bb2 100755 --- a/pkgs/compiler-test/tests/compiler/zo-test.rkt +++ b/pkgs/compiler-test/tests/compiler/zo-test.rkt @@ -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)))