diff options
author | Diana Z <dzigterman@chromium.org> | 2022-10-12 15:57:08 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-17 22:00:21 +0000 |
commit | 138377a2b74cbb6fcee7d63fc28c171232bc2125 (patch) | |
tree | de78d37fe4a92371e8886f8b9e6e13a87c9effad | |
parent | c081674ce5637d709ad6e8f77c060bab94ec992e (diff) | |
download | chrome-ec-138377a2b74cbb6fcee7d63fc28c171232bc2125.tar.gz |
Zephyr test: Add test for AP-driven VDMs
Add a starter test for this feature. Note that the feature only
currently reports its feature flag to the AP, so start the test out by
verifying this flag is set.
BRANCH=None
BUG=b:208884535
TEST=./twister -T ./zephyr/test
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Iec6a6e3559fdd042d38bb3f80fae32e43321c60f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3953482
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r-- | zephyr/test/drivers/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zephyr/test/drivers/Kconfig | 3 | ||||
-rw-r--r-- | zephyr/test/drivers/ap_vdm_control/CMakeLists.txt | 15 | ||||
-rw-r--r-- | zephyr/test/drivers/ap_vdm_control/prj.conf | 7 | ||||
-rw-r--r-- | zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c | 30 | ||||
-rw-r--r-- | zephyr/test/drivers/testcase.yaml | 4 |
6 files changed, 60 insertions, 0 deletions
diff --git a/zephyr/test/drivers/CMakeLists.txt b/zephyr/test/drivers/CMakeLists.txt index 3610a9a9f2..47d029bb79 100644 --- a/zephyr/test/drivers/CMakeLists.txt +++ b/zephyr/test/drivers/CMakeLists.txt @@ -15,6 +15,7 @@ get_target_property(TEST_SOURCES app SOURCES) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_DEFAULT default) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_ANX7447 anx7447) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_AP_MUX_CONTROL ap_mux_control) +add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_AP_VDM_CONTROL ap_vdm_control) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_CHARGESPLASH chargesplash) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_ISL923X isl923x) add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_I2C_CONTROLLER i2c_controller) diff --git a/zephyr/test/drivers/Kconfig b/zephyr/test/drivers/Kconfig index 26cc540e3c..09ef3e9ebf 100644 --- a/zephyr/test/drivers/Kconfig +++ b/zephyr/test/drivers/Kconfig @@ -14,6 +14,9 @@ config LINK_TEST_SUITE_ANX7447 config LINK_TEST_SUITE_AP_MUX_CONTROL bool "Link and test the ap_mux_control tests" +config LINK_TEST_SUITE_AP_VDM_CONTROL + bool "Link and test the ap_vdm_control tests" + config LINK_TEST_SUITE_CHARGESPLASH bool "Link and test the chargesplash tests" diff --git a/zephyr/test/drivers/ap_vdm_control/CMakeLists.txt b/zephyr/test/drivers/ap_vdm_control/CMakeLists.txt new file mode 100644 index 0000000000..fb762dbe3f --- /dev/null +++ b/zephyr/test/drivers/ap_vdm_control/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Create library name based on current directory +zephyr_library_get_current_dir_lib_name(${ZEPHYR_BASE} lib_name) + +# Create interface library +zephyr_interface_library_named(${lib_name}) + +# Add source files +zephyr_library_sources("${CMAKE_CURRENT_SOURCE_DIR}/src/ap_vdm_control.c") + +# Link in the library +zephyr_library_link_libraries(${lib_name}) diff --git a/zephyr/test/drivers/ap_vdm_control/prj.conf b/zephyr/test/drivers/ap_vdm_control/prj.conf new file mode 100644 index 0000000000..685fa4c15d --- /dev/null +++ b/zephyr/test/drivers/ap_vdm_control/prj.conf @@ -0,0 +1,7 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +CONFIG_PLATFORM_EC_USB_MUX_AP_CONTROL=y +CONFIG_PLATFORM_EC_USB_MUX_TASK=y +CONFIG_PLATFORM_EC_USB_PD_VDM_AP_CONTROL=y diff --git a/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c b/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c new file mode 100644 index 0000000000..7c526f0ccb --- /dev/null +++ b/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c @@ -0,0 +1,30 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <zephyr/ztest.h> + +#include "ec_commands.h" +#include "usb_mux.h" +#include "test/drivers/stubs.h" +#include "test/drivers/test_state.h" +#include "test/drivers/utils.h" + +static void ap_vdm_control_before(void *data) +{ + /* Set chipset on so the "AP" is on to give us commands */ + test_set_chipset_to_s0(); +} + +ZTEST_SUITE(ap_vdm_control, drivers_predicate_post_main, NULL, + ap_vdm_control_before, NULL, NULL); + +ZTEST(ap_vdm_control, test_feature_present) +{ + struct ec_response_get_features feat = host_cmd_get_features(); + + zassert_true(feat.flags[1] & + EC_FEATURE_MASK_1(EC_FEATURE_TYPEC_AP_VDM_SEND), + "Failed to see feature present"); +} diff --git a/zephyr/test/drivers/testcase.yaml b/zephyr/test/drivers/testcase.yaml index 164eeedf3a..46e52941ee 100644 --- a/zephyr/test/drivers/testcase.yaml +++ b/zephyr/test/drivers/testcase.yaml @@ -37,6 +37,10 @@ tests: extra_args: CONF_FILE="prj.conf;ap_mux_control/prj.conf" extra_configs: - CONFIG_LINK_TEST_SUITE_AP_MUX_CONTROL=y + drivers.ap_vdm_control: + extra_args: CONF_FILE="prj.conf;ap_vdm_control/prj.conf" + extra_configs: + - CONFIG_LINK_TEST_SUITE_AP_VDM_CONTROL=y drivers.chargesplash: timeout: 240 extra_configs: |