canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
30 stars 47 forks source link

camera tests fail on RPI due to missing picamera module #1345

Open nancyc12 opened 3 months ago

nancyc12 commented 3 months ago

Bug Description

Camera tests failed on RPI machines with ModuleNotFoundError: No module named 'picamera'

To Reproduce

  1. Launch Checkbox with test plan com.canonical.certification::client-cert-iot-server-22-04-automated with the following manifest on an RPI machine
    [manifest]
    com.canonical.certification::has_camera = False
    com.canonical.certification::has_rpi_camera = True
  2. Check the result of camera tests

Environment

Relevant log output

Traceback (most recent call last):
  File "/tmp/nest-bnwxnnfj.2405cd5507e3673b8b6e57cee7bb959a359b82ae2b0f622cace9e6363f595ce7/camera_test_rpi.py", line 25, in <module>
    import picamera
ModuleNotFoundError: No module named 'picamera'
      Testing device name: vchiq

Input string: YvZmtcTKBL
Generating QR code...
Displaying on screen
Capture image of screen
Traceback (most recent call last):
  File "/tmp/nest-8b1459j9.8d89fe5c227602a516ebf2ef188ebca778a97b248d5fbe444d8db0c3d0073901/roundtrip_qr.py", line 128, in <module>
    main()
  File "/tmp/nest-8b1459j9.8d89fe5c227602a516ebf2ef188ebca778a97b248d5fbe444d8db0c3d0073901/roundtrip_qr.py", line 113, in main
    file = capture_rpi(name)
  File "/tmp/nest-8b1459j9.8d89fe5c227602a516ebf2ef188ebca778a97b248d5fbe444d8db0c3d0073901/roundtrip_qr.py", line 34, in capture_rpi
    import picamera
ModuleNotFoundError: No module named 'picamera'

Additional context

No response

syncronize-issues-to-jira[bot] commented 3 months ago

Thank you for reporting us your feedback!

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

This message was autogenerated

Hook25 commented 2 months ago

There are two possible scenarios here. The picamera module is not supported on all platforms we need for debs (namely, it doesn't support arm64, so it is a no go). We can either:

  1. Update the test so that it uses opencv to take the picture. This introduces a very large new dependency to the provider but we are 100% sure that opencv will handle the camera dirty work for us (to be verified, but I'm pretty sure it will)
  2. Find an alternative library for the job, it has to be lighter than opencv and support all platforms that we need it on.

The issue with scenario1 is that adding the opencv dependency will either propagate it everywhere (if we add it to the module) or work only for debian packages + checkbox22/24 snap (if we add it to the rules). What do you think?

jocave commented 8 hours ago

This has become a problem because we used to abuse the manifest files in snap-testing to only set the has_rpi_camera entry to true when the job was running on armhf e.g. https://github.com/canonical/hwcert-jenkins-jobs/blob/main/jobs/snap-testing/manifests/rpi4b1g_camera_manifest.conf

This would meant the detect job would not be run and hence no roundtrip jobs attempted:

https://github.com/canonical/checkbox/blob/90acaebc6997387906e7ae832fef0dbe22b17809/providers/base/units/camera/jobs.pxu#L20

No we only have one manifest for each CID in the shared repo so this trick cannot be played

jocave commented 8 hours ago

I notice there are also failing tests on armhf which I think should not be a problem of missing/unavailable dependencies:

Is this a case of just not specification of a dependency in the deb packaging? https://certification.canonical.com/hardware/201907-27199/submission/400179/