summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-11-30 11:10:12 +0100
committerCommit Bot <commit-bot@chromium.org>2021-12-03 10:11:57 +0000
commitf2dc52854e67a4fc5b57c9ae702cd3da6353b974 (patch)
treeffbcf094f8f904cfdd1c8af5824788841a2228e4
parentb929577e9a61b0f65db1b81a60247095b38a4af6 (diff)
downloadchrome-ec-f2dc52854e67a4fc5b57c9ae702cd3da6353b974.tar.gz
zephyr: drivers: Switch usb_mux test to FFF
Use FFF framework instead of ztest_* API in usb_mux test. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I6c42f8f60d0b4bfb5a852e53539ffb9fb9424b10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3306363 Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r--zephyr/test/drivers/src/usb_mux.c556
1 files changed, 343 insertions, 213 deletions
diff --git a/zephyr/test/drivers/src/usb_mux.c b/zephyr/test/drivers/src/usb_mux.c
index d2833650b4..517bb59107 100644
--- a/zephyr/test/drivers/src/usb_mux.c
+++ b/zephyr/test/drivers/src/usb_mux.c
@@ -14,6 +14,7 @@
#include "common.h"
#include "ec_commands.h"
#include "ec_tasks.h"
+#include "fff.h"
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
@@ -27,18 +28,20 @@
/** Copy of original usb_muxes[USB_PORT_C1] */
struct usb_mux usb_mux_c1;
+/** Number of usb mux proxies in chain */
+#define NUM_OF_PROXY 3
+
/** Pointers to original usb muxes chain of port c1 */
-const struct usb_mux *org_mux[3];
+const struct usb_mux *org_mux[NUM_OF_PROXY];
/** Proxy function which check calls from usb_mux framework to driver */
-static int proxy_init(const struct usb_mux *me)
+FAKE_VALUE_FUNC1(int, proxy_init, const struct usb_mux *);
+static int proxy_init_custom(const struct usb_mux *me)
{
int i = me->i2c_addr_flags;
int ec = EC_SUCCESS;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->driver->init != NULL) {
@@ -46,23 +49,24 @@ static int proxy_init(const struct usb_mux *me)
}
if (task_get_current() == TASK_ID_TEST_RUNNER) {
- return ztest_get_return_value();
+ RETURN_FAKE_RESULT(proxy_init);
}
+ /* Discard this call if made from different thread */
+ proxy_init_fake.call_count--;
+
return ec;
}
/** Proxy function which check calls from usb_mux framework to driver */
-static int proxy_set(const struct usb_mux *me, mux_state_t mux_state,
- bool *ack_required)
+FAKE_VALUE_FUNC3(int, proxy_set, const struct usb_mux *, mux_state_t, bool *);
+static int proxy_set_custom(const struct usb_mux *me, mux_state_t mux_state,
+ bool *ack_required)
{
int i = me->i2c_addr_flags;
int ec = EC_SUCCESS;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- ztest_check_expected_value(mux_state);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->driver->set != NULL) {
@@ -71,21 +75,36 @@ static int proxy_set(const struct usb_mux *me, mux_state_t mux_state,
}
if (task_get_current() == TASK_ID_TEST_RUNNER) {
- return ztest_get_return_value();
+ RETURN_FAKE_RESULT(proxy_set);
}
+ /* Discard this call if made from different thread */
+ proxy_set_fake.call_count--;
+
return ec;
}
/** Proxy function which check calls from usb_mux framework to driver */
-static int proxy_get(const struct usb_mux *me, mux_state_t *mux_state)
+FAKE_VALUE_FUNC2(int, proxy_get, const struct usb_mux *, mux_state_t *);
+/** Sequence of mux_state values returned by proxy_get function */
+static mux_state_t proxy_get_mux_state_seq[NUM_OF_PROXY];
+/** Index of next mux_state to return from proxy_get_function */
+static int proxy_get_mux_state_seq_idx;
+/** Set all mux_state in sequence to the same state value */
+static void set_proxy_get_mux_state_seq(mux_state_t state)
+{
+ proxy_get_mux_state_seq_idx = 0;
+ for (int i = 0; i < NUM_OF_PROXY; i++) {
+ proxy_get_mux_state_seq[i] = state;
+ }
+}
+
+static int proxy_get_custom(const struct usb_mux *me, mux_state_t *mux_state)
{
int i = me->i2c_addr_flags;
int ec = EC_SUCCESS;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->driver->get != NULL) {
@@ -93,23 +112,29 @@ static int proxy_get(const struct usb_mux *me, mux_state_t *mux_state)
}
if (task_get_current() == TASK_ID_TEST_RUNNER) {
- *mux_state = ztest_get_return_value();
-
- return ztest_get_return_value();
+ zassert_true(proxy_get_mux_state_seq_idx < NUM_OF_PROXY,
+ "%s called too many times without resetting "
+ "mux_state_seq", __func__);
+ *mux_state =
+ proxy_get_mux_state_seq[proxy_get_mux_state_seq_idx];
+ proxy_get_mux_state_seq_idx++;
+ RETURN_FAKE_RESULT(proxy_get);
}
+ /* Discard this call if made from different thread */
+ proxy_get_fake.call_count--;
+
return ec;
}
/** Proxy function which check calls from usb_mux framework to driver */
-static int proxy_enter_low_power_mode(const struct usb_mux *me)
+FAKE_VALUE_FUNC1(int, proxy_enter_low_power_mode, const struct usb_mux *);
+static int proxy_enter_low_power_mode_custom(const struct usb_mux *me)
{
int i = me->i2c_addr_flags;
int ec = EC_SUCCESS;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->driver->enter_low_power_mode != NULL) {
@@ -117,21 +142,23 @@ static int proxy_enter_low_power_mode(const struct usb_mux *me)
}
if (task_get_current() == TASK_ID_TEST_RUNNER) {
- return ztest_get_return_value();
+ RETURN_FAKE_RESULT(proxy_enter_low_power_mode);
}
+ /* Discard this call if made from different thread */
+ proxy_enter_low_power_mode_fake.call_count--;
+
return ec;
}
/** Proxy function which check calls from usb_mux framework to driver */
-static int proxy_chipset_reset(const struct usb_mux *me)
+FAKE_VALUE_FUNC1(int, proxy_chipset_reset, const struct usb_mux *);
+static int proxy_chipset_reset_custom(const struct usb_mux *me)
{
int i = me->i2c_addr_flags;
int ec = EC_SUCCESS;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->driver->chipset_reset != NULL) {
@@ -139,9 +166,12 @@ static int proxy_chipset_reset(const struct usb_mux *me)
}
if (task_get_current() == TASK_ID_TEST_RUNNER) {
- return ztest_get_return_value();
+ RETURN_FAKE_RESULT(proxy_chipset_reset);
}
+ /* Discard this call if made from different thread */
+ proxy_chipset_reset_fake.call_count--;
+
return ec;
}
@@ -152,20 +182,23 @@ static bool proxy_fw_update_cap(void)
}
/** Proxy function which check calls from usb_mux framework to driver */
-static void proxy_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
- bool *ack_required)
+FAKE_VOID_FUNC3(proxy_hpd_update, const struct usb_mux *, mux_state_t, bool *);
+static void proxy_hpd_update_custom(const struct usb_mux *me,
+ mux_state_t mux_state, bool *ack_required)
{
int i = me->i2c_addr_flags;
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- ztest_check_expected_value(mux_state);
- }
+ zassert_true(i < NUM_OF_PROXY, "Proxy called for non proxy usb_mux");
if (org_mux[i] != NULL &&
org_mux[i]->hpd_update != NULL) {
org_mux[i]->hpd_update(org_mux[i], mux_state, ack_required);
}
+
+ if (task_get_current() != TASK_ID_TEST_RUNNER) {
+ /* Discard this call if made from different thread */
+ proxy_hpd_update_fake.call_count--;
+ }
}
/** Usb mux driver with proxy functions */
@@ -178,6 +211,71 @@ const struct usb_mux_driver proxy_usb_mux = {
.is_retimer_fw_update_capable = &proxy_fw_update_cap,
};
+/** Mock function used in init test */
+FAKE_VALUE_FUNC1(int, mock_board_init, const struct usb_mux *);
+static int mock_board_init_custom(const struct usb_mux *me)
+{
+ if (task_get_current() == TASK_ID_TEST_RUNNER) {
+ RETURN_FAKE_RESULT(mock_board_init);
+ }
+
+ /* Discard this call if made from different thread */
+ mock_board_init_fake.call_count--;
+
+ return EC_SUCCESS;
+}
+
+/** Mock function used in set test */
+FAKE_VALUE_FUNC2(int, mock_board_set, const struct usb_mux *, mux_state_t);
+static int mock_board_set_custom(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ if (task_get_current() == TASK_ID_TEST_RUNNER) {
+ RETURN_FAKE_RESULT(mock_board_set);
+ }
+
+ /* Discard this call if made from different thread */
+ mock_board_set_fake.call_count--;
+
+ return EC_SUCCESS;
+}
+
+/**
+ * Reset state of all fake functions, setup custom fake functions and set
+ * default return value to EC_SUCCESS (all functions which has return value)
+ */
+static void reset_proxy_fakes(void)
+{
+ RESET_FAKE(proxy_init);
+ RESET_FAKE(proxy_set);
+ RESET_FAKE(proxy_get);
+ RESET_FAKE(proxy_enter_low_power_mode);
+ RESET_FAKE(proxy_chipset_reset);
+ RESET_FAKE(proxy_hpd_update);
+ RESET_FAKE(mock_board_init);
+ RESET_FAKE(mock_board_set);
+
+ /* Setup proxy functions */
+ proxy_init_fake.custom_fake = proxy_init_custom;
+ proxy_set_fake.custom_fake = proxy_set_custom;
+ proxy_get_fake.custom_fake = proxy_get_custom;
+ proxy_enter_low_power_mode_fake.custom_fake =
+ proxy_enter_low_power_mode_custom;
+ proxy_chipset_reset_fake.custom_fake = proxy_chipset_reset_custom;
+ proxy_hpd_update_fake.custom_fake = proxy_hpd_update_custom;
+ mock_board_init_fake.custom_fake = mock_board_init_custom;
+ mock_board_set_fake.custom_fake = mock_board_set_custom;
+
+ /* Set default return value */
+ proxy_init_fake.return_val = EC_SUCCESS;
+ proxy_set_fake.return_val = EC_SUCCESS;
+ proxy_get_fake.return_val = EC_SUCCESS;
+ proxy_enter_low_power_mode_fake.return_val = EC_SUCCESS;
+ proxy_chipset_reset_fake.return_val = EC_SUCCESS;
+ mock_board_init_fake.return_val = EC_SUCCESS;
+ mock_board_set_fake.return_val = EC_SUCCESS;
+}
+
/** Chain of 3 proxy usb muxes */
struct usb_mux proxy_chain_2 = {
.usb_port = USBC_PORT_C1,
@@ -219,7 +317,7 @@ static void setup_usb_mux_proxy_chain(void)
* each proxy
*/
t = &usb_mux_c1;
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < NUM_OF_PROXY; i++) {
org_mux[i] = t;
if (t != NULL) {
t = t->next_mux;
@@ -234,123 +332,95 @@ static void setup_usb_mux_proxy_chain(void)
}
/** Restore original usb_mux chain without proxy */
-static void resotre_usb_mux_chain(void)
+static void restore_usb_mux_chain(void)
{
memcpy(&usb_muxes[USBC_PORT_C1], &usb_mux_c1, sizeof(struct usb_mux));
}
/**
- * Setup expect values for proxy from first to last selected.
- * Set value returned by proxy to ec.
+ * Check if given proxy function was called num times and if first argument was
+ * pointer to the right proxy chain element. First argument is
+ * const struct usb_mux * for all struct usb_mux_driver callbacks.
*/
-static void setup_ztest_proxy_init(int first, int last, int ec)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_init, i, i);
- ztest_returns_value(proxy_init, ec);
- }
-}
+#define CHECK_PROXY_FAKE_CALL_CNT(proxy, num) \
+ do { \
+ zassert_equal(num, proxy##_fake.call_count, "%d != %d", \
+ num, proxy##_fake.call_count); \
+ if (num >= 1) { \
+ zassert_equal(&usb_muxes[USBC_PORT_C1], \
+ proxy##_fake.arg0_history[0], \
+ NULL); \
+ } \
+ if (num >= 2) { \
+ zassert_equal(&proxy_chain_1, \
+ proxy##_fake.arg0_history[1], \
+ NULL); \
+ } \
+ if (num >= 3) { \
+ zassert_equal(&proxy_chain_2, \
+ proxy##_fake.arg0_history[2], \
+ NULL); \
+ } \
+ } while (0)
/**
- * Setup expect values for proxy from first to last selected.
- * Set value returned by proxy to ec.
+ * Do the same thing as CHECK_PROXY_FAKE_CALL_CNT and check if second argument
+ * was the same as given state. hpd_update and set callback have mux_state_t
+ * as second argument.
*/
-static void setup_ztest_proxy_set(int first, int last, int ec, mux_state_t exp)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_set, i, i);
- ztest_expect_value(proxy_set, mux_state, exp);
- ztest_returns_value(proxy_set, ec);
- }
-}
-
-/**
- * Setup expect values for proxy from first to last selected. Set value
- * returned by proxy to ec and value returned through mux_state to exp.
- */
-static void setup_ztest_proxy_get(int first, int last, int ec, mux_state_t exp)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_get, i, i);
- ztest_returns_value(proxy_get, exp);
- ztest_returns_value(proxy_get, ec);
- }
-}
-
-/**
- * Setup expect values for proxy from first to last selected.
- * Set value returned by proxy to ec.
- */
-static void setup_ztest_proxy_enter_lpm(int first, int last, int ec)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_enter_low_power_mode, i, i);
- ztest_returns_value(proxy_enter_low_power_mode, ec);
- }
-}
-
-/**
- * Setup expect values for proxy from first to last selected.
- * Set value returned by proxy to ec.
- */
-static void setup_ztest_proxy_chipset_reset(int first, int last, int ec)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_chipset_reset, i, i);
- ztest_returns_value(proxy_chipset_reset, ec);
- }
-}
-
-/** Setup expect values for proxy from first to last selected */
-static void setup_ztest_proxy_hpd_update(int first, int last, mux_state_t exp)
-{
- for (int i = first; i <= last; i++) {
- ztest_expect_value(proxy_hpd_update, i, i);
- ztest_expect_value(proxy_hpd_update, mux_state, exp);
- }
-}
-
-/** Mock function used in set test */
-static int mock_board_set(const struct usb_mux *me, mux_state_t mux_state)
-{
- int i = me->i2c_addr_flags;
-
- if (task_get_current() == TASK_ID_TEST_RUNNER) {
- ztest_check_expected_value(i);
- }
-
- return EC_SUCCESS;
-}
+#define CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy, num, state) \
+ do { \
+ CHECK_PROXY_FAKE_CALL_CNT(proxy, num); \
+ if (num >= 1) { \
+ zassert_equal(state, \
+ proxy##_fake.arg1_history[0], \
+ "0x%x != 0x%x", state, \
+ proxy##_fake.arg1_history[0]); \
+ } \
+ if (num >= 2) { \
+ zassert_equal(state, \
+ proxy##_fake.arg1_history[1], \
+ "0x%x != 0x%x", state, \
+ proxy##_fake.arg1_history[1]); \
+ } \
+ if (num >= 3) { \
+ zassert_equal(state, \
+ proxy##_fake.arg1_history[2], \
+ "0x%x != 0x%x", state, \
+ proxy##_fake.arg1_history[2]); \
+ } \
+ } while (0)
/** Test usb_mux init */
static void test_usb_mux_init(void)
{
+ int fail_on_2nd_ret[] = {EC_SUCCESS, EC_ERROR_NOT_POWERED};
+
/* Set AP to normal state to init BB retimer */
power_set_state(POWER_S0);
/* Test successful initialisation */
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
usb_mux_init(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
/*
* Test failed initialisation. Muxes that are in chain after
* the one which fails shouldn't be called
*/
- setup_ztest_proxy_init(0, 0, EC_SUCCESS);
- setup_ztest_proxy_init(1, 1, EC_ERROR_NOT_POWERED);
+ reset_proxy_fakes();
+ SET_RETURN_SEQ(proxy_init, fail_on_2nd_ret, 2);
usb_mux_init(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 2);
/* Test board init callback */
- proxy_chain_1.board_init = proxy_init;
- setup_ztest_proxy_init(0, 0, EC_SUCCESS);
- /*
- * board_init of second mux mock is set to init mock function, so it
- * should be called two times.
- */
- setup_ztest_proxy_init(1, 1, EC_SUCCESS);
- setup_ztest_proxy_init(1, 2, EC_SUCCESS);
-
+ proxy_chain_1.board_init = &mock_board_init;
+ reset_proxy_fakes();
usb_mux_init(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ /* Check if board_init was called for proxy 1 */
+ zassert_equal(1, mock_board_init_fake.call_count, NULL);
+ zassert_equal(&proxy_chain_1, mock_board_init_fake.arg0_history[0],
+ NULL);
proxy_chain_1.board_init = NULL;
}
@@ -358,40 +428,57 @@ static void test_usb_mux_init(void)
/** Test usb_mux setting mux mode */
static void test_usb_mux_set(void)
{
+ int fail_on_2nd_ret[] = {EC_SUCCESS, EC_ERROR_UNKNOWN};
mux_state_t exp_mode;
- /* usb mux 1 shouldn't be set with polarity mode */
+ /* Set flag for usb mux 1 to disable polarity setting */
proxy_chain_1.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
/* Test setting mux mode without polarity inversion */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ /* All muxes should have the same mode */
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test setting mux mode with polarity inversion */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_TBT_COMPAT_ENABLED;
- setup_ztest_proxy_set(0, 0, EC_SUCCESS,
- exp_mode | USB_PD_MUX_POLARITY_INVERTED);
- setup_ztest_proxy_set(1, 1, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_set(2, 2, EC_SUCCESS,
- exp_mode | USB_PD_MUX_POLARITY_INVERTED);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
1 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_set, NUM_OF_PROXY);
+ /* usb mux 1 shouldn't be set with polarity mode, because of flag */
+ zassert_equal(exp_mode | USB_PD_MUX_POLARITY_INVERTED,
+ proxy_set_fake.arg1_history[0], NULL);
+ zassert_equal(exp_mode, proxy_set_fake.arg1_history[1], NULL);
+ zassert_equal(exp_mode | USB_PD_MUX_POLARITY_INVERTED,
+ proxy_set_fake.arg1_history[2], NULL);
/* Test board set callback */
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
+ reset_proxy_fakes();
proxy_chain_1.board_set = &mock_board_set;
- ztest_expect_value(mock_board_set, i, 1);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
+ /* Check if board_set was called for proxy 1 */
+ zassert_equal(1, mock_board_set_fake.call_count, NULL);
+ zassert_equal(&proxy_chain_1, mock_board_set_fake.arg0_history[0],
+ NULL);
+ zassert_equal(exp_mode, mock_board_set_fake.arg1_history[0], NULL);
/* Test set function with error in usb_mux */
- setup_ztest_proxy_set(0, 0, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_set(1, 1, EC_ERROR_UNKNOWN, exp_mode);
+ reset_proxy_fakes();
+ SET_RETURN_SEQ(proxy_set, fail_on_2nd_ret, 2);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, 2, exp_mode);
+ /* board_set shouldn't be called after fail */
+ zassert_equal(0, mock_board_set_fake.call_count, NULL);
proxy_chain_1.board_set = NULL;
}
@@ -402,105 +489,125 @@ static void test_usb_mux_reset_in_g3(void)
mux_state_t exp_mode = USB_PD_MUX_USB_ENABLED;
/* Test that init is called */
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
+ reset_proxy_fakes();
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Usb muxes of port 1 should stay initialised */
usb_muxes[USBC_PORT_C1].flags = 0;
hook_notify(HOOK_CHIPSET_HARD_OFF);
/* Test that init is not called */
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
+ reset_proxy_fakes();
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
}
/** Test usb_mux getting mux mode */
static void test_usb_mux_get(void)
{
+ int fail_on_2nd_ret[] = {EC_SUCCESS, EC_ERROR_UNKNOWN};
mux_state_t exp_mode, mode;
/* Test getting mux mode */
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_get(0, 2, EC_SUCCESS, exp_mode);
+ set_proxy_get_mux_state_seq(exp_mode);
mode = usb_mux_get(USBC_PORT_C1);
zassert_equal(exp_mode, mode, "mode is 0x%x (!= 0x%x)", mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
- /* Test getting mux mode with one inverted polarisation */
+ /* Test getting mux mode with inverted polarisation in one mux */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_TBT_COMPAT_ENABLED;
- setup_ztest_proxy_get(0, 0, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_get(1, 1, EC_SUCCESS,
- exp_mode | USB_PD_MUX_POLARITY_INVERTED);
- setup_ztest_proxy_get(2, 2, EC_SUCCESS, exp_mode);
+ set_proxy_get_mux_state_seq(exp_mode);
+ /* Set polarisation in usb mux 1 state */
+ proxy_get_mux_state_seq[1] |= USB_PD_MUX_POLARITY_INVERTED;
exp_mode |= USB_PD_MUX_POLARITY_INVERTED;
mode = usb_mux_get(USBC_PORT_C1);
zassert_equal(exp_mode, mode, "mode is 0x%x (!= 0x%x)", mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
/* Test get function with error in usb_mux */
- setup_ztest_proxy_get(0, 0, EC_SUCCESS, USB_PD_MUX_TBT_COMPAT_ENABLED);
- setup_ztest_proxy_get(1, 1, EC_ERROR_UNKNOWN,
- USB_PD_MUX_TBT_COMPAT_ENABLED);
+ reset_proxy_fakes();
+ SET_RETURN_SEQ(proxy_get, fail_on_2nd_ret, 2);
+ set_proxy_get_mux_state_seq(USB_PD_MUX_TBT_COMPAT_ENABLED);
exp_mode = USB_PD_MUX_NONE;
mode = usb_mux_get(USBC_PORT_C1);
zassert_equal(exp_mode, mode, "mode is 0x%x (!= 0x%x)", mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, 2);
}
/** Test usb_mux entering and exiting low power mode */
static void test_usb_mux_low_power_mode(void)
{
+ int fail_on_2nd_ret[] = {EC_SUCCESS, EC_ERROR_NOT_POWERED};
mux_state_t exp_mode, mode;
/* Test enter to low power mode */
exp_mode = USB_PD_MUX_NONE;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_enter_lpm(0, 2, EC_SUCCESS);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_DISCONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_enter_low_power_mode, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test that nothing is changed when already in low power mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_NONE;
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_DISCONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_enter_low_power_mode, 0);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_set, 0);
/* Test that get return USB_PD_MUX_NONE in low power mode */
exp_mode = USB_PD_MUX_NONE;
mode = usb_mux_get(USBC_PORT_C1);
zassert_equal(exp_mode, mode, "mode is 0x%x (!= 0x%x)", mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, 0);
/* Test exiting from low power mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test exiting from lpm, when init end with EC_ERROR_NOT_POWERED */
- setup_ztest_proxy_init(0, 0, EC_SUCCESS);
- setup_ztest_proxy_init(1, 1, EC_ERROR_NOT_POWERED);
+ reset_proxy_fakes();
+ SET_RETURN_SEQ(proxy_init, fail_on_2nd_ret, 2);
usb_mux_init(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 2);
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test enter to low power mode with polarity */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_NONE;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_enter_lpm(0, 2, EC_SUCCESS);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_DISCONNECT,
1 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_enter_low_power_mode, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test that nothing is changed on lpm exit error */
+ reset_proxy_fakes();
+ SET_RETURN_SEQ(proxy_init, fail_on_2nd_ret, 2);
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 0, EC_SUCCESS);
- setup_ztest_proxy_init(1, 1, EC_ERROR_NOT_POWERED);
usb_mux_set(USBC_PORT_C1, exp_mode, USB_SWITCH_CONNECT,
0 /* = polarity */);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 2);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_set, 0);
}
/** Test usb_mux flip */
@@ -508,32 +615,34 @@ static void test_usb_mux_flip(void)
{
mux_state_t exp_mode;
- /* usb mux mock 1 shouldn't be set with polarity mode */
+ /* Set flag for usb mux 1 to disable polarity setting */
proxy_chain_1.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
- /* Makes sure that usb muxes of port 1 are not init */
- usb_muxes[USBC_PORT_C1].flags = USB_MUX_FLAG_RESETS_IN_G3;
- hook_notify(HOOK_CHIPSET_HARD_OFF);
-
/* Test flip port without polarity inverted */
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_get(0, 2, EC_SUCCESS, exp_mode);
- exp_mode |= USB_PD_MUX_POLARITY_INVERTED;
- setup_ztest_proxy_set(0, 0, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_set(1, 1, EC_SUCCESS,
- exp_mode & ~USB_PD_MUX_POLARITY_INVERTED);
- setup_ztest_proxy_set(2, 2, EC_SUCCESS, exp_mode);
+ set_proxy_get_mux_state_seq(exp_mode);
usb_mux_flip(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_set, NUM_OF_PROXY);
+ /* usb mux 1 shouldn't be set with polarity mode, because of flag */
+ zassert_equal(exp_mode | USB_PD_MUX_POLARITY_INVERTED,
+ proxy_set_fake.arg1_history[0], NULL);
+ zassert_equal(exp_mode, proxy_set_fake.arg1_history[1], NULL);
+ zassert_equal(exp_mode | USB_PD_MUX_POLARITY_INVERTED,
+ proxy_set_fake.arg1_history[2], NULL);
/* Test flip port with polarity inverted */
- setup_ztest_proxy_get(0, 0, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_get(1, 1, EC_SUCCESS,
- exp_mode & ~USB_PD_MUX_POLARITY_INVERTED);
- setup_ztest_proxy_get(2, 2, EC_SUCCESS, exp_mode);
+ reset_proxy_fakes();
+ exp_mode |= USB_PD_MUX_POLARITY_INVERTED;
+ set_proxy_get_mux_state_seq(exp_mode);
+ /* Clear polarity bit from usb mux 1 */
+ proxy_get_mux_state_seq[1] &= ~USB_PD_MUX_POLARITY_INVERTED;
exp_mode &= ~USB_PD_MUX_POLARITY_INVERTED;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
usb_mux_flip(USBC_PORT_C1);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
}
void test_usb_mux_hpd_update(void)
@@ -545,40 +654,50 @@ void test_usb_mux_hpd_update(void)
/* Test no hpd level and no irq */
exp_mode = virt_mode;
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
- setup_ztest_proxy_hpd_update(0, 2, exp_mode);
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY,
+ exp_mode);
/* Test hpd level and irq */
+ reset_proxy_fakes();
exp_mode = virt_mode | USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ;
- setup_ztest_proxy_hpd_update(0, 2, exp_mode);
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY,
+ exp_mode);
/* Test no hpd level and irq */
+ reset_proxy_fakes();
exp_mode = virt_mode | USB_PD_MUX_HPD_IRQ;
- setup_ztest_proxy_hpd_update(0, 2, exp_mode);
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY,
+ exp_mode);
/* Test hpd level and no irq */
+ reset_proxy_fakes();
exp_mode = virt_mode | USB_PD_MUX_HPD_LVL;
- setup_ztest_proxy_hpd_update(0, 2, exp_mode);
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY,
+ exp_mode);
}
void test_usb_mux_fw_update_port_info(void)
@@ -592,9 +711,9 @@ void test_usb_mux_fw_update_port_info(void)
void test_usb_mux_chipset_reset(void)
{
- setup_ztest_proxy_chipset_reset(0, 2, EC_SUCCESS);
/* After this hook chipset reset functions should be called */
hook_notify(HOOK_CHIPSET_RESET);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_chipset_reset, NUM_OF_PROXY);
}
/* Test host command get mux info */
@@ -614,27 +733,32 @@ static void test_usb_mux_hc_mux_info(void)
params.port = USBC_PORT_C1;
/* Test error on getting mux mode */
- setup_ztest_proxy_get(0, 0, EC_ERROR_UNKNOWN,
- USB_PD_MUX_TBT_COMPAT_ENABLED);
+ set_proxy_get_mux_state_seq(USB_PD_MUX_USB_ENABLED);
+ proxy_get_fake.return_val = EC_ERROR_UNKNOWN;
zassert_equal(EC_RES_ERROR, host_command_process(&args), NULL);
/* Test getting mux mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_get(0, 2, EC_SUCCESS, exp_mode);
+ set_proxy_get_mux_state_seq(exp_mode);
zassert_equal(EC_RES_SUCCESS, host_command_process(&args), NULL);
zassert_equal(args.response_size, sizeof(response), NULL);
zassert_equal(exp_mode, response.flags, "mode is 0x%x (!= 0x%x)",
response.flags, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
/* Test clearing HPD IRQ */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_HPD_LVL |
USB_PD_MUX_HPD_IRQ;
- setup_ztest_proxy_get(0, 2, EC_SUCCESS, exp_mode);
- setup_ztest_proxy_hpd_update(0, 2, USB_PD_MUX_HPD_LVL);
+ set_proxy_get_mux_state_seq(exp_mode);
zassert_equal(EC_RES_SUCCESS, host_command_process(&args), NULL);
zassert_equal(args.response_size, sizeof(response), NULL);
zassert_equal(exp_mode, response.flags, "mode is 0x%x (!= 0x%x)",
response.flags, exp_mode);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_hpd_update, NUM_OF_PROXY,
+ USB_PD_MUX_HPD_LVL);
}
/** Test typec console command */
@@ -670,42 +794,47 @@ static void test_usb_mux_typec_command(void)
* Test success on correct port number. Command should print mux state
* on console, but it is not possible to check that in unit test.
*/
- setup_ztest_proxy_get(0, 2, EC_SUCCESS, USB_PD_MUX_TBT_COMPAT_ENABLED);
+ set_proxy_get_mux_state_seq(USB_PD_MUX_TBT_COMPAT_ENABLED);
zassert_equal(EC_SUCCESS,
shell_execute_cmd(shell_backend_uart_get_ptr(),
"typec 1"), NULL);
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_get, NUM_OF_PROXY);
/* Test setting none mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_NONE;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
- /* Mux will enter low power mode */
- setup_ztest_proxy_enter_lpm(0, 2, EC_SUCCESS);
zassert_equal(EC_SUCCESS,
shell_execute_cmd(shell_backend_uart_get_ptr(),
"typec 1 none"), NULL);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
+ /* Mux will enter low power mode */
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_enter_low_power_mode, NUM_OF_PROXY);
/* Test setting USB mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
- /* Mux will exit low power mode */
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
zassert_equal(EC_SUCCESS,
shell_execute_cmd(shell_backend_uart_get_ptr(),
"typec 1 usb"), NULL);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
+ /* Mux will exit low power mode */
+ CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
/* Test setting DP mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_DP_ENABLED;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
zassert_equal(EC_SUCCESS,
shell_execute_cmd(shell_backend_uart_get_ptr(),
"typec 1 dp"), NULL);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
/* Test setting dock mode */
+ reset_proxy_fakes();
exp_mode = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED;
- setup_ztest_proxy_set(0, 2, EC_SUCCESS, exp_mode);
zassert_equal(EC_SUCCESS,
shell_execute_cmd(shell_backend_uart_get_ptr(),
"typec 1 dock"), NULL);
+ CHECK_PROXY_FAKE_CALL_CNT_MUX_STATE(proxy_set, NUM_OF_PROXY, exp_mode);
}
/** Setup proxy chain and uninit usb muxes */
@@ -717,6 +846,7 @@ void setup_uninit_mux(void)
/* Makes sure that usb muxes of port 1 are not init */
usb_muxes[USBC_PORT_C1].flags = USB_MUX_FLAG_RESETS_IN_G3;
hook_notify(HOOK_CHIPSET_HARD_OFF);
+ reset_proxy_fakes();
}
/** Setup proxy chain and init usb muxes */
@@ -726,40 +856,40 @@ void setup_init_mux(void)
set_test_runner_tid();
/* Makes sure that usb muxes of port 1 are init */
- setup_ztest_proxy_init(0, 2, EC_SUCCESS);
usb_mux_init(USBC_PORT_C1);
+ reset_proxy_fakes();
}
void test_suite_usb_mux(void)
{
ztest_test_suite(usb_mux,
ztest_unit_test_setup_teardown(test_usb_mux_init,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(test_usb_mux_set,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_reset_in_g3,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(test_usb_mux_get,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_low_power_mode,
- setup_init_mux, resotre_usb_mux_chain),
+ setup_init_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(test_usb_mux_flip,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(test_usb_mux_hpd_update,
- setup_uninit_mux, resotre_usb_mux_chain),
+ setup_uninit_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_fw_update_port_info,
- setup_init_mux, resotre_usb_mux_chain),
+ setup_init_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_chipset_reset,
- setup_init_mux, resotre_usb_mux_chain),
+ setup_init_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_hc_mux_info,
- setup_init_mux, resotre_usb_mux_chain),
+ setup_init_mux, restore_usb_mux_chain),
ztest_unit_test_setup_teardown(
test_usb_mux_typec_command,
- setup_init_mux, resotre_usb_mux_chain));
+ setup_init_mux, restore_usb_mux_chain));
ztest_run_test_suite(usb_mux);
}