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

tests: drivers: ipm: Fix drivers.ipc.mailbox #81032

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

golowanow
Copy link
Member

@golowanow golowanow commented Nov 6, 2024

Fix drivers.ipc.mailbox test suite to restore and improve its testing functionality:

  • fix printf() redirection through IPM console.

  • fix and check the dummy driver initialization.

  • specify correct Twister harness type (Console) and use matching patterns to recognize the expected console output.

Before the fix: ./scripts/twister -p qemu_x86 -T tests/drivers/ipm

QEMU (2848302): Booting from ROM..                                                              
QEMU (2848302): unable to bind IPM console sender to 'ipm_dummy0'                               
QEMU (2848302): *** Booting Zephyr OS build v3.7.0-4704-g04dfd54eeb00 ***                       
QEMU (2848302): Running TESTSUITE test_ipm                                                      
QEMU (2848302): ===================================================================             
QEMU (2848302): ipm_console: 'everything is awesome'                                            
QEMU (2848302): TESTSUITE test_ipm succeeded                                                    
QEMU (2848302): ===================================================================             
QEMU (2848302): PROJECT EXECUTION SUCCESSFUL                                                    
not a ztest and no state for drivers.ipc.mailbox                                                

with the fix:

QEMU (2851700): Booting from ROM..
QEMU (2851700): *** Booting Zephyr OS build v4.0.0-rc2-103-g157180d515e6 ***
QEMU (2851700): Running TESTSUITE test_ipm
QEMU (2851700): ===================================================================
QEMU (2851700): ipm_console: 'everything is awesome'
QEMU (2851700): ipm_console: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor '
QEMU (2851700): ipm_console: 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nost'
QEMU (2851700): ipm_console: 'rud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '
QEMU (2851700): ipm_console: 'aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugi'
QEMU (2851700): ipm_console: 'at nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp'
QEMU (2851700): ipm_console: 'a qui officia deserunt mollit anim id est laborum.'
QEMU (2851700): TESTSUITE test_ipm succeeded
QEMU (2851700): ===================================================================
QEMU (2851700): PROJECT EXECUTION SUCCESSFUL

@golowanow golowanow marked this pull request as ready for review November 6, 2024 22:52
@zephyrbot zephyrbot added the area: IPM Inter-Processor Mailbox label Nov 6, 2024
@golowanow golowanow added the area: Tests Issues related to a particular existing or missing test label Nov 6, 2024
dcpleung
dcpleung previously approved these changes Nov 7, 2024
@@ -32,9 +32,9 @@ extern struct ipm_driver_api ipm_dummy_api;

/* Set up the dummy IPM driver */
struct ipm_dummy_driver_data ipm_dummy0_driver_data;
DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL,
DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", ipm_dummy_init,
Copy link
Member

Choose a reason for hiding this comment

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

why is a dummy init call needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

to check the dummy device for this test that it pass init stage

Copy link
Member

Choose a reason for hiding this comment

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

Device successful init needs to be tested by getting a valid reference when using device_get_binding, not by inserting dummy calls

Copy link
Member Author

Choose a reason for hiding this comment

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

What is the problem to check the init this way for this test's purposes ?
(device_get_binding() check is added as well)

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

redundant init call

tests/drivers/ipm/src/main.c Outdated Show resolved Hide resolved
tests/drivers/ipm/src/main.c Outdated Show resolved Hide resolved
tests/drivers/ipm/src/main.c Show resolved Hide resolved
Fix 'drivers.ipc.mailbox' test suite to restore and improve
its testing functionality:

 * fix printf() redirection through IPM console.

 * fix and check the dummy driver initialization.

 * specify correct Twister harness type (Console)
   and use matching patterns to recognize the expected
   console output.

Signed-off-by: Dmitrii Golovanov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: IPM Inter-Processor Mailbox area: Tests Issues related to a particular existing or missing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants