-
Notifications
You must be signed in to change notification settings - Fork 183
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
Unit testing cmake #2268
Unit testing cmake #2268
Conversation
* Create /testsuite/cmake/CMakeLists.txt using /testsuite/python/CMakeLists.txt * Split CMake unit tests in 4 files * Handle the setup() function inside CMake with add_custom_target(), for example: `add_custom_target(setup_doxygen COMMAND make doc WORKING_DIRECTORY ${CMAKE_BINARY_DIR})`
You could change the destination to some other place that‘s writable, like /tmp. There is a CMake variable for that. |
|
add_dependencies(check_python pypresso python_test_data check_python_serial) | ||
|
||
add_dependencies(check check_python) | ||
add_subdirectory(python) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we lost git history here... better: git mv CMakeLists.txt python
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah git is not good in tracking moves...
the |
@KaiSzuttor: thanks, I see the issue with |
0d760c3
to
bb89f74
Compare
We use docker containers / VM, so you dont have to worry about /tmp |
5a65077
to
8e2833a
Compare
8e2833a
to
5812159
Compare
Codecov Report
@@ Coverage Diff @@
## python #2268 +/- ##
======================================
- Coverage 71% 71% -1%
======================================
Files 377 377
Lines 18946 18925 -21
======================================
- Hits 13585 13526 -59
- Misses 5361 5399 +38
Continue to review full report at Codecov.
|
Good to know:
|
Codecov Report
@@ Coverage Diff @@
## python #2268 +/- ##
======================================
Coverage 71% 71%
======================================
Files 380 380
Lines 18975 18975
======================================
Hits 13588 13588
Misses 5387 5387
Continue to review full report at Codecov.
|
The CMake tests are now included in
or it cannot load a Python module:
|
The latter is an issue of install as sphinx does not seem to find necessary files. I’m also not so sure if we want to test sphinx and doxygen for the install target since we deploy both with each merge via the CI. |
Agreed, let's just test installation. Now most containers pass CI, however |
dbc3e86
to
7cac5fd
Compare
7638520
to
57d8d12
Compare
Alright, it was just a race condition in the Makefile for two containers. I also found an interaction with Clang's UBSan that prevents python from importing the espressomd module after installation in
Not really sure why a shared object in the build directory would be called at that point (linking error?), nor why the error doesn't show up before installation. I get a different pointer error when compiling espresso with UBSan on my Ubuntu machine. UBSan is currently enabled only in container Then, code coverage stopped working for container |
maybe we should try to get the test pass also with UBSan. @mkuron can you please have a look? |
You need the |
Using |
@jngrad could you please have a look at my changes? |
Looks good to me. |
b3e264a
to
71fa626
Compare
@jngrad i don't understand the interplay between your cmake tests and the failing coverage commands, any idea? |
I've got the same coverage command issue in #2280 despite only changing comment lines in that PR. |
Our GitLab instance crashed on Saturday. It automatically restarted afterwards, then a few hours later I got the coverage command issue here (57d8d12) and on the other PR (8fedeb9). The issue seems random, as your commit 31b76f8 passed while my next commit 71fa626 did not (although I just re-started the failed test with container |
Maybe this is relevant: I used |
@KaiSzuttor @jngrad What is the status on this? You should merge this soon to avoid merge conflicts. |
Unit testing cmake
Unit tests for CMake output files: espresso binaries, Python bindings, Doxygen documentation and Sphinx documentation. Part of the
make check
workflow. If we ever need a shell-independent solution, there is kward/shunit2.Regarding #2245, the install test checks
make install DESTDIR=/some/dir
, yet formake install
we need write rights for/usr/local/lib
, which the end user doesn't have withoutsudo
. We could either:make install
becomes trivialmake check
workflow as-is and add a CI-specific targetcheck_cmake_CI
to testmake install
Solution 2 allows external developers to run CMake tests with
make check
, while solution 1 requires them to find the CI-specific CMake target and adapt it to run without sudo rights.Note: the CMake variables
PYTHON_FOUND
and other*_FOUND
variables defined in/CMakeLists.txt
seem out of scope in/testsuite/cmake/CMakeLists.txt
. Is there any way to import them? At the moment I re-declared them in/testsuite/cmake/CMakeLists.txt
(can break if we update version numbers in/CMakeLists.txt
):