Skip to content

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

Stefan Frijters added 6 commits April 7, 2020 14:46
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!

@SFrijters
Copy link
Contributor Author

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

Stefan Frijters added 5 commits April 9, 2020 12:33
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