Open Leonardo2718 opened 7 years ago
Google's guidance on this is here, based at least partially on the article here.
The author of that article provides a CMake module we may wish to investigate called DownloadProject. If we were to deploy using DownloadProject, it would look approximately like this
include(DownloadProject.cmake)
download_project(PROJ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
UPDATE_DISCONNECTED 1
)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
# Trivial example using gtest and gmock
add_executable(example example.cpp)
target_link_libraries(example gtest gmock_main)
add_test(NAME example_test COMMAND example)
I believe we have made changes to GTest to make it work on some platforms. Moving up to newer levels would require work to port these changes forward. If we could get these changes upstreamed then we would not have to include the source in our project. Also if we could find a different solution instead of making the changes that could also work.
At the time we selected Gtest for this project, we encountered problems running it on z/OS (related to ascii to ebcdic conversions and garbled test output). In order to have the tests run on that platform, we made some (not entirely satisfying) changes (that worked). A great many developers were consulted to figure out if we could arrive at a solution that we would feel comfortable contributing back to the Googletest project. We arrived at no such solution.
Given this, we isolated our changes to as few lines/files and as simple as possible to allow for an easier upgrade story. I will create a separate issue to upgrade Gtest from 1.7 to 1.8, to enable Tril work to proceed/progress and get the latest Gtest. This doesn't preclude the value of this item, as I would be very happy to improve the test framework consumption story.
OMR uses GoogleTest for most of its testing. However, the current consumption model has a few drawbacks:
With the progressive move to CMake, there is an opportunity here for great improvement.