racket/collects/tests/zo-path.rkt
Matthew Flatt 937cdf51d7 change `current-write-relative-directory' to support more path conversions
In particular, allow a pair of a relative-to directory and a base
directory. Paths that syntactically extend the base directory are
recorded as relative to the relative-to directory (which must
syntactically extend the base directory).

The compilation manager now sets the parameter to a pair with
the base directory as the main collection directory, if the source
file's path extends that directory's path.

This generalization solves problems created by cross-module inlining,
where the source location of a procedure in bytecode can now be in a
different file than the enclosing module's file.

Also add a test that checks whether the build directory shows up
in any ".zo", ".dep", or documentation ".html" files.

Closes PR 12549
2012-02-10 06:17:18 -07:00

34 lines
953 B
Racket

#lang racket
(require setup/dirs)
;; Paths from the biuld location shouldn't show up in bytecode files
;; or documentation. Check ".zo", ".dep", and ".html" files in the
;; build on the assumption that the first three elements of the
;; build path are unique enough that they shouldn't appear anywhere.
(define rx:dir
(byte-regexp
(regexp-quote
(path->bytes
(apply build-path
(take (explode-path (find-collects-dir))
3))))))
(define (check-content rx:name)
(lambda (name kind v)
(when (regexp-match? rx:name name)
(call-with-input-file* name
(lambda (in)
(when (regexp-match? rx:dir in)
(eprintf "Found ~s in ~s\n" rx:dir name)))))))
(fold-files (check-content #rx"[.](?:zo|dep)$")
(void)
(find-collects-dir))
;; Check rendered docs, too:
(fold-files (check-content #rx"[.](?:html)$")
(void)
(find-doc-dir))