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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions tests/drivers/ipm/src/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Intel Corporation
* Copyright (c) 2015-2024 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -34,9 +34,9 @@
struct ipm_dummy_driver_data ipm_dummy0_driver_data;
DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL,
NULL, &ipm_dummy0_driver_data, NULL,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&ipm_dummy_api);

Check notice on line 39 in tests/drivers/ipm/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/drivers/ipm/src/main.c:39 -DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL, - NULL, &ipm_dummy0_driver_data, NULL, - PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &ipm_dummy_api); +DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL, NULL, &ipm_dummy0_driver_data, NULL, PRE_KERNEL_2, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ipm_dummy_api);
/* Sending side of the console IPM driver, will forward anything sent
* to printf() since we selected IPM_CONSOLE_STDOUT
*/
Expand Down Expand Up @@ -81,24 +81,35 @@
int rv, i;
const struct device *ipm;

rv = TC_PASS;

TC_SUITE_START("test_ipm");
ipm = device_get_binding("ipm_dummy0");

/* Try sending a raw string to the IPM device to show that the
* receiver works
*/
for (i = 0; i < strlen(thestr); i++) {
ipm_send(ipm, 1, thestr[i], NULL, 0);
if (ipm == NULL) {
TC_ERROR("unable to get device 'ipm_dummy0'\n");
rv = TC_FAIL;
} else {
/* Try sending a raw string to the IPM device to show that the
* receiver works
*/
int rc = 0;

for (i = 0; i < strlen(thestr) && rc == 0; i++) {
rc = ipm_send(ipm, 1, thestr[i], NULL, 0);
}
if (rc) {
TC_ERROR("ipm_send() error=%u\n", rc);
rv = TC_FAIL;
} else {
/* Now do this through printf() to exercise the sender */
/* I will be split to lines of LINE_BUF_SIZE */
printf(LOREM_IPSUM_SHORT "\n");
gmarull marked this conversation as resolved.
Show resolved Hide resolved
}
}

/* Now do this through printf() to exercise the sender */
printf(LOREM_IPSUM_SHORT "\n");

/* XXX how to tell if something was actually printed out for
* automation purposes?
/* Twister Console Harness checks the output actually printed out for
* automation purposes.
*/

rv = TC_PASS;
TC_END_RESULT(rv);
TC_SUITE_END("test_ipm", rv);
TC_END_REPORT(rv);
Expand Down
19 changes: 19 additions & 0 deletions tests/drivers/ipm/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,22 @@ tests:
- ipc
integration_platforms:
- qemu_x86
harness: console
harness_config:
type: multi_line
ordered: true
regex:
- "Running TESTSUITE test_ipm"
- "ipm_console: 'everything is awesome'"
- "ipm_console: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, \
sed do eiusmod tempor '"
- "ipm_console: 'incididunt ut labore et dolore magna aliqua. Ut enim ad \
minim veniam, quis nost'"
- "ipm_console: 'rud exercitation ullamco laboris nisi ut aliquip ex ea commodo \
consequat. Duis '"
- "ipm_console: 'aute irure dolor in reprehenderit in voluptate velit esse cillum \
dolore eu fugi'"
- "ipm_console: 'at nulla pariatur. Excepteur sint occaecat cupidatat non proident, \
sunt in culp'"
- "ipm_console: 'a qui officia deserunt mollit anim id est laborum.'"
- "TESTSUITE test_ipm succeeded"
Loading