-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: allow test cases to use in-tree data files
Similar to angband/angband#5518 , but test cases can use one of two sets of paths with init_file_paths(): the paths used by main.c or the path set by the preprocessor macro, TEST_DEFAULT_PATH. The latter is the default, but the user has the option to force the former via a command-line argument, -f, to the test case or run-tests or by setting an environment variable, FORCE_PATH, to a non-empty value. That's to allow for testing against the installed version of the data files without recompiling the test cases. Unlike angband/angband#5518 , builds using configure or CMake use a relative path to the in-tree data files: they set TEST_OVERRIDE_PATHS which triggers TEST_DEFAULT_PATH to be "." + PATH_SEP + "lib" + PATH_SEP in unit-test.h. That simplifies getting test cases to work in environments like MSYS2 on Windows (paths constructed in the build system are Unix-style and need to be processed through cygpath to get a DOS-style path appropriate for hardwiring into an executable). Running the test cases through the build system (i.e. "make tests" when using configure) handles setting the working directory so the relative path works. With configure and a build done from the top-level of the distribution, directly running run-tests or a test case from the top-level directory of the distribution will work as expected (i.e. "src/tests/run-tests" or "src/tests/effects/chain.exe"). Like angband/angband#5518 , adds a check target to Makefile as a synonym for the tests target.
- Loading branch information
1 parent
8c1d828
commit 332b0ef
Showing
11 changed files
with
187 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.