-
Notifications
You must be signed in to change notification settings - Fork 20
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
api tests vs unit tests #94
Comments
Related: #94 We need a separate executables for: (1) the public (possibly shared) ACF api (2) the private support class/functions used internally in ACF that require focused testing * add SIMD channel conversion code to ACF (imgrated from drishti) and to private unit test * move optimized separable triangle filter shader test to private unit test * extract ogles_gpgpu::ACF::getImage() texture read code to acf/transfer.{h,cpp} as stand-alone functions for easier reuse (without require compilatino of GPUACF.{h,cpp} * collect private unit test sources with sugar in ACF_TEST_SRCS variable and build into the acf unit test executable
* add separate api and private/unit test executables Related: #94 We need a separate executables for: (1) the public (possibly shared) ACF api (2) the private support class/functions used internally in ACF that require focused testing * add SIMD channel conversion code to ACF (imgrated from drishti) and to private unit test * move optimized separable triangle filter shader test to private unit test * extract ogles_gpgpu::ACF::getImage() texture read code to acf/transfer.{h,cpp} as stand-alone functions for easier reuse (without require compilatino of GPUACF.{h,cpp} * collect private unit test sources with sugar in ACF_TEST_SRCS variable and build into the acf unit test executable * fix compilation * fix typo * add face image input arg test private test * make pipeline test `—repeat=N` adaptive ``` if(travis_ci OR appveyor_ci) set(acf_repeat 5) # using emulator is slow! else() set(acf_repeat 256) # provide a meaningful frame rate estimate endif() ```
Separate public vs private tests added in #93 , will leave open for now in case of follow up efforts. |
Additional "cons": leads to pretty hairy CMake code, something like this if you want to support static/shared variants: add_library(foo foo.cpp) # public API
add_library(boo STATIC boo.cpp) # private API
if(BUILD_SHARED_LIBS)
# boo objects absorbed by foo, boo will not be installed
set_target_properties(boo PROPERTIES POSITION_INDEPENDENT_CODE)
target_link_libraries(foo PUBLIC $<BUILD_INTERFACE:boo>)
else()
target_link_libraries(foo PUBLIC boo)
install(TARGETS boo ...)
endif() Also we will hit issue similar to this one if there will be usage requirements and some private headers installed:
Additional "cons": we may miss usage requirements
For the reference: https://cgold.readthedocs.io/en/latest/rejected/object-libraries.html So as a summary: (1) should be used in such cases, "target_link_libraries" and "Usage requirements" issues should be fixed in CMake itself, for the "No real sources" and "Name conflict" need to think about workarounds (CMake can add dummy source, CMake can use renamed copy of file). (3) sounds like a simplest/cleanest workaround so far, affects only build performance, doesn't affect user's side. |
☝️ Isn't the |
From this comment (linked to in your initial issue) it seems CMake 3.12 will propagate usage requirements for I see other people resorting to UPDATE: See https://gitlab.kitware.com/cmake/cmake/issues/18010. It seems CMake 3.12 will indeed "modernize" |
You mean toolchain like E.g. if you want to build without toolchain (Linux + GCC) and have no
I saw that but haven't really tried since the other issues still remain. |
Review API tests (public/exported symbols) vs unit tests (private or hidden utility classes and functions). Most of the ACF tests fall under the API test category (they link against public symbols in the
ACF_EXPORT
classes + functions. We may also have utility hidden/private code that is tested only indirectly through the API calls, and that warrants more rigorous direct testing elsewhere. Two examples of private code that warrants direct testing are the local ACF shader classes and the optimized SIMD RGBA/texture unpacking code. We don't want to add such functionality to the API just to support devops testing tasks, so we have a few options.OBJECT
libraries so it could be reused in a test app and by the main ACF library, but OBJECT libraries aren't portable in general.STATIC
library, and the main ACF library can link to that code. The additional library should be more or less transparent to the user if they are using aSHARED
ACF library (it is absorbed by the library) or if they are using aSTATIC
ACF library through CMakefind_package(acf CONFIG REQUIRED) target_link_libraries(foo PUBLIC acf::acf)
since the generated package configuration code will provide the transitive linking transparently.Since the ACF API tests will link to the compiled ACF library, and the ACF unit tests will link to some copy of private ACF code (already inside the the ACF library) the two tests should be managed in separate executables to avoid ODR conflicts.
The text was updated successfully, but these errors were encountered: