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

Add CTest support #310

Merged
merged 11 commits into from
Apr 10, 2020
Merged

Add CTest support #310

merged 11 commits into from
Apr 10, 2020

Conversation

SFrijters
Copy link
Contributor

@SFrijters SFrijters commented Apr 7, 2020

Description

Attempts to close #309 .

This also includes some general improvements to the CMake files, and some fixes that were exposed during the implementation and testing of the CTest.

One bugfix that may need discussion in particular is db7e8e4.

Please let me know if you want me to split things up differently.

EDIT: updated commit hash after rebase

Compilers other than the Intel compiler also do not like some flags.
So it is better to whitelist rather than blacklist.
We need to set the CC/CXX environment variables to pick up
newer GCC/Clang (and not the system GCC) anyway, so make this
consistent for the Intel compiler as well (CC=icc CXX=icpc).
Copy link
Member

@dmed256 dmed256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments but overall it looks pretty good! Thanks for heavily updating the CMake build!

examples/cpp/13_native_cuda_kernels/main.cpp Outdated Show resolved Hide resolved
include/occa/scripts/tests/compiler.cpp Outdated Show resolved Hide resolved
src/io/utils.cpp Show resolved Hide resolved
@SFrijters
Copy link
Contributor Author

Thanks for the quick review. I'll get on the requested changes today.

Add all tests currently called from the run_* scripts in the tests
directory to CMake, so they can be built automatically and run using
'ctest' in the build directory. Set ENABLE_TESTS=ON to enable this.

This also changes some paths so that all build artefacts end up inside the build
directory, and no longer pollute the source tree.
There is now a CMakeLists.txt, so one more file in the directory.
PWD is not always the same as current working directory.

This is a problem when calling tests from ctest: the working directory
is changed, but the value of env::PWD is then incorrect.
Kernel files are then not found.

Using this system call the directory is correctly returned.
Some tests override the OCCA_CACHE_DIR environment variable.
This leads to artefacts (e.g. lock files) in the source tree
instead of the build tree.

In this way we let CMake take care of the correct paths.
Clang also defines __GNUC__, so it would be incorrectly identified as GNU
before reaching the check for __clang__.
@SFrijters
Copy link
Contributor Author

I've addressed your concerns I hope and merged the changes into the relevant commits. Currently running tests locally before updating this PR.

Could the Travis pipeline be expanded in the future to also test the CMake/CTest path?

@SFrijters
Copy link
Contributor Author

Updated my branch; works on my end :)

@dmed256
Copy link
Member

dmed256 commented Apr 9, 2020

@SFrijters Awesome, thanks for the quick fixes! I'll try running the tests tonight and merge if they pass. Not sure why Travis didn't run them for this PR :(

@dmed256 dmed256 merged commit 39f7a37 into libocca:master Apr 10, 2020
@SFrijters SFrijters deleted the ctest branch June 8, 2022 10:33
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 this pull request may close these issues.

Add tests to CTest
2 participants