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

camera/multiple-resolution-images_* job is unable to run on the server and core. #650

Closed
rickwu666666 opened this issue Aug 4, 2023 · 4 comments
Assignees
Labels

Comments

@rickwu666666
Copy link
Contributor

rickwu666666 commented Aug 4, 2023

Bug Description

camera/multiple-resolution-images_* job is unable to run on the server and core. This is because it is located in the client-cert-iot-ubuntucore-20.pxu / camera-automated and may require refactoring of the logic in camera_test.py.

Based on this part of the code, if resolutions is provided, Clutter and Gtk will be initialized. However, both of them require a GUI for initialization. And that causing the job to fail.

 if args.test in ['display', 'still', 'led', 'resolutions']:
    import gi
    gi.require_version('Gst', '1.0')
    from gi.repository import Gst
    gi.require_version('GLib', '2.0')
    from gi.repository import GLib
    gi.require_version('Clutter', '1.0')
    from gi.repository import Clutter
    gi.require_version('Gtk', '3.0')
    from gi.repository import Gtk
    Gst.init(None)
    Clutter.init()
    Gtk.init([])

However, we tried to work around the issue by running the function without initializing Clutter and Gtk, and it seems to work fine.
https://certification.canonical.com/hardware/202305-31566/submission/323229/test/200875/result/34817873/

To Reproduce

  1. A machine support camera with a camera attached.
  2. Run job camera/multiple-resolution-images.* on server or core
  3. Job will fail while initial clutter

Environment

  • OS: Ubuntu 22.04.2 LTS
  • Checkbox Type: Snap
  • Checkbox Version: checkbox22 2.8 rev 437
  • Hardware being tested: devices

Relevant log output

 (camera_test.py:15926): Clutter-CRITICAL **: 07:01:18.542: Unable to initialize Clutter: Could not initialize Gdk
 (camera_test.py:15926): Gtk-WARNING **: 07:01:18.543: cannot open display:

https://certification.canonical.com/hardware/202305-31566/submission/323043/test/76060/result/34787566/

Additional context

No response

@rickwu666666 rickwu666666 added the bug Something isn't working label Aug 4, 2023
@pieqq
Copy link
Collaborator

pieqq commented Sep 18, 2023

The things to take into account are:

It should be possible to use gstreamer without Gtk, that is to perform the image capture (and save it to file) without using Gtk, but only Gst.

@pieqq
Copy link
Collaborator

pieqq commented Sep 18, 2023

camera_test.py comes with the following commands. Some of them are used in a graphical environment (desktop) and require some interaction with the operator, some don't, so we can split them like this:

Command Desktop Server/Core
detect Required Required
led Required Not required
display Required Not required
still Required Not required
resolutions Required Required

To-do:

  1. Investigate what parts (detect,led,display,still,resolutions) really require Gtk/Clutter to run
  2. Isolate the use of Gtk/Clutter to these
  3. Add some tests
  4. Test the changes on 22.04 classic, 22.04 server and UC22 (using side-loaded provider should be enough)

If done well, it might be possible to remove fswebcam from the script entirely.

Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CHECKBOX-1200.

This message was autogenerated

@zongminl
Copy link
Collaborator

Fixed by #1400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants