From 63aa90c7487c361ce4786f79ae2d5fca1984da78 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 21 Feb 2021 17:52:36 -0700 Subject: [PATCH] repair sandbox test for compile-file-roots with extra paths --- pkgs/racket-test-core/tests/racket/sandbox.rktl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/racket-test-core/tests/racket/sandbox.rktl b/pkgs/racket-test-core/tests/racket/sandbox.rktl index 30034874f0..09df86253f 100644 --- a/pkgs/racket-test-core/tests/racket/sandbox.rktl +++ b/pkgs/racket-test-core/tests/racket/sandbox.rktl @@ -336,7 +336,16 @@ "compiled" (car (use-compiled-file-paths)))] [list-lib (strpath racketlib "list.rkt")] - [list-zo (strpath racketlib compiled "list_rkt.zo")] + [list-zo (for/or ([root (in-list (current-compiled-file-roots))]) + (define file (cond + [(eq? root 'same) + (build-path racketlib compiled "list_rkt.zo")] + [(relative-path? root) + (build-path racketlib root compiled "list_rkt.zo")] + [else + (build-path (reroot-path racketlib root) compiled "list_rkt.zo")])) + (and (file-exists? file) + (path->string file)))] [test-lib (strpath tmp "sandbox-test.rkt")] [test-zo (strpath tmp compiled "sandbox-test_rkt.zo")] [test2-lib (strpath tmp "sandbox-test2.rkt")] @@ -480,7 +489,7 @@ (cp ,list-lib ,test-lib) (cp ,list-zo ,test-zo) (cp ,list-lib ,test2-lib) (cp ,list-zo ,test2-zo) ;; bytecode from test-lib is bad, even when we can read/write to it - (load/use-compiled ,test-zo) =err> "cannot use unsafe linklet loaded with non-original code inspector" + (load ,test-zo) =err> "cannot use unsafe linklet loaded with non-original code inspector" ;; bytecode from test2-lib is explicitly allowed (load/use-compiled ,test2-lib) (require 'list) => (void))