Skip to content
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

Tests fail if build directory is outside repo #398

Open
lsawade opened this issue Jan 15, 2025 · 0 comments
Open

Tests fail if build directory is outside repo #398

lsawade opened this issue Jan 15, 2025 · 0 comments

Comments

@lsawade
Copy link
Collaborator

lsawade commented Jan 15, 2025

The bug

A lot of the tests require files that need to be read as part of the test execution. E.g. specfem_config.yml files. The paths are defined as relative paths from specfempp/build/tests/unit-tests/ to specfempp/tests/unit-tests/ and will therefore fail if the tests are built in e.g.
specfempp/../build/.

Solution

One solution is to use CMake to actually manage test running through the add_test() directive, and define a working directory for each test:

add_executable(testA testA.cpp)
add_test(NAME ThisIsTestA COMMAND testA WORKING_DIRECTORY ${DIRECTORY_WITH_TEST_DATA})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant