Skip to content

"dogfooding" caf and cafrun for tests #275

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

Closed
zbeekman opened this issue Dec 14, 2016 · 11 comments
Closed

"dogfooding" caf and cafrun for tests #275

zbeekman opened this issue Dec 14, 2016 · 11 comments
Assignees

Comments

@zbeekman
Copy link
Collaborator

zbeekman commented Dec 14, 2016

Should we be using caf to compile our tests and cafrun to execute them? This is often called "dogfooding" and can help further test our scripts and ensure their correctness, while also displaying confidence in them. I'm wondering how to go about this in CMake. I think this could be achieved via:

  1. Splitting building the tests into an additional "check" target that is not included in "all" and depends on building the opencoarrays library target. This will split the building of the tests into a separate task so that if you don't want to run the tests, you won't have to build them, and emulate GNU/autotools "make check" behavior: build and run tests. This is not strictly required to accomplish "dogfooding"
  2. Ensure that the caf and cafrun scripts fully resolve the compilers they wrap and pass necessary flags etc. and are available before install. RFC: Hard code full paths and more precisely specify linker/compiler flags & MPI flags in caf and cafrun scripts #268 We can use CMake's REALPATH capabilities for this.
  3. Hardwiring the Fortran compiler in the test directories' CMakeLists.txt to be caf... this could be unstable/difficult. An alternative might be to look into externalproject_add ... here is some useful info: http://cmake.3232098.n2.nabble.com/ExternalProject-Add-without-download-of-local-sources-td6797293.html
@rouson
Copy link
Member

rouson commented Dec 14, 2016

Sounds good. It probably makes sense to seek the advice of CMake developer @brad.king. I'm not sure if the latter tag will work so I'll email him too.

@zbeekman
Copy link
Collaborator Author

zbeekman commented Dec 14, 2016

Actually, the more I think about it the more I am drawn to add_custom_command() and add_custom_target. A difficulty may arise when treating the "fancy" performance/integration tests that link against the timer and FFT code... but it shouldn't be too tricky to figure out... I'm thinking that this is probably the way to go... after making some macros/functions to make life easier.

@bradking
Copy link

An alternative might be to look into externalproject_add
...
I am drawn to add_custom_command() and add_custom_target

Either of these approaches may work. An advantage of using ExternalProject_Add is that the "external" project can be a full CMake project. Its configuration and build are delayed until build time of the outer project, so one can use dependencies to make sure everything needed to use caf is ready before even configuring the test project. Combined with use of the export() command one could even have the external test project link to libraries from the main project cleanly.

@zbeekman
Copy link
Collaborator Author

Thanks for chiming in @bradking! It sounds like in the long run it might make the most sense to use ExternalProject_Add to ensure all of our export() machinery is working as expected, but in the short term (since tests aren't setup as external projects yet) perhaps add_custom_target and add_custom_command might be best?

@bradking said:

Combined with use of the export() command one could even have the external test project link to libraries from the main project cleanly.

@bradking: Do you know if this means that we need to export our build directory too if we want to do this before running make install in the main OpenCoarrays project?

@bradking
Copy link

@zbeekman yes, if an externally-built project is to test the libraries and such from the build tree then export() should be used to make the targets available for import into the external project.

@rouson
Copy link
Member

rouson commented Dec 15, 2016

@zbeekman this issue was prescient. I just submitted pull request #277 to correct for a fatal error in the caf script that was not being detected by the tests because the tests don't yet use the caf script.

@zbeekman
Copy link
Collaborator Author

🎩 ✨ 🐇 🔮

@zbeekman
Copy link
Collaborator Author

Well, actually if I was prescient, I would have made the changes to caf and cafrun when I changed CMakeLists.txt.... 😦

@zbeekman
Copy link
Collaborator Author

might make sense to handle this at the same time as #267

@zbeekman zbeekman added the ready label Feb 12, 2017
@zbeekman zbeekman self-assigned this Mar 14, 2017
zbeekman added a commit that referenced this issue Apr 19, 2017
 - Make it harder for #359 or similar to happen again
 - #275 would have also helped catch this
zbeekman added a commit that referenced this issue Apr 19, 2017
 - Make it harder for #359 or similar to happen again
 - #275 would have also helped catch this
@zbeekman
Copy link
Collaborator Author

zbeekman commented May 2, 2017

Note to self: See the generator expressions section of https://cmake.org/cmake/help/v3.8/command/add_test.html

@rouson rouson added this to the 2.0.0 milestone milestone May 9, 2017
@rouson
Copy link
Member

rouson commented Jul 25, 2017

@zbeekman Let's look at this together so we can implement it and close the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants