-
Notifications
You must be signed in to change notification settings - Fork 163
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
Update catch2 tags assigned to object store tests #6788
Conversation
We run our tests through ctest, so I am not sure you can use those tags at all. You can expose them in ctest too. This is how I used to do it in CMakeLists, but it does not work anymore:
|
It turns out that we can use the FILE: tools/cmake/Utilities.cmake macro(add_labeled_test _name _label _target _args)
if(NOT APPLE)
add_test(NAME ${_name} COMMAND ${_target} ${_args})
else()
# When given a target name, add_test() is supposed to automatically
# determine the path to the executable. However, this is very broken on
# Apple platforms. ctest doesn't perform macro expansion, so the path
# is left with a `$(EFFECTIVE_PLATFORM_NAME)` in it. The generator
# expression `$<TARGET_FILE:target>` is also just wrong on macOS, as it
# uses a path suitable for an iOS bundle rather than a macOS bundle. As
# a result, we have to construct the path manually.
add_test(NAME ${_name} COMMAND $<TARGET_FILE_NAME:${_target}>.app/Contents/MacOS/$<TARGET_FILE_NAME:${_target}> ${_args})
endif()
set_tests_properties(${_name} PROPERTIES LABELS "${_label}")
endmacro() And the implementation: #add_bundled_test(ObjectStoreTests)
add_labeled_test(ObjectStoreTests-local LOCAL ObjectStoreTests "~[baas]")
add_labeled_test(ObjectStoreTests-baas BAAS ObjectStoreTests "[baas]") When the test runs, it prints a summary for each label:
To run just one of the tests using the label name, you would use
|
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.
Nice work. Do you know if it's also possible to just run a specific test?
What, How & Why?
To help identify the tests that currently use the baas server, the
[baas]
tag was added previously, but there were some tests that were missed. Also, the[local]
tag was removed, since it was a bit ambiguous and not needed, since using~[baas]
will run those tests that do not depend on baas.Other tags that were added were
[sync]
, for those that use the sync component and either[pbs]
or[flx]
to label the type of sync that is performed between the client and the (local or baas) server.The list of available tags can be viewed using the
./realm-object-store-tests --list-tags
command.☑️ ToDos
[ ] 📝 Changelog update[ ] 🚦 Tests (or not relevant)[ ] C-API, if public C++ API changed.