Skip to content
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

Refactor rendering tests to run against multiple implementations #685

Merged
merged 15 commits into from
Jul 29, 2022

Conversation

mjcarroll
Copy link
Contributor

@mjcarroll mjcarroll commented Jul 26, 2022

🎉 New feature

Addresses #683

Summary

As we have increased our number of potential configurations, we needed a bit of a refactor to be able to test all of the configurations.

This changes the tests to no longer use gtest's parameterization, but rather use ctest's

All tests that are based on the CommonRenderingTest can be parameterized via environment variables that are injected in ctest.

For a platform like Ubuntu Jammy, where we support ogre, and ogre2 (with both opengl and vulkan). The resulting list of tests for a single executable looks like:

  Test #276: UNIT_WireBox_TEST_ogre_gl3plus
  Test #278: UNIT_WireBox_TEST_ogre2_gl3plus
  Test #280: UNIT_WireBox_TEST_ogre2_vulkan  

For configurations that aren't supported, there are a few macros to be able to skip the tests introduced in the CommonRenderingTest.hh header.

Test it

Build gz-rendering and run tests with ctest

For example, you could:

Test all ogre2: ctest -R ogre2
Test all vulkan: ctest -R vulkan
Test all INTEGRATION: ctest -R integration

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@mjcarroll mjcarroll force-pushed the ci_matching_branch/ogre23 branch from 6a65c42 to 7a6931c Compare July 26, 2022 17:45
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll force-pushed the mjcarroll/rendering_common_test branch from 6ed7553 to ff84cc7 Compare July 27, 2022 16:27
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@codecov
Copy link

codecov bot commented Jul 27, 2022

Codecov Report

Merging #685 (5be5dad) into ci_matching_branch/ogre23 (7a6931c) will increase coverage by 16.50%.
The diff coverage is n/a.

@@                      Coverage Diff                       @@
##           ci_matching_branch/ogre23     #685       +/-   ##
==============================================================
+ Coverage                      53.18%   69.69%   +16.50%     
==============================================================
  Files                            214      214               
  Lines                          21550    21550               
==============================================================
+ Hits                           11462    15019     +3557     
+ Misses                         10088     6531     -3557     
Impacted Files Coverage Δ
src/WireBox.cc 0.00% <0.00%> (-100.00%) ⬇️
ogre2/src/Ogre2WireBox.cc 0.00% <0.00%> (-85.08%) ⬇️
include/gz/rendering/base/BaseJointVisual.hh 0.00% <0.00%> (-81.97%) ⬇️
src/RenderingIface.cc 7.01% <0.00%> (-64.92%) ⬇️
include/gz/rendering/base/BaseWireBox.hh 0.00% <0.00%> (-62.50%) ⬇️
ogre2/src/Ogre2JointVisual.cc 0.00% <0.00%> (-50.00%) ⬇️
include/gz/rendering/base/BaseArrowVisual.hh 61.76% <0.00%> (-38.24%) ⬇️
include/gz/rendering/base/BaseAxisVisual.hh 58.62% <0.00%> (-36.21%) ⬇️
src/RenderEngineManager.cc 38.33% <0.00%> (-33.21%) ⬇️
ogre2/src/Ogre2RenderTarget.cc 77.23% <0.00%> (-7.75%) ⬇️
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a6931c...5be5dad. Read the comment docs.

@chapulina chapulina added the 🌱 garden Ignition Garden label Jul 27, 2022
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll changed the title Simple example of a rendering common test Refactor rendering tests to run against multiple implementations Jul 28, 2022
@mjcarroll mjcarroll marked this pull request as ready for review July 28, 2022 14:43
@mjcarroll mjcarroll requested a review from iche033 as a code owner July 28, 2022 14:43
test/common_test/CommonRenderingTest.hh Outdated Show resolved Hide resolved
test/common_test/CommonRenderingTest.hh Outdated Show resolved Hide resolved
test/gz_rendering_test.cmake Outdated Show resolved Hide resolved
test/gz_rendering_test.cmake Outdated Show resolved Hide resolved
test/integration/gpu_rays.cc Outdated Show resolved Hide resolved
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll
Copy link
Contributor Author

It is expected that Windows won't work (as it is using vcpkg and not conda). I'm the process of updating some of the conda recipes, but I think that's out of scope here: conda-forge/ogre-next-feedstock#8

@mjcarroll mjcarroll requested a review from ahcorde July 28, 2022 19:57
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested ogre and ogre2 tests on Focal with gl3plus and the tests pass for me.

I see RENDER_ENGINE_VALUES still used in a few places, e.g. scene_factory.cc so we still can't remove it yet right?

I think the instruction on running individual tests may need to be updated in the installation tutorial

@@ -227,28 +198,13 @@ void WideAngleCameraTest::WideAngleCamera(

// Clean up
engine->DestroyScene(scene);
gz::rendering::unloadEngine(engine->Name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we leave these calls in place but commented out? We can add a todo comment that it says it causes segfault / test failure so we can look at them later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are removed because they are handled by the test fixture now:

https://github.com/gazebosim/gz-rendering/pull/685/files#diff-9b5026daaee2123f95b0ee0a29787297a9d106b248731492d1c15796940d0fa0R85-R89

This also guarantees that any resources allocated in the test will be deallocated before the test is torn down.

@mjcarroll mjcarroll merged commit d87751e into ci_matching_branch/ogre23 Jul 29, 2022
@mjcarroll mjcarroll deleted the mjcarroll/rendering_common_test branch July 29, 2022 00:16
@mjcarroll
Copy link
Contributor Author

Merging this into #681

mjcarroll added a commit that referenced this pull request Jul 29, 2022
As we have increased our number of potential configurations, we needed a bit of a refactor to be able to test all of the configurations.

This changes the tests to no longer use gtest's parameterization, but rather use ctest's

Signed-off-by: Michael Carroll <[email protected]>
mjcarroll added a commit that referenced this pull request Jul 29, 2022
As we have increased our number of potential configurations, we needed a bit of a refactor to be able to test all of the configurations.

This changes the tests to no longer use gtest's parameterization, but rather use ctest's

Signed-off-by: Michael Carroll <[email protected]>
mjcarroll added a commit that referenced this pull request Jul 29, 2022
* Upgrade to Ogre 2.3
* Refactor rendering tests to run against multiple implementations (#685)
* Port remaining tests to common framework (#694)

Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants