From 864f877659e98fb5d0fe02efa118a2248480c2b3 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 1 Aug 2023 16:25:05 -0500 Subject: [PATCH 1/3] Fix Github project automation for new project board (#559) Signed-off-by: Addisu Z. Taddese --- .github/workflows/triage.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 736670e0e..152404bee 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -1,7 +1,7 @@ on: issues: types: [opened] - pull_request_target: + pull_request: types: [opened] name: Ticket opened jobs: @@ -10,10 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Add ticket to inbox - uses: technote-space/create-project-card-action@v1 + uses: actions/add-to-project@v0.5.0 with: - PROJECT: Core development - COLUMN: Inbox - GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }} - CHECK_ORG_PROJECT: true + project-url: https://github.com/orgs/gazebosim/projects/7 + github-token: ${{ secrets.TRIAGE_TOKEN }} From 5bbfc6306cb6466aa659d6325d84311a06470ed8 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 2 Aug 2023 15:48:28 -0500 Subject: [PATCH 2/3] Use `pull_request_target` for triage workflow (#560) Signed-off-by: Addisu Z. Taddese --- .github/workflows/triage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 152404bee..2c94852da 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -1,7 +1,7 @@ on: issues: types: [opened] - pull_request: + pull_request_target: types: [opened] name: Ticket opened jobs: From c020e25a48c80b4344474f6ceebe870cc8e13b66 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 22 Aug 2023 09:30:33 -0500 Subject: [PATCH 3/3] Fix segfaulting tests (#429) * Break scene3d test apart into component tests Signed-off-by: Michael Carroll * Fix include paths Signed-off-by: Michael Carroll * Remove scene3d as it is deprecated Signed-off-by: Michael Carroll * Remove message header Signed-off-by: Michael Carroll * Bump everything to ogre2 by default Signed-off-by: Michael Carroll * line order Signed-off-by: Louise Poubel * Fix tests by delaying get render engine calls (#535) --------- Signed-off-by: Ian Chen * revert default engine Signed-off-by: Ian Chen * Fix rendering tests (#561) * debugging Signed-off-by: Ian Chen * reset cam Signed-off-by: Ian Chen * more testing Signed-off-by: Ian Chen * no unload Signed-off-by: Ian Chen * more testing with no unload Signed-off-by: Ian Chen * unload engine in gzrenderer Signed-off-by: Ian Chen * unload engine in gzrenderer debugging Signed-off-by: Ian Chen * unload engine in gzrenderer reset scene Signed-off-by: Ian Chen * comment out unload Signed-off-by: Ian Chen * increase timeout Signed-off-by: Ian Chen * test timing Signed-off-by: Ian Chen * cleanup Signed-off-by: Ian Chen * cleanup Signed-off-by: Ian Chen * more cleanup Signed-off-by: Ian Chen --------- Signed-off-by: Ian Chen * Suppress warnings in metal Signed-off-by: Michael Carroll * Incorrect args Signed-off-by: Michael Carroll --------- Signed-off-by: Michael Carroll Signed-off-by: Louise Poubel Signed-off-by: Ian Chen Signed-off-by: Michael Carroll Co-authored-by: Louise Poubel Co-authored-by: Addisu Z. Taddese Co-authored-by: Ian Chen --- src/Helpers_TEST.cc | 4 +- src/plugins/minimal_scene/CMakeLists.txt | 2 +- src/plugins/minimal_scene/MinimalScene.cc | 4 + test/helpers/RenderEngineHelper.hh | 81 +++++++++++++++++++++ test/integration/camera_tracking.cc | 4 +- test/integration/marker_manager.cc | 20 ++--- test/integration/minimal_scene.cc | 38 ++-------- test/integration/transport_scene_manager.cc | 10 +-- 8 files changed, 109 insertions(+), 54 deletions(-) create mode 100644 test/helpers/RenderEngineHelper.hh diff --git a/src/Helpers_TEST.cc b/src/Helpers_TEST.cc index 980306fd8..4556cf7fa 100644 --- a/src/Helpers_TEST.cc +++ b/src/Helpers_TEST.cc @@ -194,11 +194,11 @@ TEST(HelpersTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(renderEngine)) EXPECT_TRUE(renderEngineName().empty()); // Set the render engine GUI name - mainWindow->SetRenderEngine("ogre"); + mainWindow->SetRenderEngine("ogre2"); // Has render engine EXPECT_FALSE(renderEngineName().empty()); - EXPECT_EQ("ogre", renderEngineName()); + EXPECT_EQ("ogre2", renderEngineName()); // Set no render engine mainWindow->SetRenderEngine({}); diff --git a/src/plugins/minimal_scene/CMakeLists.txt b/src/plugins/minimal_scene/CMakeLists.txt index 8e2a9526c..ebd6fd108 100644 --- a/src/plugins/minimal_scene/CMakeLists.txt +++ b/src/plugins/minimal_scene/CMakeLists.txt @@ -36,6 +36,6 @@ if (APPLE) MinimalSceneRhiMetal.mm PROPERTIES COMPILE_FLAGS - "-fobjc-arc" + "-fobjc-arc -Wno-nullability-completeness" ) endif() diff --git a/src/plugins/minimal_scene/MinimalScene.cc b/src/plugins/minimal_scene/MinimalScene.cc index bbd59d550..443390844 100644 --- a/src/plugins/minimal_scene/MinimalScene.cc +++ b/src/plugins/minimal_scene/MinimalScene.cc @@ -687,6 +687,10 @@ void GzRenderer::Destroy() // TODO(anyone) If that was the last scene, terminate engine? } + + // clean up in the rendering thread + this->dataPtr->camera.reset(); + this->dataPtr->rayQuery.reset(); } ///////////////////////////////////////////////// diff --git a/test/helpers/RenderEngineHelper.hh b/test/helpers/RenderEngineHelper.hh new file mode 100644 index 000000000..06d0ad6dd --- /dev/null +++ b/test/helpers/RenderEngineHelper.hh @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2023 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef GZ_GUI_RENDERENGINEHELPER_HH_ +#define GZ_GUI_RENDERENGINEHELPER_HH_ + +#include + +#include +#include + +#include +#include + +#include "gz/gui/GuiEvents.hh" + +#include "TestHelper.hh" + +namespace gz +{ +namespace gui +{ +namespace testing +{ + /// \brief Get the render engine + /// This function should be called after the main window is + /// shown (mainWindow.show()). It blocks until render events + /// are received. + /// \return A pointer to the render engine or nullptr if it's not available. + static rendering::RenderEngine* getRenderEngine( + const std::string &_engine) + { + // Filter events + bool receivedPreRenderEvent{false}; + bool receivedRenderEvent{false}; + auto testHelper = std::make_unique(); + testHelper->forwardEvent = [&](QEvent *_event) + { + if (_event->type() == gui::events::PreRender::kType) + { + receivedPreRenderEvent = true; + } + if (_event->type() == gui::events::Render::kType) + { + receivedRenderEvent = true; + } + }; + + int sleep = 0; + int maxSleep = 30; + while (!receivedRenderEvent && sleep < maxSleep) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + QCoreApplication::processEvents(); + ++sleep; + } + EXPECT_TRUE(receivedPreRenderEvent); + EXPECT_TRUE(receivedRenderEvent); + + // Check scene + auto engine = rendering::engine(_engine); + return engine; + } +} +} +} + +#endif diff --git a/test/integration/camera_tracking.cc b/test/integration/camera_tracking.cc index 3e110220f..8152437e0 100644 --- a/test/integration/camera_tracking.cc +++ b/test/integration/camera_tracking.cc @@ -60,7 +60,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugins const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -119,7 +119,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) EXPECT_TRUE(poseMsg.has_position()); EXPECT_TRUE(poseMsg.has_orientation()); - auto engine = rendering::engine("ogre"); + auto engine = rendering::engine("ogre2"); ASSERT_NE(nullptr, engine); auto scene = engine->SceneByName("banana"); diff --git a/test/integration/marker_manager.cc b/test/integration/marker_manager.cc index f6f620534..0463d406d 100644 --- a/test/integration/marker_manager.cc +++ b/test/integration/marker_manager.cc @@ -32,6 +32,8 @@ #include #include "test_config.hh" // NOLINT(build/include) +#include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/MainWindow.hh" @@ -115,7 +117,7 @@ TEST_F(MarkerManagerTestFixture, const char *pluginMinimalSceneStr = "" - "ogre" + "ogre2" "scene" ""; @@ -142,19 +144,10 @@ TEST_F(MarkerManagerTestFixture, // Show, but don't exec, so we don't block window->QuickWindow()->show(); - // Check scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); - int sleep = 0; - int maxSleep = 30; - while (0 == engine->SceneCount() && sleep < maxSleep) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - QCoreApplication::processEvents(); - sleep++; - } - EXPECT_EQ(1u, engine->SceneCount()); scene = engine->SceneByName("scene"); ASSERT_NE(nullptr, scene); @@ -218,4 +211,7 @@ TEST_F(MarkerManagerTestFixture, // Cleanup plugins.clear(); + scene.reset(); + + window->QuickWindow()->close(); } diff --git a/test/integration/minimal_scene.cc b/test/integration/minimal_scene.cc index 6e1546fb2..a789cc396 100644 --- a/test/integration/minimal_scene.cc +++ b/test/integration/minimal_scene.cc @@ -28,6 +28,7 @@ #include "test_config.hh" // NOLINT(build/include) #include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/Plugin.hh" @@ -80,7 +81,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugin const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -106,37 +107,10 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Show, but don't exec, so we don't block win->QuickWindow()->show(); - // Filter events - bool receivedPreRenderEvent{false}; - bool receivedRenderEvent{false}; - auto testHelper = std::make_unique(); - testHelper->forwardEvent = [&](QEvent *_event) - { - if (_event->type() == events::PreRender::kType) - { - receivedPreRenderEvent = true; - } - if (_event->type() == events::Render::kType) - { - receivedRenderEvent = true; - } - }; - - // Check scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); - int sleep = 0; - int maxSleep = 30; - while (!receivedRenderEvent && sleep < maxSleep) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - QCoreApplication::processEvents(); - ++sleep; - } - EXPECT_TRUE(receivedPreRenderEvent); - EXPECT_TRUE(receivedRenderEvent); - EXPECT_EQ(1u, engine->SceneCount()); auto scene = engine->SceneByName("banana"); ASSERT_NE(nullptr, scene); @@ -170,7 +144,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) EXPECT_TRUE(app.RemovePlugin(pluginName)); plugins.clear(); + + scene.reset(); win->QuickWindow()->close(); - engine->DestroyScene(scene); - EXPECT_TRUE(rendering::unloadEngine(engine->Name())); } diff --git a/test/integration/transport_scene_manager.cc b/test/integration/transport_scene_manager.cc index fa35aa3b9..6cfd41ada 100644 --- a/test/integration/transport_scene_manager.cc +++ b/test/integration/transport_scene_manager.cc @@ -32,6 +32,7 @@ #include "test_config.hh" // NOLINT(build/include) #include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/Plugin.hh" @@ -123,7 +124,7 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugins const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -154,8 +155,8 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Show, but don't exec, so we don't block win->QuickWindow()->show(); - // Get scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); int sleep = 0; @@ -259,8 +260,7 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) } plugins.clear(); + scene.reset(); win->QuickWindow()->close(); - engine->DestroyScene(scene); - EXPECT_TRUE(rendering::unloadEngine(engine->Name())); }