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

Failing to load render engine plugin in tests #216

Closed
chapulina opened this issue Apr 29, 2021 · 10 comments
Closed

Failing to load render engine plugin in tests #216

chapulina opened this issue Apr 29, 2021 · 10 comments
Labels
bug Something isn't working tests Broken or missing tests / testing infra

Comments

@chapulina
Copy link
Contributor

Environment

  • OS Version: Ubuntu Bionic and Focal
  • Source or binary build? Source, ign-gui3 onwards

Description

  • Expected behavior: Loading Scene3D within a test should successfully load a rendering engine
  • Actual behavior: Scene3D fails to load the rendering engine during the test, but it successfully loads it during regular execution

Steps to reproduce

Create a test that loads Scene3D and executes the Window, like this one:

https://github.com/ignitionrobotics/ign-gui/blob/2eb2ee054c984b6573c6fbf4f7edcf84f2fc29de/src/plugins/scene3d/Scene3D_TEST.cc#L71-L94

And the rendering engine will fail to load:

[ RUN      ] Scene3DTest.Config                                                                                                   
[GUI] [Dbg] [Application.cc:87] Initializing application.
[GUI] [Dbg] [Application.cc:407] Create main window      
[GUI] [Dbg] [Application.cc:305] Loading plugin [Scene3D]                                    
[GUI] [Msg] Added plugin [3D Scene] to main window                                                                                       
[GUI] [Msg] Loaded plugin [Scene3D] from path [/home/chapulina/dev_bionic/ws_citadel/build/ignition-gui3/lib/libScene3D.so]   
[GUI] [Msg] Loading plugin [ignition-rendering-ogre]                                              
[GUI] [Err] [RenderEngineManager.cc:468] Failed to load plugin [ignition-rendering-ogre] : couldn't load library on path [/home/chapulina/dev_bionic/ws_citadel/install/lib/ign-rendering-3/engine-plugins/libignition-rendering-ogre.so].
/home/chapulina/dev_bionic/ws_citadel/src/ign-gui/src/plugins/scene3d/Scene3D_TEST.cc:98: Failure        
Expected: (nullptr) != (engine), actual: (nullptr) vs NULL

The main difference I can think of between the test executable and running the GUI is that the test links against Scene3D instead of just loading it. So I tried just linking the test against ign-rendering and not against the plugin, and this time the plugin fails to load:

[GUI] [Err] [Application.cc:333] Failed to load plugin [Scene3D] : couldn't load library on path [/home/chapulina/dev_bionic/ws_citadel/buil
d/ignition-gui3/lib/libScene3D.so].

I did some digging through ign-plugin to try finding out what's happening but I didn't find anything worth documenting.

Additional info

This came up on #170 and #213

@chapulina chapulina added bug Something isn't working tests Broken or missing tests / testing infra labels Apr 29, 2021
chapulina added a commit that referenced this issue Apr 29, 2021
@scpeters
Copy link
Member

scpeters commented May 6, 2021

I've been looking into this a bit, and since Scene3d_TEST.cc isn't yet testing any methods of the Scene3D plugin, I've made it an integration test instead in 899b97a (branch scpeters/3/events_debug). Now the plugins load, but the test fails to get a scene pointer from the RenderEngine. I suspect this is because the rendering system has not had time to initialize in the test. Is there a way to execute the window for a second or so in order to initialize the app?

@chapulina
Copy link
Contributor Author

Is there a way to execute the window for a second or so in order to initialize the app?

I've been using win->QuickWindow()->show(); like it was done on the removed test.

This works for non-rendering plugins, for example:

https://github.com/ignitionrobotics/ign-gui/blob/ffbdb26ce519f85b273d57527a11470dae3838e1/src/plugins/world_control/WorldControl_TEST.cc#L89-L90

Now the plugins load

Are you building from source? Without gazebosim/gz-rendering#236, which hasn't been released yet, the [GUI] [Msg] Loading plugin [ignition-rendering-ogre] message can be misleading and give the impression that the plugin was successfully loaded, but it may not have.

@scpeters
Copy link
Member

scpeters commented May 7, 2021

Are you building from source? Without ignitionrobotics/ign-rendering#236, which hasn't been released yet, the [GUI] [Msg] Loading plugin [ignition-rendering-ogre] message can be misleading and give the impression that the plugin was successfully loaded, but it may not have.

yes, I was building ign-plugin and ign-rendering from source in order to add a bunch of print statements. I'll run it again and paste the console output from my branch...

@scpeters
Copy link
Member

scpeters commented May 7, 2021

I get the following as of 899b97a when building ign-rendering3 from source:

$ bin/INTEGRATION_scene3d 
Running main() from /home/scpeters/maliput_ws/src/ign-gui3/test/gtest/src/gtest_main.cc
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from Scene3DTest
[ RUN      ] Scene3DTest.Load
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-scpeters'
[Dbg] [Application.cc:87] Initializing application.
[GUI] [Dbg] [Application.cc:407] Create main window
[GUI] [Dbg] [Application.cc:305] Loading plugin [Scene3D]
[GUI] [Msg] Added plugin [3D Scene] to main window
[GUI] [Msg] Loaded plugin [Scene3D] from path [/home/scpeters/maliput_ws/build/ignition-gui3/lib/libScene3D.so]
[GUI] [Dbg] [Application.cc:130] Terminating application.
[       OK ] Scene3DTest.Load (473 ms)
[ RUN      ] Scene3DTest.Config
[GUI] [Dbg] [Application.cc:87] Initializing application.
[GUI] [Dbg] [Application.cc:407] Create main window
[GUI] [Dbg] [Application.cc:305] Loading plugin [Scene3D]
[GUI] [Msg] Added plugin [3D Scene] to main window
[GUI] [Msg] Loaded plugin [Scene3D] from path [/home/scpeters/maliput_ws/build/ignition-gui3/lib/libScene3D.so]
[GUI] [Msg] Loading plugin [ignition-rendering-ogre]
/home/scpeters/maliput_ws/src/ign-gui3/test/integration/scene3d.cc:98: Failure
Expected equality of these values:
  1u
    Which is: 1
  engine->SceneCount()
    Which is: 0
/home/scpeters/maliput_ws/src/ign-gui3/test/integration/scene3d.cc:100: Failure
Expected: (nullptr) != (scene), actual: (nullptr) vs 16-byte object <00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00>
[GUI] [Dbg] [Application.cc:130] Terminating application.
[  FAILED  ] Scene3DTest.Config (740 ms)

Having added some additional print statements, I think the Scene is not initialized by the time the expectation fails

@chapulina
Copy link
Contributor Author

I get the following

Is this with the show call?

@scpeters
Copy link
Member

scpeters commented May 7, 2021

@chapulina
Copy link
Contributor Author

yes

Nice! I was just checking. Why do you think it behaves differently as an integration test, is it because it's not linked against the Scene3D plugin? I thought I had tried that.

I think the Scene is not initialized by the time the expectation fails

That sounds familiar to me. You can try processing events in a loop until the scene is available to give the plugin some time to load. Like this:

https://github.com/ignitionrobotics/ign-gui/blob/ffbdb26ce519f85b273d57527a11470dae3838e1/src/plugins/publisher/Publisher_TEST.cc#L131-L138

@scpeters
Copy link
Member

scpeters commented May 7, 2021

That sounds familiar to me. You can try processing events in a loop until the scene is available to give the plugin some time to load. Like this:

ign-gui/src/plugins/publisher/Publisher_TEST.cc

that did it! the test now works in my branch as of 341db2a

should we push these changes to #213?

@chapulina
Copy link
Contributor Author

the test now works in my branch

That's great! Feel free to commit to that branch directly 🎉

@scpeters
Copy link
Member

scpeters commented May 8, 2021

ok, I've pushed to that branch. I'll close this now

@scpeters scpeters closed this as completed May 8, 2021
ahcorde added a commit that referenced this issue May 27, 2021
* Start porting events from ign-gazebo

Signed-off-by: Louise Poubel <[email protected]>

* Remove test that fails due to #216

Signed-off-by: Louise Poubel <[email protected]>

* Move Scene3d_TEST.cc to test/integration

There seems to be a problem with loading the ignition-rendering-ogre
plugin from the Scene3D test if it links to that plugin. Making
Scene3D_TEST.cc into an integration test works because it doesn't
directly call any plugin methods.

This also changes the linking for the Grid3D plugin to only link
to the ignition-rendering core library target instead of the
IGNITION-RENDERING_LIBRARIES variable which includes the ogre
component library plugins.

Signed-off-by: Steve Peters <[email protected]>

* process qt events to allow scene to initialize

Signed-off-by: Steve Peters <[email protected]>

* Add test helper to check event

Signed-off-by: Louise Poubel <[email protected]>

* added more tests

Signed-off-by: ahcorde <[email protected]>

* make linters happy

Signed-off-by: ahcorde <[email protected]>

* Move TestHelper code to .cc file, fix windows?

Signed-off-by: Steve Peters <[email protected]>

* Fix windows?

Signed-off-by: ahcorde <[email protected]>

* Fix windows?

Signed-off-by: Alejandro Hernández <[email protected]>

* Expect values of Vector3 point in click events

Signed-off-by: Steve Peters <[email protected]>

* Remove debug message

Signed-off-by: Steve Peters <[email protected]>

* Remove unused variable

Signed-off-by: Steve Peters <[email protected]>

Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: ahcorde <[email protected]>
chapulina added a commit that referenced this issue Jun 22, 2021
* Release 3.5.1 (#195)

Signed-off-by: Steve Peters <[email protected]>

* check_test_ran.py: remove grep/xsltproc (#203)

We aren't using QTest anymore in ign-gui, so remove
the parts of check_test_ran.py that translated QTest
xml files into junit, since they don't work easily
on Windows and aren't needed any longer.

Fixes #198.

Signed-off-by: Steve Peters <[email protected]>

* Fixed material specular in scene3D (#218)

Signed-off-by: ahcorde <[email protected]>

* Remove tools/code_check and update codecov (#222)

Signed-off-by: Louise Poubel <[email protected]>

* Removed duplicated code with rendering::sceneFromFirstRenderEngine (#223)

Signed-off-by: ahcorde <[email protected]>

* Emit more events from Scene3D (#213)

* Start porting events from ign-gazebo

Signed-off-by: Louise Poubel <[email protected]>

* Remove test that fails due to #216

Signed-off-by: Louise Poubel <[email protected]>

* Move Scene3d_TEST.cc to test/integration

There seems to be a problem with loading the ignition-rendering-ogre
plugin from the Scene3D test if it links to that plugin. Making
Scene3D_TEST.cc into an integration test works because it doesn't
directly call any plugin methods.

This also changes the linking for the Grid3D plugin to only link
to the ignition-rendering core library target instead of the
IGNITION-RENDERING_LIBRARIES variable which includes the ogre
component library plugins.

Signed-off-by: Steve Peters <[email protected]>

* process qt events to allow scene to initialize

Signed-off-by: Steve Peters <[email protected]>

* Add test helper to check event

Signed-off-by: Louise Poubel <[email protected]>

* added more tests

Signed-off-by: ahcorde <[email protected]>

* make linters happy

Signed-off-by: ahcorde <[email protected]>

* Move TestHelper code to .cc file, fix windows?

Signed-off-by: Steve Peters <[email protected]>

* Fix windows?

Signed-off-by: ahcorde <[email protected]>

* Fix windows?

Signed-off-by: Alejandro Hernández <[email protected]>

* Expect values of Vector3 point in click events

Signed-off-by: Steve Peters <[email protected]>

* Remove debug message

Signed-off-by: Steve Peters <[email protected]>

* Remove unused variable

Signed-off-by: Steve Peters <[email protected]>

Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: ahcorde <[email protected]>

* Avoid grid3D crash (#227)

Signed-off-by: ahcorde <[email protected]>

* Confirmation dialog when closing main window (#225)

* Adds confirmation dialog when closing window
* Updates docs and extends test coverage.
* Adds dialog_on_exit atribute to example .config

Signed-off-by: Franco Cipollone <[email protected]>

* update codeowners (#232)

Signed-off-by: Jenn Nguyen <[email protected]>

* 🎈 3.6.0 (#233)

Signed-off-by: Louise Poubel <[email protected]>

* Bump required ign-rendering version to 4.8 (#234)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Franco Cipollone <[email protected]>
Co-authored-by: Jenn Nguyen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests Broken or missing tests / testing infra
Projects
None yet
Development

No branches or pull requests

2 participants