-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
I need a test binary to read some data files from the project's repository and write some new files to a temporary location.
I've done this before with CMake, which provides variables like CMAKE_SOURCE_DIR
, CMAKE_CURRENT_SOURCE_DIR
, CMAKE_BINARY_DIR
(doc) which can be substituted into "configured" source code/script files or passed to tests. The distinction between source and binary directories is important especially since the source directory may not be writable; is this also the case with Cargo?
It is possible for Cargo tests to get the path to the current binary as well as the working directory, but I'd prefer a documented way of getting the project's root directory (e.g. via an environment variable or optional command-line argument), and some recommendations on where to put temporary files.