diff options
Diffstat (limited to 'zephyr/test')
-rw-r--r-- | zephyr/test/drivers/prj.conf | 2 | ||||
-rw-r--r-- | zephyr/test/drivers/src/power_common.c | 6 | ||||
-rw-r--r-- | zephyr/test/drivers/src/smart.c | 24 | ||||
-rw-r--r-- | zephyr/test/drivers/src/usb_mux.c | 18 | ||||
-rw-r--r-- | zephyr/test/drivers/src/utils.c | 10 |
5 files changed, 31 insertions, 29 deletions
diff --git a/zephyr/test/drivers/prj.conf b/zephyr/test/drivers/prj.conf index 145cfb4369..8fde002209 100644 --- a/zephyr/test/drivers/prj.conf +++ b/zephyr/test/drivers/prj.conf @@ -27,6 +27,8 @@ CONFIG_DEBUG=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_OPTIMIZATIONS=y CONFIG_PLATFORM_EC_CONSOLE_DEBUG=y +CONFIG_SHELL_BACKEND_DUMMY=y +CONFIG_SHELL_BACKEND_SERIAL=n CONFIG_PLATFORM_EC=y CONFIG_CROS_EC=y diff --git a/zephyr/test/drivers/src/power_common.c b/zephyr/test/drivers/src/power_common.c index 04250f6b77..d24537ba34 100644 --- a/zephyr/test/drivers/src/power_common.c +++ b/zephyr/test/drivers/src/power_common.c @@ -628,20 +628,20 @@ ZTEST(power_common_hibernation, test_power_cmd_hibernation_delay) /* Test success on call without argument */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "hibdelay"), NULL); /* Test error on hibernation delay argument that is not a number */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "hibdelay test1"), NULL); /* Set hibernate delay */ h_delay = 3; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "hibdelay 3"), NULL); diff --git a/zephyr/test/drivers/src/smart.c b/zephyr/test/drivers/src/smart.c index 70a242abf4..08a4eafedd 100644 --- a/zephyr/test/drivers/src/smart.c +++ b/zephyr/test/drivers/src/smart.c @@ -434,28 +434,28 @@ ZTEST_USER(smart_battery, test_battery_fake_charge) /* Success on command with no argument */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake"), NULL); /* Fail on command with argument which is not a number */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake test"), NULL); /* Fail on command with charge level above 100% */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake 123"), NULL); /* Fail on command with charge level below 0% */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake -23"), NULL); /* Set fake charge level */ fake_charge = 65; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake 65"), NULL); /* Test that fake charge level is applied */ @@ -483,7 +483,7 @@ ZTEST_USER(smart_battery, test_battery_fake_charge) /* Disable fake charge level */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "battfake -1"), NULL); /* Test that fake charge level is not applied */ @@ -511,28 +511,28 @@ ZTEST_USER(smart_battery, test_battery_fake_temperature) /* Success on command with no argument */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake"), NULL); /* Fail on command with argument which is not a number */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake test"), NULL); /* Fail on command with too high temperature (above 500.0 K) */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake 5001"), NULL); /* Fail on command with too low temperature (below 0 K) */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake -23"), NULL); /* Set fake temperature */ fake_temp = 2840; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake 2840"), NULL); /* Test that fake temperature is applied */ @@ -544,7 +544,7 @@ ZTEST_USER(smart_battery, test_battery_fake_temperature) /* Disable fake temperature */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "batttempfake -1"), NULL); /* Test that fake temperature is not applied */ diff --git a/zephyr/test/drivers/src/usb_mux.c b/zephyr/test/drivers/src/usb_mux.c index d9ab2901a3..447cd39050 100644 --- a/zephyr/test/drivers/src/usb_mux.c +++ b/zephyr/test/drivers/src/usb_mux.c @@ -820,7 +820,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) /* Test error on command with no argument */ zassert_equal(EC_ERROR_PARAM_COUNT, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec"), NULL); /* @@ -829,17 +829,17 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) * without accessing cprints output. */ zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec debug"), NULL); /* Test error on port argument that is not a number */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec test1"), NULL); /* Test error on invalid port number */ zassert_equal(EC_ERROR_PARAM1, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 5"), NULL); /* @@ -848,7 +848,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) */ set_proxy_get_mux_state_seq(USB_PD_MUX_TBT_COMPAT_ENABLED); zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 1"), NULL); CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY); @@ -856,7 +856,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) reset_proxy_fakes(); exp_mode = USB_PD_MUX_NONE; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 1 none"), NULL); CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode); /* Mux will enter low power mode */ @@ -870,7 +870,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) reset_proxy_fakes(); exp_mode = USB_PD_MUX_USB_ENABLED | polarity; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 1 usb"), NULL); CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode); /* Mux will exit low power mode */ @@ -880,7 +880,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) reset_proxy_fakes(); exp_mode = USB_PD_MUX_DP_ENABLED | polarity; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 1 dp"), NULL); CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode); @@ -888,7 +888,7 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command) reset_proxy_fakes(); exp_mode = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED | polarity; zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), + shell_execute_cmd(get_ec_shell(), "typec 1 dock"), NULL); CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode); } diff --git a/zephyr/test/drivers/src/utils.c b/zephyr/test/drivers/src/utils.c index 83b465b84c..1cb49c6382 100644 --- a/zephyr/test/drivers/src/utils.c +++ b/zephyr/test/drivers/src/utils.c @@ -48,15 +48,14 @@ void test_set_chipset_to_s0(void) NULL); /* The easiest way to power on seems to be the shell command. */ - zassert_equal(EC_SUCCESS, - shell_execute_cmd(shell_backend_uart_get_ptr(), - "power on"), + zassert_equal(EC_SUCCESS, shell_execute_cmd(get_ec_shell(), "power on"), NULL); k_sleep(K_SECONDS(1)); /* Check if chipset is in correct state */ - zassert_equal(POWER_S0, power_get_state(), NULL); + zassert_equal(POWER_S0, power_get_state(), "Expected S0, got %d", + power_get_state()); } void test_set_chipset_to_g3(void) @@ -65,5 +64,6 @@ void test_set_chipset_to_g3(void) chipset_force_shutdown(CHIPSET_RESET_KB_SYSRESET); k_sleep(K_SECONDS(20)); /* Check if chipset is in correct state */ - zassert_equal(POWER_G3, power_get_state(), NULL); + zassert_equal(POWER_G3, power_get_state(), "Expected G3, got %d", + power_get_state()); } |