diff options
author | Jeremy Bettis <jbettis@google.com> | 2022-10-06 15:33:56 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-31 19:42:45 +0000 |
commit | 0ee5a8129d31a25e83803200b36988a3cda2f99a (patch) | |
tree | 9cae43951981cd41fef2cba249b76599d8c83663 /zephyr/test/drivers | |
parent | 68aaceab6d42796457f2f89f113e30dcd9ae64b4 (diff) | |
download | chrome-ec-0ee5a8129d31a25e83803200b36988a3cda2f99a.tar.gz |
ec: Remove all zassume usages
Since zassume is being used in scenarios where no one would use
ztest_test_skip(), convert all zassumes to zasserts.
BRANCH=None
BUG=b:256650891
TEST=./twister
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: I1dc806e25f64f8dbef6f7d10cfe2f46ea4887e61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3937539
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Aaron Massey <aaronmassey@google.com>
Diffstat (limited to 'zephyr/test/drivers')
44 files changed, 180 insertions, 194 deletions
diff --git a/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c b/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c index d059870f25..632b8e6aea 100644 --- a/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c +++ b/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c @@ -23,7 +23,7 @@ static void ap_mux_control_before(void *data) k_sleep(K_SECONDS(1)); /* And test the assumption that setting NONE worked */ - zassume_equal(usb_mux_get(USBC_PORT_C0), USB_PD_MUX_NONE, + zassert_equal(usb_mux_get(USBC_PORT_C0), USB_PD_MUX_NONE, "Failed to set mux to initial state"); } diff --git a/zephyr/test/drivers/chargesplash/src/chargesplash.c b/zephyr/test/drivers/chargesplash/src/chargesplash.c index 9e5bf17019..08ba5377a0 100644 --- a/zephyr/test/drivers/chargesplash/src/chargesplash.c +++ b/zephyr/test/drivers/chargesplash/src/chargesplash.c @@ -85,7 +85,7 @@ static void set_lid(bool open, bool inhibit_boot) "inhibit_boot should not be used with a lid close"); } - zassume_ok(gpio_emul_input_set(lid_switch_dev, GPIO_LID_OPEN_EC_PORT, + zassert_ok(gpio_emul_input_set(lid_switch_dev, GPIO_LID_OPEN_EC_PORT, open), "Failed to set lid switch GPIO"); @@ -123,7 +123,7 @@ static void reset_state(void *unused) set_ac_enabled(false); } - zassume_ok(shell_execute_cmd(get_ec_shell(), "chargesplash reset"), + zassert_ok(shell_execute_cmd(get_ec_shell(), "chargesplash reset"), "'chargesplash reset' shell command failed"); } diff --git a/zephyr/test/drivers/common/include/test/drivers/utils.h b/zephyr/test/drivers/common/include/test/drivers/utils.h index af4469bc13..1a6799bd0d 100644 --- a/zephyr/test/drivers/common/include/test/drivers/utils.h +++ b/zephyr/test/drivers/common/include/test/drivers/utils.h @@ -71,21 +71,11 @@ void test_set_chipset_to_power_level(enum power_state new_state); /** @brief Set chipset to G3 state. Call all necessary hooks. */ void test_set_chipset_to_g3(void); -/* - * TODO(b/217755888): Implement ztest assume API upstream - */ - -/** - * @brief Assume that this function call won't be reached - * @param msg Optional message to print if the assumption fails - */ -#define zassume_unreachable(msg, ...) zassert_unreachable(msg, ##__VA_ARGS__) - /** * Run an ACPI read to the specified address. * * This function assumes a successful ACPI read process and will make a - * call to the zassume_* API. A failure here will skip the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param acpi_addr Address to query * @return Byte read @@ -96,7 +86,7 @@ uint8_t acpi_read(uint8_t acpi_addr); * Run an ACPI write to the specified address. * * This function assumes a successful ACPI write process and will make a - * call to the zassume_* API. A failure here will skip the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param acpi_addr Address to write * @param write_byte Byte to write to address @@ -107,7 +97,7 @@ void acpi_write(uint8_t acpi_addr, uint8_t write_byte); * Run the host command to gather our EC feature flags. * * This function assumes a successful host command processing and will make a - * call to the zassume_* API. A failure here will abort the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @return The result of the host command */ @@ -117,7 +107,7 @@ static inline struct ec_response_get_features host_cmd_get_features(void) struct host_cmd_handler_args args = BUILD_HOST_COMMAND_RESPONSE(EC_CMD_GET_FEATURES, 0, response); - zassume_ok(host_command_process(&args), "Failed to get features"); + zassert_ok(host_command_process(&args), "Failed to get features"); return response; } @@ -125,7 +115,7 @@ static inline struct ec_response_get_features host_cmd_get_features(void) * Run the host command to get the charge state for a given charger number. * * This function assumes a successful host command processing and will make a - * call to the zassume_* API. A failure here will abort the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param chgnum The charger number to query. * @return The result of the query. @@ -140,7 +130,7 @@ static inline struct ec_response_charge_state host_cmd_charge_state(int chgnum) struct host_cmd_handler_args args = BUILD_HOST_COMMAND(EC_CMD_CHARGE_STATE, 0, response, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to get charge state for chgnum %d", chgnum); return response; } @@ -149,7 +139,7 @@ static inline struct ec_response_charge_state host_cmd_charge_state(int chgnum) * Run the host command to get the USB PD power info for a given port. * * This function assumes a successful host command processing and will make a - * call to the zassume_* API. A failure here will abort the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param port The USB port to get info from. * @return The result of the query. @@ -161,7 +151,7 @@ static inline struct ec_response_usb_pd_power_info host_cmd_power_info(int port) struct host_cmd_handler_args args = BUILD_HOST_COMMAND( EC_CMD_USB_PD_POWER_INFO, 0, response, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to get power info for port %d", port); return response; } @@ -170,7 +160,7 @@ static inline struct ec_response_usb_pd_power_info host_cmd_power_info(int port) * Run the host command to get the Type-C status information for a given port. * * This function assumes a successful host command processing and will make a - * call to the zassume_* API. A failure here will abort the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param port The USB port to get info from. * @return The result of the query. @@ -182,7 +172,7 @@ static inline struct ec_response_typec_status host_cmd_typec_status(int port) struct host_cmd_handler_args args = BUILD_HOST_COMMAND(EC_CMD_TYPEC_STATUS, 0, response, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to get Type-C state for port %d", port); return response; } @@ -195,7 +185,7 @@ host_cmd_usb_pd_control(int port, enum usb_pd_control_swap swap) struct host_cmd_handler_args args = BUILD_HOST_COMMAND(EC_CMD_USB_PD_CONTROL, 0, response, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to process usb_pd_control_swap for port %d, swap %d", port, swap); return response; @@ -205,7 +195,7 @@ host_cmd_usb_pd_control(int port, enum usb_pd_control_swap swap) * Run the host command to suspend/resume PD ports * * This function assumes a successful host command processing and will make a - * call to the zassume_* API. A failure here will skip the calling test. + * call to the zassert_* API. A failure here will fail the calling test. * * @param port The USB port to operate on * @param cmd The sub-command to run @@ -216,7 +206,7 @@ static inline void host_cmd_pd_control(int port, enum ec_pd_control_cmd cmd) struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(EC_CMD_PD_CONTROL, 0, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to process pd_control for port %d, cmd %d", port, cmd); } @@ -240,7 +230,7 @@ host_cmd_charge_control(enum ec_charge_control_mode mode, struct host_cmd_handler_args args = BUILD_HOST_COMMAND(EC_CMD_CHARGE_CONTROL, 2, response, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to get charge control values"); return response; @@ -260,7 +250,7 @@ enum ec_status host_cmd_host_event(enum ec_host_event_action action, /** * @brief Call the host command MOTION_SENSE with the dump sub-command * - * Note: this function uses the zassume_ API. It will skip the test if the host + * Note: this function uses the zassert_ API. It will fail the test if the host * command fails. * * @param max_sensor_count The maximum number of sensor data objects to populate @@ -589,7 +579,7 @@ void host_events_restore(struct host_events_ctx *host_events_ctx); * If enabled, the device _should_ begin charging. * * This function assumes a successful gpio emulator call and will make a call - * to the zassume_* API. A failure here will abort the calling test. + * to the zassert_* API. A failure here will fail the calling test. * * This function sleeps to wait for the GPIO interrupt to take place. * @@ -600,10 +590,10 @@ static inline void set_ac_enabled(bool enabled) const struct device *acok_dev = DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_ACOK_OD_NODE, gpios)); - zassume_ok(gpio_emul_input_set(acok_dev, GPIO_ACOK_OD_PIN, enabled), + zassert_ok(gpio_emul_input_set(acok_dev, GPIO_ACOK_OD_PIN, enabled), NULL); k_sleep(K_MSEC(CONFIG_EXTPOWER_DEBOUNCE_MS + 1)); - zassume_equal(enabled, extpower_is_present(), NULL); + zassert_equal(enabled, extpower_is_present(), NULL); } /** diff --git a/zephyr/test/drivers/common/src/utils.c b/zephyr/test/drivers/common/src/utils.c index cc3ad1571d..646db0d27b 100644 --- a/zephyr/test/drivers/common/src/utils.c +++ b/zephyr/test/drivers/common/src/utils.c @@ -31,10 +31,6 @@ #define GPIO_BATT_PRES_ODL_PATH DT_PATH(named_gpios, ec_batt_pres_odl) #define GPIO_BATT_PRES_ODL_PORT DT_GPIO_PIN(GPIO_BATT_PRES_ODL_PATH, gpios) -/* - * TODO(b/251281997): Switch zasserts back to zassumes when they loudly fail - */ - void test_set_battery_level(int percentage) { struct sbat_emul_bat_data *bat; @@ -592,7 +588,7 @@ void host_cmd_typec_control_bist_share_mode(int port, int enable) struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params); - zassume_ok(host_command_process(&args), + zassert_ok(host_command_process(&args), "Failed to send Type-C control for port %d", port); } diff --git a/zephyr/test/drivers/default/src/bb_retimer.c b/zephyr/test/drivers/default/src/bb_retimer.c index 1b1ec4bbbc..5edd0a7cc8 100644 --- a/zephyr/test/drivers/default/src/bb_retimer.c +++ b/zephyr/test/drivers/default/src/bb_retimer.c @@ -66,7 +66,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state) /* Set UFP role for whole test */ tc_set_data_role(USBC_PORT_C1, PD_ROLE_UFP); - zassume_equal(PD_ROLE_UFP, pd_get_data_role(USBC_PORT_C1)); + zassert_equal(PD_ROLE_UFP, pd_get_data_role(USBC_PORT_C1)); /* Test none mode */ bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678); @@ -251,7 +251,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_dfp_state) set_test_runner_tid(); tc_set_data_role(USBC_PORT_C1, PD_ROLE_DFP); - zassume_equal(PD_ROLE_DFP, pd_get_data_role(USBC_PORT_C1)); + zassert_equal(PD_ROLE_DFP, pd_get_data_role(USBC_PORT_C1)); /* Test PD mux none mode with DFP should clear all bits in state */ bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678); diff --git a/zephyr/test/drivers/default/src/bmi160.c b/zephyr/test/drivers/default/src/bmi160.c index 01957672f7..edce38057b 100644 --- a/zephyr/test/drivers/default/src/bmi160.c +++ b/zephyr/test/drivers/default/src/bmi160.c @@ -2139,9 +2139,9 @@ static void bmi160_before(void *fixture) gyr_ms->rot_standard_ref = NULL; acc_ms->rot_standard_ref = NULL; - zassume_equal(EC_SUCCESS, acc_ms->drv->set_data_rate(acc_ms, 50000, 0), + zassert_equal(EC_SUCCESS, acc_ms->drv->set_data_rate(acc_ms, 50000, 0), NULL); - zassume_equal(EC_SUCCESS, gyr_ms->drv->set_data_rate(gyr_ms, 50000, 0), + zassert_equal(EC_SUCCESS, gyr_ms->drv->set_data_rate(gyr_ms, 50000, 0), NULL); } diff --git a/zephyr/test/drivers/default/src/console_cmd/charge_manager.c b/zephyr/test/drivers/default/src/console_cmd/charge_manager.c index a4679ddd25..12b2b174f4 100644 --- a/zephyr/test/drivers/default/src/console_cmd/charge_manager.c +++ b/zephyr/test/drivers/default/src/console_cmd/charge_manager.c @@ -111,7 +111,7 @@ ZTEST_USER(console_cmd_charge_manager, test_chgoverride_invalid_port) { char cmd[256]; - zassume_true(sprintf(cmd, "chgoverride %d", CHARGE_PORT_COUNT) > 0, + zassert_true(sprintf(cmd, "chgoverride %d", CHARGE_PORT_COUNT) > 0, NULL); zassert_equal(shell_execute_cmd(get_ec_shell(), cmd), EC_ERROR_PARAM1, NULL); diff --git a/zephyr/test/drivers/default/src/console_cmd/charge_state.c b/zephyr/test/drivers/default/src/console_cmd/charge_state.c index 7ee91049ae..5eb21f9ff8 100644 --- a/zephyr/test/drivers/default/src/console_cmd/charge_state.c +++ b/zephyr/test/drivers/default/src/console_cmd/charge_state.c @@ -116,7 +116,7 @@ ZTEST_USER(console_cmd_charge_state, test_debug_on_show_charging_progress) charging_progress_displayed(); /* Enable debug printing */ - zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate debug on"), + zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate debug on"), NULL); /* Sleep at least 1 full iteration of the charge state loop */ @@ -206,7 +206,7 @@ ZTEST_USER_F(console_cmd_charge_state, test_idle_on_from_normal) fixture->tcpci_emul, fixture->charger_emul); /* Verify that we're in "normal" mode */ - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); /* Move to idle */ zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on")); @@ -220,11 +220,11 @@ ZTEST_USER_F(console_cmd_charge_state, test_normal_from_idle) fixture->tcpci_emul, fixture->charger_emul); /* Verify that we're in "normal" mode */ - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); /* Move to idle */ - zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on")); - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_IDLE); + zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on")); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_IDLE); /* Move back to normal */ zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle off"), @@ -239,7 +239,7 @@ ZTEST_USER_F(console_cmd_charge_state, test_discharge_on) fixture->tcpci_emul, fixture->charger_emul); /* Verify that we're in "normal" mode */ - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); /* Enable discharge */ zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"), @@ -254,12 +254,12 @@ ZTEST_USER_F(console_cmd_charge_state, test_discharge_off) fixture->tcpci_emul, fixture->charger_emul); /* Verify that we're in "normal" mode */ - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL); /* Enable discharge */ - zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"), + zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"), NULL); - zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_DISCHARGE); + zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_DISCHARGE); /* Disable discharge */ zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge off"), diff --git a/zephyr/test/drivers/default/src/console_cmd/charger.c b/zephyr/test/drivers/default/src/console_cmd/charger.c index 9adda29a8d..63cc0a3118 100644 --- a/zephyr/test/drivers/default/src/console_cmd/charger.c +++ b/zephyr/test/drivers/default/src/console_cmd/charger.c @@ -81,7 +81,7 @@ ZTEST_USER(console_cmd_charger, test_good_input_current) zassert_ok(shell_execute_cmd(get_ec_shell(), "charger input 1000"), "Failed to set input current"); - zassume_ok(charger_get_input_current_limit(0, &input_current), + zassert_ok(charger_get_input_current_limit(0, &input_current), "Failed to get input current"); zassert_equal(input_current, 1000, "Input current not set in charger: %d", input_current); @@ -117,7 +117,7 @@ static void *console_cmd_charger_setup(void) static struct console_cmd_charger_fixture fixture; /* Assume we have one charger at index 0 */ - zassume_true(board_get_charger_chip_count() > 0, + zassert_true(board_get_charger_chip_count() > 0, "Insufficient chargers found"); /* Get references for the emulators */ @@ -158,7 +158,7 @@ ZTEST_USER_F(console_cmd_charger, test_good_current) /* Give the charger task time to pick up the manual current */ k_sleep(K_SECONDS(1)); - zassume_ok(charger_get_current(0, ¤t), "Failed to get current"); + zassert_ok(charger_get_current(0, ¤t), "Failed to get current"); zassert_equal(current, 1000, "Current not set in charger: %d", current); } @@ -176,7 +176,7 @@ ZTEST_USER_F(console_cmd_charger, test_good_voltage) /* Give the charger task time to pick up the manual voltage */ k_sleep(K_SECONDS(1)); - zassume_ok(charger_get_voltage(0, &voltage), "Failed to get voltage"); + zassert_ok(charger_get_voltage(0, &voltage), "Failed to get voltage"); zassert_equal(voltage, 3000, "Voltage not set in charger: %d", voltage); } diff --git a/zephyr/test/drivers/default/src/console_cmd/cutoff.c b/zephyr/test/drivers/default/src/console_cmd/cutoff.c index 00ce40660f..e17f8745bd 100644 --- a/zephyr/test/drivers/default/src/console_cmd/cutoff.c +++ b/zephyr/test/drivers/default/src/console_cmd/cutoff.c @@ -58,7 +58,7 @@ ZTEST_USER(console_cmd_cutoff, test_clear_pending_shutdown) { int rv = shell_execute_cmd(get_ec_shell(), "cutoff at-shutdown"); - zassume_true(extpower_is_present(), NULL); + zassert_true(extpower_is_present(), NULL); zassert_equal(EC_RES_SUCCESS, rv, "Expected %d, but got %d", EC_RES_SUCCESS, rv); diff --git a/zephyr/test/drivers/default/src/console_cmd/hostevent.c b/zephyr/test/drivers/default/src/console_cmd/hostevent.c index af9b37edd1..acb8b890e4 100644 --- a/zephyr/test/drivers/default/src/console_cmd/hostevent.c +++ b/zephyr/test/drivers/default/src/console_cmd/hostevent.c @@ -52,7 +52,7 @@ static int console_cmd_hostevent(const char *subcommand, host_event_t mask) "hostevent %s 0x%" HOSTEVENT_PRINT_FORMAT, subcommand, mask); - zassume_between_inclusive(rv, 0, CONFIG_SHELL_CMD_BUFF_SIZE, + zassert_between_inclusive(rv, 0, CONFIG_SHELL_CMD_BUFF_SIZE, "hostevent console command too long"); return shell_execute_cmd(get_ec_shell(), cmd_buf); diff --git a/zephyr/test/drivers/default/src/console_cmd/md.c b/zephyr/test/drivers/default/src/console_cmd/md.c index c8c3e2c130..138dbccf98 100644 --- a/zephyr/test/drivers/default/src/console_cmd/md.c +++ b/zephyr/test/drivers/default/src/console_cmd/md.c @@ -36,7 +36,7 @@ ZTEST_USER(console_cmd_md, test_default_count) uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "md %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "md %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); } @@ -46,7 +46,7 @@ ZTEST_USER(console_cmd_md, test_count_arg) uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "md %" PRIuPTR " 2", (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "md %" PRIuPTR " 2", (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); } @@ -56,7 +56,7 @@ ZTEST_USER(console_cmd_md, test_byte_format) uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "md .b %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "md .b %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); } @@ -66,7 +66,7 @@ ZTEST_USER(console_cmd_md, test_half_format) uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "md .h %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "md .h %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); } @@ -76,7 +76,7 @@ ZTEST_USER(console_cmd_md, test_string_format) char memory[] = "hello world"; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "md .s %" PRIuPTR " 12", (uintptr_t)memory) != + zassert_true(sprintf(cmd, "md .s %" PRIuPTR " 12", (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); diff --git a/zephyr/test/drivers/default/src/console_cmd/rw.c b/zephyr/test/drivers/default/src/console_cmd/rw.c index aac37680f5..a25bf5f07c 100644 --- a/zephyr/test/drivers/default/src/console_cmd/rw.c +++ b/zephyr/test/drivers/default/src/console_cmd/rw.c @@ -43,15 +43,15 @@ ZTEST_USER(console_cmd_rw, test_read) uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "rw .b %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "rw .b %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); - zassume_true(sprintf(cmd, "rw .h %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "rw .h %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); - zassume_true(sprintf(cmd, "rw %" PRIuPTR, (uintptr_t)memory) != 0, + zassert_true(sprintf(cmd, "rw %" PRIuPTR, (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); } @@ -71,7 +71,7 @@ ZTEST_USER(console_cmd_rw, test_write) uint8_t memory[4] = { 0 }; char cmd[128] = { 0 }; - zassume_true(sprintf(cmd, "rw .b %" PRIuPTR " 1", (uintptr_t)memory) != + zassert_true(sprintf(cmd, "rw .b %" PRIuPTR " 1", (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); @@ -81,7 +81,7 @@ ZTEST_USER(console_cmd_rw, test_write) zassert_equal(0, memory[3], "memory[3] was %u", memory[3]); memset(memory, 0, 4); - zassume_true(sprintf(cmd, "rw .h %" PRIuPTR " 258", + zassert_true(sprintf(cmd, "rw .h %" PRIuPTR " 258", (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); @@ -91,7 +91,7 @@ ZTEST_USER(console_cmd_rw, test_write) zassert_equal(0, memory[3], "memory[3] was %u", memory[3]); memset(memory, 0, 4); - zassume_true(sprintf(cmd, "rw %" PRIuPTR " 16909060", + zassert_true(sprintf(cmd, "rw %" PRIuPTR " 16909060", (uintptr_t)memory) != 0, NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL); diff --git a/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c b/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c index 9652519cab..88379a78bd 100644 --- a/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c +++ b/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c @@ -38,7 +38,7 @@ static void console_cmd_tcpci_dump_begin(void *data) ARG_UNUSED(data); /* Assume we have at least one TCPC */ - zassume_true(board_get_charger_chip_count() > 0, + zassert_true(board_get_charger_chip_count() > 0, "Insufficient TCPCs found"); } diff --git a/zephyr/test/drivers/default/src/espi.c b/zephyr/test/drivers/default/src/espi.c index ac6c93f3fc..413d42b4c1 100644 --- a/zephyr/test/drivers/default/src/espi.c +++ b/zephyr/test/drivers/default/src/espi.c @@ -214,7 +214,7 @@ ZTEST_USER(espi, test_host_command_gpio_set) BUILD_HOST_COMMAND_PARAMS(EC_CMD_GPIO_SET, 0, p); /* Force value to 1 to see change */ - zassume_ok(gpio_pin_set_dt(gp, 1), NULL); + zassert_ok(gpio_pin_set_dt(gp, 1), NULL); zassert_ok(host_command_process(&args), NULL); zassert_equal(gpio_pin_get_dt(gp), p.val, NULL); diff --git a/zephyr/test/drivers/default/src/flash.c b/zephyr/test/drivers/default/src/flash.c index 6794ca2878..8f8208415e 100644 --- a/zephyr/test/drivers/default/src/flash.c +++ b/zephyr/test/drivers/default/src/flash.c @@ -414,7 +414,7 @@ static void setup_flash_region_helper(uint32_t offset, uint32_t size, int rv; rv = host_command_process(&erase_args); - zassume_ok(rv, "Got %d", rv); + zassert_ok(rv, "Got %d", rv); if (make_write) { /* Sized for flash_write header plus one byte of data */ @@ -434,7 +434,7 @@ static void setup_flash_region_helper(uint32_t offset, uint32_t size, /* Write one byte at start of region */ out_buf[sizeof(*write_params)] = 0xec; - zassume_ok(host_command_process(&write_args), NULL); + zassert_ok(host_command_process(&write_args), NULL); } } diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c b/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c index 07b1b5143e..d5c975894e 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c @@ -26,7 +26,7 @@ static inline void connect_charger_to_port(struct usb_attach_20v_3a_pd_charger_fixture *fixture) { set_ac_enabled(true); - zassume_ok(tcpci_partner_connect_to_tcpci(&fixture->charger_20v, + zassert_ok(tcpci_partner_connect_to_tcpci(&fixture->charger_20v, fixture->tcpci_emul), NULL); @@ -43,7 +43,7 @@ static inline void disconnect_charger_from_port( struct usb_attach_20v_3a_pd_charger_fixture *fixture) { set_ac_enabled(false); - zassume_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul)); + zassert_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul)); isl923x_emul_set_adc_vbus(fixture->charger_emul, 0); k_sleep(K_SECONDS(1)); } @@ -88,7 +88,7 @@ ZTEST(usb_attach_20v_3a_pd_charger, test_battery_is_charging) const struct emul *emul = EMUL_DT_GET(BATTERY_NODE); uint16_t battery_status; - zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, + zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, &battery_status), NULL); zassert_equal(battery_status & STATUS_DISCHARGING, 0, diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c index e3584470a0..c29762063c 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c @@ -85,7 +85,7 @@ ZTEST(usb_attach_5v_3a_pd_sink, test_battery_is_discharging) const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(battery)); uint16_t battery_status; - zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, + zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, &battery_status)); zassert_equal(battery_status & STATUS_DISCHARGING, STATUS_DISCHARGING, "Battery is not discharging: %d", battery_status); diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c index c73cf26f37..a780277d05 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c @@ -70,7 +70,7 @@ static void control_battery_present(bool present) DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_BATT_PRES_ODL_PATH, gpios)); /* 0 means battery present */ - zassume_ok(gpio_emul_input_set(dev, GPIO_BATT_PRES_ODL_PORT, !present)); + zassert_ok(gpio_emul_input_set(dev, GPIO_BATT_PRES_ODL_PORT, !present)); } ZTEST_SUITE(usb_attach_5v_3a_pd_source, drivers_predicate_post_main, @@ -82,7 +82,7 @@ ZTEST(usb_attach_5v_3a_pd_source, test_battery_is_charging) const struct emul *emul = EMUL_DT_GET(BATTERY_NODE); uint16_t battery_status; - zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, + zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS, &battery_status)); zassert_equal(battery_status & STATUS_DISCHARGING, 0, "Battery is discharging: %d", battery_status); diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c b/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c index 0b65f9b135..bcc94fe869 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c @@ -117,21 +117,21 @@ static void attach_src_snk_common_before(struct emul_state *my_emul_state) /* TODO(b/217737667): Remove driver specific code. */ isl923x_emul_set_adc_vbus(charger_emul, 0); - zassume_ok(tcpc_config[SNK_PORT].drv->init(SNK_PORT)); + zassert_ok(tcpc_config[SNK_PORT].drv->init(SNK_PORT)); /* * Arbitrary FW ver. The emulator should really be setting this * during its init. */ tcpci_emul_set_reg(tcpci_emul_snk, PS8XXX_REG_FW_REV, 0x31); - zassume_ok(tcpc_config[SRC_PORT].drv->init(SRC_PORT)); + zassert_ok(tcpc_config[SRC_PORT].drv->init(SRC_PORT)); pd_set_suspend(SNK_PORT, false); pd_set_suspend(SRC_PORT, false); /* Reset to disconnected state. */ - zassume_ok(tcpci_emul_disconnect_partner(tcpci_emul_src)); - zassume_ok(tcpci_emul_disconnect_partner(tcpci_emul_snk)); + zassert_ok(tcpci_emul_disconnect_partner(tcpci_emul_src)); + zassert_ok(tcpci_emul_disconnect_partner(tcpci_emul_snk)); /* Set chipset to ON, this will set TCPM to DRP */ test_set_chipset_to_s0(); @@ -177,7 +177,7 @@ static void attach_emulated_snk(struct emul_state *my_emul_state) tcpci_emul_set_reg(tcpci_emul_snk, TCPC_REG_EXT_STATUS, TCPC_REG_EXT_STATUS_SAFE0V); - zassume_ok(tcpci_partner_connect_to_tcpci(my_snk, tcpci_emul_snk), + zassert_ok(tcpci_partner_connect_to_tcpci(my_snk, tcpci_emul_snk), NULL); /* TODO(b/214401892): Check why need to give time TCPM to spin */ @@ -207,7 +207,7 @@ static void attach_emulated_src(struct emul_state *my_emul_state) tcpci_emul_set_reg(tcpci_emul_src, TCPC_REG_EXT_STATUS, TCPC_REG_EXT_STATUS_SAFE0V); - zassume_ok(tcpci_partner_connect_to_tcpci(my_src, tcpci_emul_src), + zassert_ok(tcpci_partner_connect_to_tcpci(my_src, tcpci_emul_src), NULL); isl923x_emul_set_adc_vbus(charger_emul, DEFAULT_VBUS_MV); } @@ -542,7 +542,7 @@ struct usb_detach_test_fixture { static void integration_usb_test_detach(const struct emul *e) { - zassume_ok(tcpci_emul_disconnect_partner(e)); + zassert_ok(tcpci_emul_disconnect_partner(e)); } static void integration_usb_test_sink_detach(struct emul_state *fixture) diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c index 47e26f97d6..56cbee7ad0 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c @@ -99,7 +99,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_mode) /* Start up BIST shared test mode */ bist_data = BDO(BDO_MODE_SHARED_ENTER, 0); - zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, + zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, PD_DATA_BIST, &bist_data, 1, 0), "Failed to send BIST enter message"); @@ -116,7 +116,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_mode) /* Leave BIST shared test mode */ bist_data = BDO(BDO_MODE_SHARED_EXIT, 0); - zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, + zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, PD_DATA_BIST, &bist_data, 1, 0), "Failed to send BIST exit message"); @@ -152,7 +152,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_no_snk_entry) /* Have the source send the BIST Enter Mode */ bist_data = BDO(BDO_MODE_SHARED_ENTER, 0); - zassume_ok(tcpci_partner_send_data_msg(&fixture->src, PD_DATA_BIST, + zassert_ok(tcpci_partner_send_data_msg(&fixture->src, PD_DATA_BIST, &bist_data, 1, 0), "Failed to send BIST enter message"); @@ -181,7 +181,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_exit_no_action) tcpci_snk_emul_clear_last_5v_cap(&fixture->snk_ext_500ma); bist_data = BDO(BDO_MODE_SHARED_EXIT, 0); - zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, + zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma, PD_DATA_BIST, &bist_data, 1, 0), "Failed to send BIST exit message"); @@ -198,7 +198,7 @@ ZTEST_F(usb_pd_bist_shared, verify_control_bist_shared_mode) uint32_t f5v_cap; host_cmd_typec_control_bist_share_mode(USBC_PORT_C0, 1); - zassume_ok(tcpci_partner_send_control_msg(&fixture->sink_5v_500ma, + zassert_ok(tcpci_partner_send_control_msg(&fixture->sink_5v_500ma, PD_CTRL_GET_SOURCE_CAP, 0), "Failed to send get src cap"); /* wait tSenderResponse (26 ms) */ diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c index e35e2a7ec1..87b559dd7c 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c @@ -59,13 +59,13 @@ tcpci_drp_emul_connect_partner(struct tcpci_partner_data *partner_emul, tcpci_tcpc_alert(TEST_USB_PORT); - zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpci_emul), + zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpci_emul), NULL); } static void disconnect_partner(struct usb_pd_ctrl_msg_test_fixture *fixture) { - zassume_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul)); + zassert_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul)); k_sleep(K_SECONDS(1)); } diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c index fdea74a691..2eff9996f2 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c @@ -62,11 +62,11 @@ static void usb_attach_5v_3a_pd_source_before(void *data) /* Clear Alert and Status receive checks */ tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); /* Initial check on power state */ - zassume_true(chipset_in_state(CHIPSET_STATE_ON)); + zassert_true(chipset_in_state(CHIPSET_STATE_ON)); } static void usb_attach_5v_3a_pd_source_after(void *data) @@ -112,8 +112,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, test_batt_cap) /* See pe_give_battery_cap_entry() in common/usbc/usb_pe_drp_sm.c */ - zassume_true(battery_is_present(), "Battery must be present"); - zassume_true(IS_ENABLED(HAS_TASK_HOSTCMD) && + zassert_true(battery_is_present(), "Battery must be present"); + zassert_true(IS_ENABLED(HAS_TASK_HOSTCMD) && *host_get_memmap(EC_MEMMAP_BATTERY_VERSION) != 0, "Cannot access battery data"); @@ -171,7 +171,7 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, test_batt_cap_invalid) ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_msg) { - zassume_equal(pd_broadcast_alert_msg(ADO_OTP_EVENT), EC_SUCCESS); + zassert_equal(pd_broadcast_alert_msg(ADO_OTP_EVENT), EC_SUCCESS); k_sleep(K_SECONDS(2)); zassert_true(fixture->src_ext.alert_received); @@ -186,8 +186,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change) zassert_true(fixture->src_ext.status_received); tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); /* Shutdown and check partner received Alert and Status messages */ hook_notify(HOOK_CHIPSET_SHUTDOWN); @@ -196,8 +196,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change) zassert_true(fixture->src_ext.status_received); tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); /* Startup and check partner received Alert and Status messages */ hook_notify(HOOK_CHIPSET_STARTUP); @@ -206,8 +206,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change) zassert_true(fixture->src_ext.status_received); tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); /* Resume and check partner received Alert and Status messages */ hook_notify(HOOK_CHIPSET_RESUME); @@ -247,9 +247,9 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, /* Clear alert and status flags set during shutdown */ tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); - zassume_true(chipset_in_state(CHIPSET_STATE_ANY_OFF)); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); + zassert_true(chipset_in_state(CHIPSET_STATE_ANY_OFF)); /* While in S5/G3 expect nothing on invalid (too long) press */ ado = ADO_EXTENDED_ALERT_EVENT | ADO_POWER_BUTTON_PRESS; @@ -283,9 +283,9 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_startup_on_pd_button_press) /* Clear alert and status flags set during shutdown */ tcpci_src_emul_clear_alert_received(&fixture->src_ext); tcpci_src_emul_clear_status_received(&fixture->src_ext); - zassume_false(fixture->src_ext.alert_received); - zassume_false(fixture->src_ext.status_received); - zassume_true(chipset_in_state(CHIPSET_STATE_ANY_OFF)); + zassert_false(fixture->src_ext.alert_received); + zassert_false(fixture->src_ext.status_received); + zassert_true(chipset_in_state(CHIPSET_STATE_ANY_OFF)); /* While in S5/G3 expect Alert->Get_Status->Status on valid press */ ado = ADO_EXTENDED_ALERT_EVENT | ADO_POWER_BUTTON_PRESS; diff --git a/zephyr/test/drivers/default/src/lid_switch.c b/zephyr/test/drivers/default/src/lid_switch.c index b5da1f6608..a0920234b3 100644 --- a/zephyr/test/drivers/default/src/lid_switch.c +++ b/zephyr/test/drivers/default/src/lid_switch.c @@ -49,8 +49,8 @@ static void *lid_switch_setup(void) static void lid_switch_before(void *unused) { /* Make sure that interrupt fire at the next lid open/close */ - zassume_ok(emul_lid_close()); - zassume_ok(emul_lid_open()); + zassert_ok(emul_lid_close()); + zassert_ok(emul_lid_open()); k_sleep(K_MSEC(100)); } diff --git a/zephyr/test/drivers/default/src/ppc_syv682x.c b/zephyr/test/drivers/default/src/ppc_syv682x.c index ba2e68f2ff..648510da07 100644 --- a/zephyr/test/drivers/default/src/ppc_syv682x.c +++ b/zephyr/test/drivers/default/src/ppc_syv682x.c @@ -46,10 +46,10 @@ static void *syv682x_test_setup(void) fixture.ppc_emul = EMUL_DT_GET(SYV682X_NODE); fixture.common_data = emul_syv682x_get_i2c_common_data(fixture.ppc_emul); - zassume_not_null(fixture.ppc_emul, NULL); + zassert_not_null(fixture.ppc_emul, NULL); fixture.frs_en_gpio_port = DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_USB_C1_FRS_EN_PATH, gpios)); - zassume_not_null(fixture.frs_en_gpio_port, NULL); + zassert_not_null(fixture.frs_en_gpio_port, NULL); fixture.frs_en_gpio_pin = DT_GPIO_PIN(GPIO_USB_C1_FRS_EN_PATH, gpios); return &fixture; @@ -62,7 +62,7 @@ static void syv682x_test_after(void *data) struct i2c_common_emul_data *common_data = fixture->common_data; /* Disable the power path and clear interrupt conditions. */ - zassume_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG, + zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG, SYV682X_CONTROL_1_PWR_ENB), NULL); syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE, @@ -120,14 +120,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_dead_battery) * With a dead battery, the device powers up sinking VBUS, and the * driver should keep that going. */ - zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, SYV682X_CONTROL_1_CH_SEL), NULL); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_5V, SYV682X_CONTROL_4_NONE); zassert_ok(ppc_init(syv682x_port), "PPC init failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); zassert_true(reg & SYV682X_CONTROL_1_CH_SEL, @@ -144,14 +144,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_vsafe0v) uint8_t reg; /* With VBUS at vSafe0V, init should set the default configuration. */ - zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, SYV682X_CONTROL_1_PWR_ENB), NULL); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_0V, SYV682X_CONTROL_4_NONE); zassert_ok(ppc_init(syv682x_port), "PPC init failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); check_control_1_default_init(reg); @@ -162,14 +162,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_sink_disabled) uint8_t reg; /* With sink disabled, init should do the same thing. */ - zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, SYV682X_CONTROL_1_CH_SEL), NULL); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_0V, SYV682X_CONTROL_4_NONE); zassert_ok(ppc_init(syv682x_port), "PPC init failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); check_control_1_default_init(reg); @@ -181,7 +181,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common) int ilim; zassert_ok(ppc_init(syv682x_port), "PPC init failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); @@ -196,7 +196,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common) ilim = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT; zassert_equal(ilim, CONFIG_PLATFORM_EC_USB_PD_PULLUP, "Default init, but 5V current limit set to %d", ilim); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_2_REG, ®), NULL); zassert_equal(reg, @@ -205,14 +205,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common) << SYV682X_DSG_RON_SHIFT) | (SYV682X_DSG_TIME_50MS << SYV682X_DSG_TIME_SHIFT), "Default init, but CONTROL_2 is 0x%x", reg); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_3_REG, ®), NULL); zassert_equal(reg, (SYV682X_OVP_23_7 << SYV682X_OVP_BIT_SHIFT) | SYV682X_RVS_MASK, "Default init, but CONTROL_3 is 0x%x", reg); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), NULL); zassert_equal(reg & ~SYV682X_CONTROL_4_INT_MASK, @@ -226,7 +226,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_source_enable) zassert_ok(ppc_vbus_source_enable(syv682x_port, true), "VBUS enable failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0, @@ -245,7 +245,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_source_disable) ZTEST_F(ppc_syv682x, test_syv682x_interrupt_source_oc) { - zassume_ok(ppc_vbus_source_enable(syv682x_port, true), + zassert_ok(ppc_vbus_source_enable(syv682x_port, true), "VBUS enable failed"); /* An OC event less than 100 ms should not cause VBUS to turn off. */ syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OC_5V, @@ -266,7 +266,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_tsd) * (The device will have already physically disabled them.) The state of * the sink path is not part of the driver's API. */ - zassume_ok(ppc_vbus_source_enable(syv682x_port, true), + zassert_ok(ppc_vbus_source_enable(syv682x_port, true), "Source enable failed"); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_TSD, SYV682X_CONTROL_4_NONE); @@ -278,7 +278,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_tsd) ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_ovp) { /* An OVP event should cause the driver to disable the source path. */ - zassume_ok(ppc_vbus_source_enable(syv682x_port, true), + zassert_ok(ppc_vbus_source_enable(syv682x_port, true), "Source enable failed"); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OVP, SYV682X_CONTROL_4_NONE); @@ -296,12 +296,12 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc) * re-enable the sink path until the OC count limit is reached, at which * point the driver should leave it disabled. */ - zassume_ok(ppc_vbus_sink_enable(syv682x_port, true), + zassert_ok(ppc_vbus_sink_enable(syv682x_port, true), "Sink enable failed"); syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OC_HV, SYV682X_CONTROL_4_NONE); msleep(1); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0, @@ -310,7 +310,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc) SYV682X_CONTROL_4_NONE); /* Alert GPIO doesn't change so wait for delayed syv682x interrupt */ msleep(15); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0, @@ -319,7 +319,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc) SYV682X_CONTROL_4_NONE); /* Alert GPIO doesn't change so wait for delayed syv682x interrupt */ msleep(15); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, @@ -339,14 +339,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_oc) syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_NONE, SYV682X_CONTROL_4_VCONN_OCP); msleep(1); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), "Reading CONTROL_4 failed"); zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 | SYV682X_CONTROL_4_VCONN2), "VCONN disabled after initial VCONN OC"); msleep(50); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), "Reading CONTROL_4 failed"); zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 | @@ -357,7 +357,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_oc) * should turn VCONN off. */ msleep(60); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), "Reading CONTROL_4 failed"); zassert_false(reg & (SYV682X_CONTROL_4_VCONN1 | @@ -379,7 +379,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_ov) syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_NONE, SYV682X_CONTROL_4_VBAT_OVP); msleep(1); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), "Reading CONTROL_4 failed"); zassert_true(reg & SYV682X_CONTROL_4_CC1_BPS, @@ -402,7 +402,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_frs_enable) * polarity. Disabling FRS should enable both CC lines. */ ppc_vbus_sink_enable(syv682x_port, true); - zassume_false(ppc_is_sourcing_vbus(syv682x_port), + zassert_false(ppc_is_sourcing_vbus(syv682x_port), "PPC is sourcing VBUS after sink enabled"); ppc_set_polarity(syv682x_port, 0 /* CC1 */); ppc_set_frs_enable(syv682x_port, true); @@ -424,14 +424,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_frs_disable) uint8_t reg; ppc_vbus_sink_enable(syv682x_port, true); - zassume_false(ppc_is_sourcing_vbus(syv682x_port), + zassert_false(ppc_is_sourcing_vbus(syv682x_port), "PPC is sourcing VBUS after sink enabled"); ppc_set_polarity(syv682x_port, 0 /* CC1 */); ppc_set_frs_enable(syv682x_port, false); zassert_equal(gpio_emul_output_get(gpio_dev, fixture->frs_en_gpio_pin), 0, "FRS disabled, but FRS GPIO not deasserted"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_4_REG, ®), "Reading CONTROL_4 failed"); zassert_equal( @@ -463,7 +463,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_usb_default) zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port, TYPEC_RP_USB), "Could not set source current limit"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT; @@ -479,7 +479,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_1500ma) zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port, TYPEC_RP_1A5), "Could not set source current limit"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT; @@ -495,7 +495,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_3000ma) zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port, TYPEC_RP_3A0), "Could not set source current limit"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), "Reading CONTROL_1 failed"); ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT; @@ -561,7 +561,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_enable_trivial) * If VBUS source is already enabled, disabling VBUS sink should * trivially succeed. */ - zassume_ok(ppc_vbus_source_enable(syv682x_port, true), + zassert_ok(ppc_vbus_source_enable(syv682x_port, true), "VBUS enable failed"); zassert_ok(ppc_vbus_sink_enable(syv682x_port, false), "Sink disable failed"); @@ -576,11 +576,11 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_enable_power_path) * After enabling VBUS sink, the HV power path should be enabled in sink * mode with the configured current limit. */ - zassume_ok(ppc_vbus_source_enable(syv682x_port, false), + zassert_ok(ppc_vbus_source_enable(syv682x_port, false), "VBUS enable failed"); zassert_ok(ppc_vbus_sink_enable(syv682x_port, true), "Sink disable failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); zassert_true(reg & SYV682X_CONTROL_1_CH_SEL, @@ -598,14 +598,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_disable) { uint8_t reg; - zassume_ok(ppc_vbus_source_enable(syv682x_port, false), + zassert_ok(ppc_vbus_source_enable(syv682x_port, false), "VBUS enable failed"); zassert_ok(ppc_vbus_sink_enable(syv682x_port, true), "Sink disable failed"); zassert_ok(ppc_vbus_sink_enable(syv682x_port, false), "Sink disable failed"); - zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul, + zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul, SYV682X_CONTROL_1_REG, ®), NULL); zassert_true(reg & SYV682X_CONTROL_1_PWR_ENB, diff --git a/zephyr/test/drivers/default/src/ps8xxx.c b/zephyr/test/drivers/default/src/ps8xxx.c index 2aa1844c10..6fb1658c06 100644 --- a/zephyr/test/drivers/default/src/ps8xxx.c +++ b/zephyr/test/drivers/default/src/ps8xxx.c @@ -1411,7 +1411,7 @@ static void ps8805_before(void *state) board_set_ps8xxx_product_id(PS8805_PRODUCT_ID); ps8xxx_emul_set_product_id(ps8xxx_emul, PS8805_PRODUCT_ID); setup_no_fail_all(); - zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1)); + zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1)); } static void ps8805_after(void *state) @@ -1436,7 +1436,7 @@ static void ps8815_before(void *state) ps8xxx_emul_set_reg_id(ps8xxx_emul, PS8815_REG_ID); ps8xxx_emul_set_product_id(ps8xxx_emul, PS8815_PRODUCT_ID); setup_no_fail_all(); - zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1)); + zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1)); } static void ps8815_after(void *state) @@ -1461,7 +1461,7 @@ static void ps8745_before(void *state) ps8xxx_emul_set_product_id(ps8xxx_emul, PS8815_PRODUCT_ID); ps8xxx_emul_set_reg_id(ps8xxx_emul, PS8745_REG_ID); setup_no_fail_all(); - zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1), NULL); + zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1), NULL); } static void ps8745_after(void *state) diff --git a/zephyr/test/drivers/default/src/tcpci_test_common.c b/zephyr/test/drivers/default/src/tcpci_test_common.c index bbc1e3f8b0..473fbe0f20 100644 --- a/zephyr/test/drivers/default/src/tcpci_test_common.c +++ b/zephyr/test/drivers/default/src/tcpci_test_common.c @@ -1020,7 +1020,7 @@ void test_tcpci_hard_reset_reinit(const struct emul *emul, uint16_t power_status_mask; uint16_t alert_mask; - zassume_equal(EC_SUCCESS, drv->init(port), NULL); + zassert_equal(EC_SUCCESS, drv->init(port), NULL); tcpci_emul_get_reg(emul, TCPC_REG_POWER_STATUS_MASK, &power_status_mask); tcpci_emul_get_reg(emul, TCPC_REG_ALERT_MASK, &alert_mask); diff --git a/zephyr/test/drivers/default/src/virtual_battery.c b/zephyr/test/drivers/default/src/virtual_battery.c index fc29e39777..87c031e723 100644 --- a/zephyr/test/drivers/default/src/virtual_battery.c +++ b/zephyr/test/drivers/default/src/virtual_battery.c @@ -226,11 +226,11 @@ ZTEST_USER(virtual_battery, test_read_regs) word = virtual_battery_read16(SB_SPECIFICATION_INFO); zassert_equal(expected, word, "%d != %d", expected, word); - zassume_ok(battery_status(&expected)); + zassert_ok(battery_status(&expected)); word = virtual_battery_read16(SB_BATTERY_STATUS); zassert_equal(expected, word, "%d != %d", expected, word); - zassume_ok(battery_design_voltage(&expected)); + zassert_ok(battery_design_voltage(&expected)); word = virtual_battery_read16(SB_DESIGN_VOLTAGE); zassert_equal(expected, word, "%d != %d", expected, word); diff --git a/zephyr/test/drivers/dps/src/dps.c b/zephyr/test/drivers/dps/src/dps.c index d445767df4..88fd81a709 100644 --- a/zephyr/test/drivers/dps/src/dps.c +++ b/zephyr/test/drivers/dps/src/dps.c @@ -89,7 +89,7 @@ ZTEST(dps, console_cmd__enable) ZTEST(dps, console_cmd__disable) { /* Should already by enabled due to before() function */ - zassume_true(dps_is_enabled(), NULL); + zassert_true(dps_is_enabled(), NULL); zassert_ok(shell_execute_cmd(get_ec_shell(), "dps dis"), NULL); @@ -104,7 +104,7 @@ ZTEST(dps, console_cmd__fakepwr_print) ZTEST(dps, console_cmd__fakepwr_enable_disable) { - zassume_false(dps_is_fake_enabled(), + zassert_false(dps_is_fake_enabled(), "fakepwr shouldn't be enabled by default"); zassert_ok(shell_execute_cmd(get_ec_shell(), "dps fakepwr 100 200"), diff --git a/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c b/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c index 907329f8a1..721fbcd8f9 100644 --- a/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c +++ b/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c @@ -50,7 +50,7 @@ static void host_cmd_get_pd_port_caps_begin(void *data) ARG_UNUSED(data); /* Assume we have at least one USB-C port */ - zassume_true(board_get_usb_pd_port_count() > 0, + zassert_true(board_get_usb_pd_port_count() > 0, "Insufficient TCPCs found"); } diff --git a/zephyr/test/drivers/host_cmd/src/motion_sense.c b/zephyr/test/drivers/host_cmd/src/motion_sense.c index 371ca4ae11..1b35eb637c 100644 --- a/zephyr/test/drivers/host_cmd/src/motion_sense.c +++ b/zephyr/test/drivers/host_cmd/src/motion_sense.c @@ -72,7 +72,7 @@ static void host_cmd_motion_sense_before(void *fixture) RESET_FAKE(mock_perform_calib); FFF_RESET_HISTORY(); - zassume_ok(shell_execute_cmd(get_ec_shell(), "accelinit 0")); + zassert_ok(shell_execute_cmd(get_ec_shell(), "accelinit 0")); atomic_clear(&motion_sensors[0].flush_pending); motion_sensors[0].config[SENSOR_CONFIG_AP].odr = 0; @@ -305,7 +305,7 @@ ZTEST_USER(host_cmd_motion_sense, test_odr_get) { struct ec_response_motion_sense response; - zassume_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], + zassert_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], 1000000, false), NULL); zassert_ok(host_cmd_motion_sense_odr(/*sensor_num=*/0, @@ -322,7 +322,7 @@ ZTEST_USER(host_cmd_motion_sense, test_odr_set) { struct ec_response_motion_sense response; - zassume_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], 0, + zassert_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], 0, false), NULL); zassert_ok(host_cmd_motion_sense_odr(/*sensor_num=*/0, @@ -774,7 +774,7 @@ ZTEST(host_cmd_motion_sense, test_int_enable) host_cmd_motion_sense_int_enable(2, &response), NULL); /* Make sure we start off disabled */ - zassume_ok(host_cmd_motion_sense_int_enable(0, &response)); + zassert_ok(host_cmd_motion_sense_int_enable(0, &response)); /* Test enable */ zassert_ok(host_cmd_motion_sense_int_enable(1, &response)); diff --git a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c index 81c2485388..54c8786548 100644 --- a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c +++ b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c @@ -41,7 +41,7 @@ ZTEST_USER(host_cmd_pd_chip_info, test_bad_index) { struct ec_response_pd_chip_info_v1 response; - zassume_true(board_get_usb_pd_port_count() < BAD_PORT, + zassert_true(board_get_usb_pd_port_count() < BAD_PORT, "Intended bad port exists"); zassert_equal(run_pd_chip_info(BAD_PORT, &response), EC_RES_INVALID_PARAM, @@ -53,7 +53,7 @@ static void host_cmd_pd_chip_info_begin(void *data) ARG_UNUSED(data); /* Assume we have at least one USB-C port */ - zassume_true(board_get_usb_pd_port_count() > 0, + zassert_true(board_get_usb_pd_port_count() > 0, "Insufficient TCPCs found"); /* Set the system into S0, since the AP would drive these commands */ diff --git a/zephyr/test/drivers/host_cmd/src/pd_control.c b/zephyr/test/drivers/host_cmd/src/pd_control.c index e8de27f6ce..5fdd424db9 100644 --- a/zephyr/test/drivers/host_cmd/src/pd_control.c +++ b/zephyr/test/drivers/host_cmd/src/pd_control.c @@ -23,7 +23,7 @@ ZTEST_USER(host_cmd_pd_control, test_bad_index) struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(EC_CMD_PD_CONTROL, 0, params); - zassume_true(board_get_usb_pd_port_count() < BAD_PORT, + zassert_true(board_get_usb_pd_port_count() < BAD_PORT, "Intended bad port exists"); zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM, "Failed to fail pd_control for port %d", params.chip); @@ -47,7 +47,7 @@ ZTEST_USER(host_cmd_pd_control, test_pd_reset_resume) * the only HC return which would cover this is a state string, which * could be brittle. */ - zassume_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning"); + zassert_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning"); host_cmd_pd_control(TEST_PORT, PD_RESET); @@ -76,7 +76,7 @@ ZTEST_USER(host_cmd_pd_control, test_suspend_resume) * the only HC return which would cover this is a state string, which * could be brittle. */ - zassume_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning"); + zassert_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning"); host_cmd_pd_control(TEST_PORT, PD_SUSPEND); @@ -117,7 +117,7 @@ static void host_cmd_pd_control_begin(void *data) ARG_UNUSED(data); /* Assume we have at least one USB-C port */ - zassume_true(board_get_usb_pd_port_count() > 0, + zassert_true(board_get_usb_pd_port_count() > 0, "Insufficient TCPCs found"); /* Set the system into S0, since the AP would drive these commands */ diff --git a/zephyr/test/drivers/host_cmd/src/usb_pd_control.c b/zephyr/test/drivers/host_cmd/src/usb_pd_control.c index c439141da9..8947fdca8c 100644 --- a/zephyr/test/drivers/host_cmd/src/usb_pd_control.c +++ b/zephyr/test/drivers/host_cmd/src/usb_pd_control.c @@ -99,7 +99,7 @@ ZTEST_USER(host_cmd_usb_pd_control, test_bad_index) { struct ec_response_usb_pd_control_v2 response; - zassume_true(board_get_usb_pd_port_count() < BAD_PORT, + zassert_true(board_get_usb_pd_port_count() < BAD_PORT, "Intended bad port exists"); zassert_equal(run_usb_pd_control(BAD_PORT, &response), EC_RES_INVALID_PARAM, @@ -130,7 +130,7 @@ static void host_cmd_usb_pd_control_before(void *data) ARG_UNUSED(data); /* Assume we have at least one USB-C port */ - zassume_true(board_get_usb_pd_port_count() > 0, + zassert_true(board_get_usb_pd_port_count() > 0, "Insufficient TCPCs found"); /* Set the system into S0, since the AP would drive these commands */ diff --git a/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c b/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c index 149f25dfdd..5b7cbfb2c7 100644 --- a/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c +++ b/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c @@ -56,7 +56,7 @@ ZTEST(keyboard_backlight, host_command_get_backlight__normal) uint8_t expected_percentage = 50; int ret; - zassume_ok(set_backlight_percent_helper(expected_percentage), NULL); + zassert_ok(set_backlight_percent_helper(expected_percentage), NULL); /* Brief delay to allow a deferred function to enable the backlight */ k_sleep(K_MSEC(50)); @@ -78,7 +78,7 @@ ZTEST(keyboard_backlight, console_command__noargs) const char *outbuffer; size_t buffer_size; - zassume_ok(set_backlight_percent_helper(70), NULL); + zassert_ok(set_backlight_percent_helper(70), NULL); k_sleep(K_MSEC(50)); /* With no args, print current state */ @@ -102,7 +102,7 @@ ZTEST(keyboard_backlight, console_command__set_on) ZTEST(keyboard_backlight, console_command__set_off) { - zassume_ok(set_backlight_percent_helper(40), NULL); + zassert_ok(set_backlight_percent_helper(40), NULL); k_sleep(K_MSEC(50)); /* Turn back off */ diff --git a/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c b/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c index 03fb71f828..beaabd718d 100644 --- a/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c +++ b/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c @@ -130,7 +130,7 @@ ZTEST(keyboard_scan, console_command_ksstate__force) */ keyboard_scan_enable(false, -1); - zassume_false(keyboard_scan_is_enabled()); + zassert_false(keyboard_scan_is_enabled()); zassert_ok(shell_execute_cmd(get_ec_shell(), "ksstate force")); @@ -142,7 +142,7 @@ ZTEST(keyboard_scan, console_command_ksstate__on_off) { /* This command turns state change printing on/off */ - zassume_false(keyboard_scan_get_print_state_changes()); + zassert_false(keyboard_scan_get_print_state_changes()); zassert_ok(shell_execute_cmd(get_ec_shell(), "ksstate on")); zassert_true(keyboard_scan_get_print_state_changes()); @@ -235,7 +235,7 @@ ZTEST(keyboard_scan, host_command_simulate_key__locked) { uint16_t ret; - zassume_true(system_is_locked(), "Expecting locked system."); + zassert_true(system_is_locked(), "Expecting locked system."); struct ec_response_keyboard_factory_test response; struct ec_params_mkbp_simulate_key params; @@ -251,7 +251,7 @@ ZTEST(keyboard_scan, host_command_simulate_key__bad_params) uint16_t ret; system_is_locked_fake.return_val = 0; - zassume_false(system_is_locked(), "Expecting unlocked system."); + zassert_false(system_is_locked(), "Expecting unlocked system."); struct ec_response_keyboard_factory_test response; struct ec_params_mkbp_simulate_key params = { @@ -293,7 +293,7 @@ ZTEST(keyboard_scan, host_command_simulate__key_press) uint16_t ret; system_is_locked_fake.return_val = 0; - zassume_false(system_is_locked(), "Expecting unlocked system."); + zassert_false(system_is_locked(), "Expecting unlocked system."); ret = send_keypress_host_command(1, 2, 1); zassert_equal(EC_RES_SUCCESS, ret, "Command returned %u", ret); @@ -323,7 +323,7 @@ FAKE_VOID_FUNC(chipset_reset, int); ZTEST(keyboard_scan, special_key_combos) { system_is_locked_fake.return_val = 0; - zassume_false(system_is_locked(), "Expecting unlocked system."); + zassert_false(system_is_locked(), "Expecting unlocked system."); /* Set the volume up key coordinates to something arbitrary */ int vol_up_col = 1; @@ -332,7 +332,7 @@ ZTEST(keyboard_scan, special_key_combos) set_vol_up_key(vol_up_row, vol_up_col); /* Vol up and the alt keys must be in different columns */ - zassume_false(vol_up_col == KEYBOARD_COL_LEFT_ALT, NULL); + zassert_false(vol_up_col == KEYBOARD_COL_LEFT_ALT, NULL); /* Hold down volume up, left alt (either alt key works), and R */ zassert_ok(send_keypress_host_command(vol_up_col, vol_up_row, 1)); diff --git a/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c b/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c index dee2ba2d1b..26a962d5fc 100644 --- a/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c +++ b/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c @@ -153,7 +153,7 @@ static void *setup(void) .handler = interrupt_gpio_monitor, }; - zassume_ok(gpio_add_callback(interrupt_pin->port, + zassert_ok(gpio_add_callback(interrupt_pin->port, &fixture.callback_config), "Could not configure GPIO callback."); diff --git a/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c b/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c index 25331acc20..2cb331b387 100644 --- a/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c +++ b/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c @@ -141,7 +141,7 @@ static void reset(void *data) ARG_UNUSED(data); /* Turn the port off */ - zassume_ok(usb_charge_set_mode(PORT_ID, USB_CHARGE_MODE_DISABLED, + zassert_ok(usb_charge_set_mode(PORT_ID, USB_CHARGE_MODE_DISABLED, USB_DISALLOW_SUSPEND_CHARGE), NULL); } diff --git a/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c b/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c index 9a360761ab..82f67aad23 100644 --- a/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c +++ b/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c @@ -40,7 +40,7 @@ static void usb_retimer_fw_update_suspend_port(void) /* Give PD task time to suspend port */ k_sleep(K_SECONDS(1)); - zassume_true(acpi_read_and_verify() == 0, + zassert_true(acpi_read_and_verify() == 0, "Failed to see successful suspend"); } @@ -50,7 +50,7 @@ static void usb_retimer_fw_update_before(void *data) ARG_UNUSED(data); /* Assume our common setup of a BB retimer on C1 */ - zassume_true(EMUL_DT_GET(BB_RETIMER_NODE) != NULL, + zassert_true(EMUL_DT_GET(BB_RETIMER_NODE) != NULL, "No BB retimer found on C1"); /* Set chipset to ON, since AP would drive this process */ diff --git a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c index 43ccc3b3f3..cbdd861585 100644 --- a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c +++ b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c @@ -41,7 +41,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, * function. */ set_ac_enabled(true); - zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), + zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), NULL); isl923x_emul_set_adc_vbus(charger_emul, @@ -54,7 +54,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, static void disconnect_partner_from_port(const struct emul *tcpc_emul, const struct emul *charger_emul) { - zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul)); + zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul)); isl923x_emul_set_adc_vbus(charger_emul, 0); k_sleep(K_SECONDS(1)); } diff --git a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c index dc8806151b..9d34bc7917 100644 --- a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c +++ b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c @@ -97,9 +97,9 @@ ZTEST_F(usbc_alt_mode, verify_mode_exit_via_pd_host_cmd) * entering an alternate most (DisplayPort specifically) has already * been verified in another test */ - zassume_equal(response_size, sizeof(get_mode_response)); - zassume_equal(get_mode_response.svid, USB_SID_DISPLAYPORT); - zassume_equal(get_mode_response.vdo[0], + zassert_equal(response_size, sizeof(get_mode_response)); + zassert_equal(get_mode_response.svid, USB_SID_DISPLAYPORT); + zassert_equal(get_mode_response.vdo[0], fixture->partner.modes_vdm[get_mode_response.opos]); struct ec_params_usb_pd_set_mode_request set_mode_params = { diff --git a/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c b/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c index c1c7d7eb1a..9c87b9a4a2 100644 --- a/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c +++ b/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c @@ -50,7 +50,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, * function. */ set_ac_enabled(true); - zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), + zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), NULL); isl923x_emul_set_adc_vbus(charger_emul, @@ -63,7 +63,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, static void disconnect_partner_from_port(const struct emul *tcpc_emul, const struct emul *charger_emul) { - zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL); + zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL); isl923x_emul_set_adc_vbus(charger_emul, 0); k_sleep(K_SECONDS(1)); } diff --git a/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c b/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c index 66a145c475..912d8fa644 100644 --- a/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c +++ b/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c @@ -255,7 +255,7 @@ ZTEST_F(usbc_tbt_mode, verify_tbt_entry_fail) fixture->charger_emul); status = host_cmd_typec_status(TEST_PORT); - zassume_equal((status.mux_state & USB_MUX_CHECK_MASK), + zassert_equal((status.mux_state & USB_MUX_CHECK_MASK), USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x", status.mux_state); @@ -295,7 +295,7 @@ ZTEST_F(usbc_tbt_mode, verify_tbt_passive_entry_exit) verify_cable_found(fixture->partner.cable); status = host_cmd_typec_status(TEST_PORT); - zassume_equal((status.mux_state & USB_MUX_CHECK_MASK), + zassert_equal((status.mux_state & USB_MUX_CHECK_MASK), USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x", status.mux_state); diff --git a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c index 324df08826..beaafd6880 100644 --- a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c +++ b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c @@ -52,7 +52,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, * function. */ set_ac_enabled(true); - zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), + zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul), NULL); isl923x_emul_set_adc_vbus(charger_emul, @@ -65,7 +65,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul, static void disconnect_partner_from_port(const struct emul *tcpc_emul, const struct emul *charger_emul) { - zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL); + zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL); isl923x_emul_set_adc_vbus(charger_emul, 0); k_sleep(K_SECONDS(1)); } @@ -166,7 +166,7 @@ ZTEST_F(usbc_vconn_swap, vconn_swap_via_host_command) struct ec_response_typec_status status = host_cmd_typec_status(TEST_PORT); - zassume_equal(status.vconn_role, PD_ROLE_VCONN_SRC, + zassert_equal(status.vconn_role, PD_ROLE_VCONN_SRC, "TCPM did not initiate VCONN Swap after attach"); host_cmd_usb_pd_control(TEST_PORT, USB_PD_CTRL_SWAP_VCONN); |