Skip to content

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
@zephyrbot zephyrbot requested a review from dcpleung November 6, 2024 22:52
@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
@golowanow golowanow requested review from gmarull and nashif November 7, 2024 06:01
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

@golowanow golowanow force-pushed the fix_tests_drivers_ipm_20241106 branch from 253c402 to c3b67da Compare November 7, 2024 08:29
@DREXX-lab DREXX-lab mentioned this pull request Nov 7, 2024
@golowanow golowanow requested a review from gmarull November 7, 2024 08:31
@golowanow golowanow force-pushed the fix_tests_drivers_ipm_20241106 branch from c3b67da to e31351b Compare November 7, 2024 08:49
@golowanow golowanow requested a review from gmarull November 7, 2024 08:51
gmarull
gmarull previously approved these changes Nov 7, 2024
@golowanow golowanow requested a review from dcpleung November 7, 2024 08:53
Copy link
Member

Choose a reason for hiding this comment

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

why PRE_KERNEL_2? I would avoid this and use PRE_KERNEL_1 if possible, PRE_KERNEL_2 is something that hopefully will go away soon.

Copy link
Member Author

@golowanow golowanow Nov 7, 2024

Choose a reason for hiding this comment

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

why PRE_KERNEL_2?

Looking at drivers/ipm where both are used, my choice was the closest to POST_KERNEL as it was here,
although there is no visible difference when this test runs on qemu-s.

PRE_KERNEL_2 is something that hopefully will go away soon.

interesting, I didn't come across this info in the sources or docs, eg.
https://github.com/zephyrproject-rtos/zephyr/blob/main/doc/kernel/drivers/index.rst#initialization-levels

Copy link
Member

Choose a reason for hiding this comment

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

it is being discussed, please move this to PRE_KERNEL_1 for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, changed to PRE_KERNEL_1

@nashif
Copy link
Member

nashif commented Nov 7, 2024

did you consider switching this to ztest instead? Parsing output like this is not great and we do it mostly for samples only.

@golowanow
Copy link
Member Author

did you consider switching this to ztest instead? Parsing output like this is not great and we do it mostly for samples only.

I thought about refactoring to ztest, but considered it would be too much for a quick fix of this particular test where the console harness works well.

@golowanow golowanow added the bug The issue is a bug, or the PR is fixing a bug label Nov 7, 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.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
@nashif nashif added this to the v4.0.0 milestone Nov 8, 2024
@mmahadevan108 mmahadevan108 merged commit e3ec702 into zephyrproject-rtos:main Nov 8, 2024
17 checks passed
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 bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants