You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the zephyr shell for one of our hardware testing platforms and are currently working on creating unittests to validate the custom commands we have created. This is all being programmed in C,
Executing the custom commands using the "shell_execute_command" function seems to work fine, no errors are thrown. So it seems to be able to find the custom commands, however when the dummy shell output is retrieved using the "shell_backend_dummy_get_output" function nothing is present in the output and the size variable says it has a size of 2,
When doing the same for an existing command such as help, the expected output is present.
Does anyone know if there is a configuration setting that I am missing or what I am doing wrong?
The prj.conf file looks like:
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=n
CONFIG_SHELL_BACKEND_DUMMY=y
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
We are using the zephyr shell for one of our hardware testing platforms and are currently working on creating unittests to validate the custom commands we have created. This is all being programmed in C,
Executing the custom commands using the "shell_execute_command" function seems to work fine, no errors are thrown. So it seems to be able to find the custom commands, however when the dummy shell output is retrieved using the "shell_backend_dummy_get_output" function nothing is present in the output and the size variable says it has a size of 2,
When doing the same for an existing command such as help, the expected output is present.
Does anyone know if there is a configuration setting that I am missing or what I am doing wrong?
The prj.conf file looks like:
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=n
CONFIG_SHELL_BACKEND_DUMMY=y
CONFIG_ZTEST=y
CONFIG_ZTEST_MOCKING=y
And our unittest looks like:
#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_mock.h>
#include <zephyr/shell/shell.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/drivers/sensor.h>
ZTEST(module_imu, accelerometer_get_successful)
{
const struct shell *sh = shell_backend_dummy_get_ptr();
const char *buf;
size_t size;
}
ZTEST_SUITE(module_imu, NULL, NULL, NULL, teardown, NULL);
The custom shell commands are initialized and registered in a separate file.
Beta Was this translation helpful? Give feedback.
All reactions