Fix unittest properly. The previous 'fix' for the unittest did not work on CI.
And IMHO it was not too pretty. This one should work on the CI and everywhere else for that matter.
Fix unittest properly. The previous 'fix' for the unittest did not work on CI.
And IMHO it was not too pretty. This one should work on the CI and everywhere else for that matter.
Tested on Linux and windows builds. If this works unittest will pass on KDE Windows CI as well.
No Linters Available |
No Unit Test Coverage |
Buildable 2040 | |
Build 2058: arc lint + arc unit |
plugins/perforce/tests/CMakeLists.txt | ||
---|---|---|
13 | With http://doc.qt.io/qt-5/qstandardpaths.html#findExecutable you wouldn't need to append ${CMAKE_EXECUTABLE_SUFFIX} | |
plugins/perforce/tests/test_perforce.cpp | ||
53 | Use http://doc.qt.io/qt-5/qstandardpaths.html#findExecutable? Also QVERIFY(...) that the executable was found maybe? |
plugins/perforce/tests/test_perforce.cpp | ||
---|---|---|
53 | As far as I can tell. findExecutable is not recursive. So I would still need QDirIterator to find the dirs for findExecutable to look through. So the question is how much more sense findExecutable makes in this scenario? |
plugins/perforce/tests/test_perforce.cpp | ||
---|---|---|
53 | On Second thought. It does remove the need for one of the defines. |
plugins/perforce/tests/test_perforce.cpp | ||
---|---|---|
53 | Scanning recursively through the build dir seems pretty unclean to me. Wouldn't a simple QStandardPaths::findExecutable("p4clientstub", P4_BINARY_DIR); with P4_BINARY_DIR initialized with CMAKE_RUNTIME_OUTPUT_DIRECTORY work? See: https://cmake.org/cmake/help/v3.9/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.html |
plugins/perforce/tests/test_perforce.cpp | ||
---|---|---|
53 | As far as I can tell from cmake documetation https://cmake.org/cmake/help/v3.9/manual/cmake-variables.7.html CMAKE_RUNTIME_OUTPUT_DIRECTORY is under the section "Variables that Control the Build". I take that to mean it is meant to be set and not read. That would also correspond with the fact that it gives me an empty path when I initialize P4_BINARY_DIR with it. Under "Variables that Provide Information" section there is: CMAKE_CURRENT_BINARY_DIR gives me /home/mvo/kde/build/extragear/kdevelop/kdevelop/plugins/perforce/tests (The executable is under /home/mvo/kde/build/extragear/kdevelop/kdevelop/plugins/perforce/p4clientstub and at a different relative location under windows) I'm not a big fan of scanning the entire build dir either. but at least it is only done once pr. testrun |
Indeed, CMAKE_RUNTIME_OUTPUT_DIRECTORY is empty for me, too :(
Okay, then go ahead with this. This use-case is indeed not very well supported with CMake :(