summaryrefslogtreecommitdiff
path: root/zephyr/test
diff options
context:
space:
mode:
authorMadhurima Paruchuri <mparuchuri@google.com>2023-04-12 13:38:31 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-03 16:19:23 +0000
commit7180ad11308cdff7c00d0150d4553414712f2dbc (patch)
tree20d4c585c116ada59c2390f21807feefe772ab3c /zephyr/test
parent0c34277ea06bcb7137d1a959c277c2d0fcd928ea (diff)
downloadchrome-ec-7180ad11308cdff7c00d0150d4553414712f2dbc.tar.gz
rex: Enable TCPC reset and PPC interrupt based on USB DB type
BUG=b:277862759,b:267589042 TEST=./twister -T zephyr/test/rex -c Low-Coverage-Reason: Tracked in bug b:273928607 Change-Id: Ie002ea5796c45ba33e6915486c42929ba17a9dff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4415130 Commit-Queue: Madhu 🌱 <mparuchuri@google.com> Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Madhu 🌱 <mparuchuri@google.com>
Diffstat (limited to 'zephyr/test')
-rw-r--r--zephyr/test/rex/CMakeLists.txt1
-rw-r--r--zephyr/test/rex/src/usb_mux_config.c13
2 files changed, 10 insertions, 4 deletions
diff --git a/zephyr/test/rex/CMakeLists.txt b/zephyr/test/rex/CMakeLists.txt
index b9e1b1410a..e6cb418c79 100644
--- a/zephyr/test/rex/CMakeLists.txt
+++ b/zephyr/test/rex/CMakeLists.txt
@@ -7,6 +7,7 @@ find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
project(rex)
zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/rex/include")
+zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/rex/rex/include")
add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
diff --git a/zephyr/test/rex/src/usb_mux_config.c b/zephyr/test/rex/src/usb_mux_config.c
index 6e85fffe4b..76d6efe664 100644
--- a/zephyr/test/rex/src/usb_mux_config.c
+++ b/zephyr/test/rex/src/usb_mux_config.c
@@ -6,6 +6,7 @@
#include "cros_cbi.h"
#include "hooks.h"
#include "usb_mux.h"
+#include "usb_mux_config.h"
#include "usbc/usb_muxes.h"
#include <zephyr/devicetree.h>
@@ -49,16 +50,17 @@ static void usb_mux_config_before(void *fixture)
RESET_FAKE(cros_cbi_get_fw_config);
}
-ZTEST_USER(usb_mux_config, test_setup_mux)
+ZTEST_USER(usb_mux_config, test_setup_usb_db)
{
cros_cbi_get_fw_config_fake.custom_fake = mock_cros_cbi_get_fw_config;
hook_notify(HOOK_INIT);
zassert_equal(1, cros_cbi_get_fw_config_fake.call_count);
+ zassert_equal(1, usb_db_type);
}
-ZTEST_USER(usb_mux_config, test_setup_mux_anx7452)
+ZTEST_USER(usb_mux_config, test_setup_usb_db_anx7452)
{
cros_cbi_get_fw_config_fake.custom_fake =
mock_cros_cbi_get_fw_config_anx7452;
@@ -66,9 +68,10 @@ ZTEST_USER(usb_mux_config, test_setup_mux_anx7452)
hook_notify(HOOK_INIT);
zassert_equal(1, cros_cbi_get_fw_config_fake.call_count);
+ zassert_equal(3, usb_db_type);
}
-ZTEST_USER(usb_mux_config, test_setup_mux_no_usb_db)
+ZTEST_USER(usb_mux_config, test_setup_usb_db_no_usb_db)
{
cros_cbi_get_fw_config_fake.custom_fake =
mock_cros_cbi_get_fw_config_no_usb_db;
@@ -76,9 +79,10 @@ ZTEST_USER(usb_mux_config, test_setup_mux_no_usb_db)
hook_notify(HOOK_INIT);
zassert_equal(1, cros_cbi_get_fw_config_fake.call_count);
+ zassert_equal(0, usb_db_type);
}
-ZTEST_USER(usb_mux_config, test_setup_mux_error_reading_cbi)
+ZTEST_USER(usb_mux_config, test_setup_usb_db_error_reading_cbi)
{
cros_cbi_get_fw_config_fake.custom_fake =
mock_cros_cbi_get_fw_config_error;
@@ -86,6 +90,7 @@ ZTEST_USER(usb_mux_config, test_setup_mux_error_reading_cbi)
hook_notify(HOOK_INIT);
zassert_equal(1, cros_cbi_get_fw_config_fake.call_count);
+ zassert_equal(-1, usb_db_type);
}
ZTEST_SUITE(usb_mux_config, NULL, NULL, usb_mux_config_before, NULL, NULL);