Skip to content

Add a new function to find which renderer is running the process (New)#1245

Merged
fernando79513 merged 18 commits intomainfrom
add_finding_gpu_function
Sep 13, 2024
Merged

Add a new function to find which renderer is running the process (New)#1245
fernando79513 merged 18 commits intomainfrom
add_finding_gpu_function

Conversation

@hanhsuan
Copy link
Copy Markdown
Contributor

Description

While testing without pci id, user couldn't know the process is running
on which renderer. Therefore, this change is going to:

  • add a new function to get which GPU is executing the command that could help user to make sure the renderer is not llvmpipe.
  • refactor some codes to make reuse easier.
  • add PCI ID in the log to make verify easier.

The jobs.pxu and test-plan.pxu will be in another PR, and the draft jobs and test-plan that use this new function as below:

plugin: shell
category_id: com.canonical.plainbox::graphics
id: graphics/auto_glxgears
flags: also-after-suspend
user: root
requires:
    executable.name == 'glxgears'
    dmi.product in ['Desktop','Low Profile Desktop','Tower','Mini Tower','Space-saving']
command:
    prime_offload_tester.py -c glxgears -t 30
summary:
    Test that glxgears works for current video card
purpose:
     Tests the basic 3D capabilities of your current video card. This test covers all devices without an integrated display, such as desktops.

plugin: shell
category_id: com.canonical.plainbox::graphics
id: graphics/auto_glxgears_fullscreen
flags: also-after-suspend
user: root
requires:
    executable.name == 'glxgears'
    dmi.product in ['Desktop','Low Profile Desktop','Tower','Mini Tower','Space-saving']
command:
     prime_offload_tester.py -c "glxgears -fullscreen" -t 30
summary:
    Test that glxgears works in full screen mode for current video card
purpose:
     Tests the basic full screen 3D capabilities of your current video card. This test covers all devices without an integrated display, such as desktops.
plugin: user-interact-verify
category_id: com.canonical.plainbox::graphics
id: graphics/valid_glxgears
flags: also-after-suspend
user: root
requires:
    executable.name == 'glxgears'
    dmi.product in ['Desktop','Low Profile Desktop','Tower','Mini Tower','Space-saving']
command:
     prime_offload_tester.py -c glxgears -t 30
summary:
    Test that glxgears works for current video card
purpose:
     Tests the basic 3D capabilities of your current video card. This test covers all devices without an integrated display, such as desktops.
steps:
     1. Click "Test" to execute an OpenGL demo. Press ESC at any time to close.
     2. Verify that the animation is not jerky or slow.
verification:
     1. Did the 3d animation appear?
     2. Was the animation free from slowness/jerkiness?

plugin: user-interact-verify
category_id: com.canonical.plainbox::graphics
id: graphics/valid_glxgears_fullscreen
flags: also-after-suspend
user: root
requires:
    executable.name == 'glxgears'
    dmi.product in ['Desktop','Low Profile Desktop','Tower','Mini Tower','Space-saving']
command:
     prime_offload_tester.py -c "glxgears -fullscreen" -t 30
summary:
    Test that glxgears works in full screen mode for current video card
purpose:
     Tests the basic full screen 3D capabilities of your current video card. This test covers all devices without an integrated display, such as desktops.
steps:
     1. Click "Test" to execute an OpenGL demo. Press ESC at any time to close.
     2. Verify that the animation is not jerky or slow.
verification:
     1. Did the 3d animation appear?
     2. Was the animation free from slowness/jerkiness?
id: graphics-gpu-cert-automated
unit: test plan
_name: Graphics tests (Automated)
_description:
 Graphics tests (Automated)
include:
~ skip ~
 graphics/auto_glxgears                         certification-status=blocker
 graphics/auto_glxgears_fullscreen              certification-status=blocker
~ skip ~
bootstrap_include:
    graphics_card

id: graphics-gpu-cert-manual
unit: test plan
_name: Graphics tests (Manual)
_description:
 Graphics tests (Manual)
include:
~ skip ~
 graphics/valid_glxgears                        certification-status=blocker
 graphics/valid_glxgears_fullscreen             certification-status=blocker
~ skip ~
bootstrap_include:
    graphics_card

Resolved issues

Documentation

Tests

Unit test and
laptop: auto, manual
desktop: auto, manual

@hanhsuan hanhsuan marked this pull request as ready for review May 14, 2024 05:58
@codecov
Copy link
Copy Markdown

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 92.39130% with 7 lines in your changes missing coverage. Please review.

Project coverage is 44.99%. Comparing base (d62c028) to head (e3d0989).
Report is 219 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/prime_offload_tester.py 92.39% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1245      +/-   ##
==========================================
+ Coverage   44.18%   44.99%   +0.81%     
==========================================
  Files         359      360       +1     
  Lines       38813    38941     +128     
  Branches     6581     6603      +22     
==========================================
+ Hits        17148    17520     +372     
+ Misses      21003    20751     -252     
- Partials      662      670       +8     
Flag Coverage Δ
provider-base 20.80% <92.39%> (+2.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

hanhsuan added 2 commits June 27, 2024 15:08
on which renderer. Therefore, this change is going to:
* add a new function to get which GPU is executing the command that could
  help user to make sure the renderer is not llvmpipe.
* refactor some codes to make reuse easier.
* add PCI ID in the log to make verify easier.
@pieqq pieqq force-pushed the add_finding_gpu_function branch from 102e48c to c50e70d Compare June 27, 2024 13:08
@fernando79513 fernando79513 self-assigned this Jul 16, 2024
Copy link
Copy Markdown
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

Good work there! This PR will help us a lot because the test is failing quite often.

I have added some comments that could help with the clarity of the code and make it easier to test/modify in the future.

@fernando79513 fernando79513 added the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Sep 2, 2024
hanhsuan and others added 7 commits September 5, 2024 13:31
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
2. removing _run_command
3. using run_with_timeout in the checkbox support to replace timeout
   command
Copy link
Copy Markdown
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, just some wording details to make some parts easier to understand.

hanhsuan and others added 3 commits September 11, 2024 07:56
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
2. add description for cmd[0]
@hanhsuan
Copy link
Copy Markdown
Contributor Author

@fernando79513 There is no failure and error related to my code when I run the test locally, but the github action couldn't pass. Should I rebase my branch or something else I have to do? thanks.

@fernando79513
Copy link
Copy Markdown
Collaborator

It was not an issue of rebasing, you were patching sys.modules for all the tests:

sys.modules["checkbox_support"] = MagicMock()
sys.modules["checkbox_support.helpers.timeout"] = MagicMock()

There was no need to do so. Also now, there is a @mock_timeout function.

@fernando79513 fernando79513 force-pushed the add_finding_gpu_function branch from a561ea7 to d1ba718 Compare September 11, 2024 21:00
@hanhsuan
Copy link
Copy Markdown
Contributor Author

Thanks a lot. I'll add more unit test coverage to make it pass codecov.

@hanhsuan hanhsuan removed the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Sep 13, 2024
@fernando79513 fernando79513 merged commit ce70144 into main Sep 13, 2024
@fernando79513 fernando79513 deleted the add_finding_gpu_function branch September 13, 2024 09:53
pieqq pushed a commit that referenced this pull request Oct 29, 2024
)

This PR adds the following test cases to check the GPU renderer on devices without an integrated GPU:

- graphics/auto_glxgears
- graphics/auto_glxgears_fullscreen
- graphics/valid_glxgears
- graphics/valid_glxgears_fullscreen

These jobs use the recently introduced `prime_offload_tester.py` script (see PR #1245)

They are added to nested test plans used for 24.04 LTS certification, and do not impact 22.04 or older.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants