diff options
Diffstat (limited to 'zephyr/test')
-rw-r--r-- | zephyr/test/skyrim/testcase.yaml | 2 | ||||
-rw-r--r-- | zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c | 37 |
3 files changed, 39 insertions, 1 deletions
diff --git a/zephyr/test/skyrim/testcase.yaml b/zephyr/test/skyrim/testcase.yaml index 43ea40da6f..2084a37bba 100644 --- a/zephyr/test/skyrim/testcase.yaml +++ b/zephyr/test/skyrim/testcase.yaml @@ -34,7 +34,7 @@ tests: skyrim.crystaldrift.ppc_config: extra_configs: - CONFIG_TEST_BOARD_CRYSTALDRIFT=y - - CONFIG_TEST_BOARD_PPC_CONFIG=y + - CONFIG_TEST_BOARD_PPC_CONFIG_CUSTOM=y # Frostflow tests skyrim.frostflow: diff --git a/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt b/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt index e78711fed2..cec3317f7f 100644 --- a/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt +++ b/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt @@ -3,3 +3,4 @@ # found in the LICENSE file. target_sources(app PRIVATE src/common.c) +target_sources_ifdef(CONFIG_TEST_BOARD_PPC_CONFIG app PRIVATE src/ppc_config.c) diff --git a/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c new file mode 100644 index 0000000000..0f319d8ea4 --- /dev/null +++ b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c @@ -0,0 +1,37 @@ +/* Copyright 2023 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/fff.h> +#include <zephyr/ztest.h> + +#include <gpio.h> +#include <usbc_ppc.h> + +FAKE_VOID_FUNC(nx20p348x_interrupt, int); + +static void ppc_config_before(void *fixture) +{ + ARG_UNUSED(fixture); + RESET_FAKE(nx20p348x_interrupt); +} + +void ppc_interrupt(enum gpio_signal signal); + +ZTEST_SUITE(ppc_config, NULL, NULL, ppc_config_before, NULL, NULL); + +ZTEST(ppc_config, test_ppc_interrupt_c0) +{ + ppc_interrupt(GPIO_USB_C0_PPC_INT_ODL); + zassert_equal(nx20p348x_interrupt_fake.call_count, 1); + /* port */ + zassert_equal(nx20p348x_interrupt_fake.arg0_val, 0); +} + +ZTEST(ppc_config, test_ppc_interrupt_c1) +{ + ppc_interrupt(GPIO_USB_C1_PPC_INT_ODL); + zassert_equal(nx20p348x_interrupt_fake.call_count, 1); + /* port */ + zassert_equal(nx20p348x_interrupt_fake.arg0_val, 1); +} |