-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow tests to read data dynamically from a package #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I’d like to generalize this request to all programs, not just tests. Program may want to ship resources (images, stylesheets, documents, …) other than code, for use at runtime. Currently, Rust and Cargo should have a set of conventions (and possibly some library support) for having arbitrary files somewhere the program can use them with |
All subprocesses will now be invoked with CARGO_MANIFEST_DIR pointing at the root of the source directory that they are working on (compiling). This commit also reorganizes the version environment variables to use the new infrastructure. Closes rust-lang#433
In terms of installation, that's going to have to be a bridge that we cross at a later date. In terms of extending this to non-tests, would the environment variable solution work ok? |
So |
Yeah basically all cargo subprocesses (compilation, tests, running, etc) would have the environment variable. |
All subprocesses will now be invoked with CARGO_MANIFEST_DIR pointing at the root of the source directory that they are working on (compiling). This commit also reorganizes the version environment variables to use the new infrastructure. Closes #433
All subprocesses will now be invoked with CARGO_MANIFEST_DIR pointing at the root of the source directory that they are working on (compiling). This commit also reorganizes the version environment variables to use the new infrastructure. Closes rust-lang#433
All subprocesses will now be invoked with CARGO_MANIFEST_DIR pointing at the root of the source directory that they are working on (compiling). This commit also reorganizes the version environment variables to use the new infrastructure. Closes rust-lang#433
E.g. https://github.com/kmcallister/html5ever has tests that dynamically, at test time, (#431) construct tests from the test-case descriptions in https://github.com/html5lib/html5lib-tests submodule. At the moment it is using Makefiles to build, and just passes around an environment variable to point to the right place (i.e. the root directory) allowing the test runner to reach into the html5lib-tests folder at runtime.
Cargo doesn't provide an easy way to do this, other than relying on the position of the test runner binary itself. It would be nice to either enforce this position so we can rely on it, or, better, pass an environment variable pointing at the right place (while both building and running tests, maybe).
(Or something else that achieves the same goal.)
The text was updated successfully, but these errors were encountered: