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

changes to files in test_data are ignored #77

Open
tomjnixon opened this issue Apr 28, 2021 · 2 comments · May be fixed by #78
Open

changes to files in test_data are ignored #77

tomjnixon opened this issue Apr 28, 2021 · 2 comments · May be fixed by #78

Comments

@tomjnixon
Copy link
Member

Test data files are copied to the build dir here:

file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/test_data" DESTINATION ${PROJECT_BINARY_DIR})

But this only happens when cmake runs, so if the test data is edited it will be stale when the tests are ran.

Suggest just running the tests in the source dir.

@benjamin-weiss
Copy link
Contributor

Of course you could change the working directory to the build folder, but if I remember correctly I did it like that because some tests also produce output and I did not want that in the build dir. Maybe you could figure out a way for CMake to notice if the folder content changed?

@tomjnixon
Copy link
Member Author

Ah, I didn't consider that.

I think to fix it you'd have to copy each file separately with a custom command (so it happens at build time), and you'd have to list the test files in the CMakeLists, because if you rely on globbing it will not pick up new files.

The way I've handled this in another project is to bake the test directory path into the test executables, using configure_file. Seems a bit odd, but you're not allowed to move build directories around and the tests aren't installed so it works nicely in practice. This also makes it easier to execute tests manually, because you don't have to cd to the right dir.

@tomjnixon tomjnixon linked a pull request Apr 30, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants