diff options
-rw-r--r-- | board/host/board.h | 2 | ||||
-rw-r--r-- | test/build.mk | 2 | ||||
-rw-r--r-- | test/chipset.c | 32 | ||||
-rw-r--r-- | test/chipset.tasklist | 10 |
4 files changed, 46 insertions, 0 deletions
diff --git a/board/host/board.h b/board/host/board.h index 97d9789f9a..fc7f9ea6af 100644 --- a/board/host/board.h +++ b/board/host/board.h @@ -30,6 +30,8 @@ #define CONFIG_USB_PD_CUSTOM_PDO #define CONFIG_USB_PD_DUAL_ROLE +#define CONFIG_CMD_AP_RESET_LOG + #include "gpio_signal.h" enum temp_sensor_id { diff --git a/test/build.mk b/test/build.mk index 10e8f720f1..1a29f8111c 100644 --- a/test/build.mk +++ b/test/build.mk @@ -33,6 +33,7 @@ test-list-host += cec test-list-host += charge_manager test-list-host += charge_manager_drp_charging test-list-host += charge_ramp +test-list-host += chipset test-list-host += compile_time_macros test-list-host += console_edit test-list-host += crc @@ -170,6 +171,7 @@ cec-y=cec.o charge_manager-y=charge_manager.o fake_usbc.o charge_manager_drp_charging-y=charge_manager.o fake_usbc.o charge_ramp-y+=charge_ramp.o +chipset-y+=chipset.o compile_time_macros-y=compile_time_macros.o console_edit-y=console_edit.o cortexm_fpu-y=cortexm_fpu.o diff --git a/test/chipset.c b/test/chipset.c new file mode 100644 index 0000000000..caad08b52e --- /dev/null +++ b/test/chipset.c @@ -0,0 +1,32 @@ +/* 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. + * + * Test chipset + */ + +#define CONFIG_CMD_AP_RESET_LOG + +#include "chipset.h" +#include "test_util.h" + +static int test_get_shutdown_reason(void) +{ + enum chipset_shutdown_reason reason = chipset_get_shutdown_reason(); + + TEST_ASSERT(reason == 0); + report_ap_reset(CHIPSET_SHUTDOWN_POWERFAIL); + reason = chipset_get_shutdown_reason(); + TEST_ASSERT(reason == CHIPSET_SHUTDOWN_POWERFAIL); + + return EC_SUCCESS; +} + +void run_test(int argc, char **argv) +{ + test_reset(); + + RUN_TEST(test_get_shutdown_reason); + + test_print_result(); +} diff --git a/test/chipset.tasklist b/test/chipset.tasklist new file mode 100644 index 0000000000..ea773a46ce --- /dev/null +++ b/test/chipset.tasklist @@ -0,0 +1,10 @@ +/* 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. + */ + +/** + * See CONFIG_TASK_LIST in config.h for details. + */ +#define CONFIG_TEST_TASK_LIST \ + TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) |