summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2020-08-13 09:44:34 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-13 22:32:17 +0000
commit0df97d0e5846493c868eabe4c1647d67a946d7fd (patch)
tree100e343403bb91aabf8661fbf85e1dcf07b16676
parent39a526023e435a776639d68271eed593598e9106 (diff)
downloadchrome-ec-0df97d0e5846493c868eabe4c1647d67a946d7fd.tar.gz
test: remove no_empty_state tests
When we use IS_ENABLED style code we may have empty state machine states that are unused. The linker ensures that we never try to reference these states. This does mean that extra states do cost ~20 bytes each. This cost does seem worth it to keep the value of usb states stable. BRANCH=none BUG=none TEST=buildall Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I44c1454bed91c9e28d89ebd6b75e9df684c41844 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2354192 Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r--test/usb_pe_drp.c1
-rw-r--r--test/usb_prl.c1
-rw-r--r--test/usb_prl_old.c1
-rw-r--r--test/usb_sm_checks.c64
-rw-r--r--test/usb_sm_checks.h3
-rw-r--r--test/usb_typec_ctvpd.c2
-rw-r--r--test/usb_typec_drp_acc_trysrc.c1
7 files changed, 0 insertions, 73 deletions
diff --git a/test/usb_pe_drp.c b/test/usb_pe_drp.c
index b57f0c09bd..3cf1eceece 100644
--- a/test/usb_pe_drp.c
+++ b/test/usb_pe_drp.c
@@ -354,7 +354,6 @@ void run_test(int argc, char **argv)
/* Do basic state machine validity checks last. */
RUN_TEST(test_pe_no_parent_cycles);
- RUN_TEST(test_pe_no_empty_state);
test_print_result();
}
diff --git a/test/usb_prl.c b/test/usb_prl.c
index 4021ab3881..fa5444c85c 100644
--- a/test/usb_prl.c
+++ b/test/usb_prl.c
@@ -164,7 +164,6 @@ void run_test(int argc, char **argv)
/* Do basic state machine validity checks last. */
RUN_TEST(test_prl_no_parent_cycles);
- RUN_TEST(test_prl_no_empty_state);
RUN_TEST(test_prl_all_states_named);
test_print_result();
diff --git a/test/usb_prl_old.c b/test/usb_prl_old.c
index 4c06c41b8b..af87195fb9 100644
--- a/test/usb_prl_old.c
+++ b/test/usb_prl_old.c
@@ -1318,7 +1318,6 @@ void run_test(int argc, char **argv)
/* Do basic state machine validity checks last. */
RUN_TEST(test_prl_no_parent_cycles);
- RUN_TEST(test_prl_no_empty_state);
RUN_TEST(test_prl_all_states_named);
test_print_result();
diff --git a/test/usb_sm_checks.c b/test/usb_sm_checks.c
index 498d56e323..03e5aa23c2 100644
--- a/test/usb_sm_checks.c
+++ b/test/usb_sm_checks.c
@@ -108,70 +108,6 @@ int test_pe_no_parent_cycles(void)
return EC_SUCCESS;
}
-static int test_no_empty_state(const struct test_sm_data * const sm_data)
-{
- int i;
- const struct usb_state empty = { 0 };
-
- for (i = 0; i < sm_data->size; ++i) {
- if (memcmp(&sm_data->base[i], &empty, sizeof(empty)) == 0)
- break;
- }
-
- /* Ensure all states had data, otherwise the ith state is empty. */
- TEST_EQ(i, sm_data->size, "%d");
-
- return EC_SUCCESS;
-}
-
-int test_tc_no_empty_state(void)
-{
- int i;
-
- for (i = 0; i < test_tc_sm_data_size; ++i) {
- const int rv = test_no_empty_state(&test_tc_sm_data[i]);
-
- if (rv) {
- ccprintf("TC State machine %d has empty state!\n", i);
- TEST_ASSERT(0);
- }
- }
-
- return EC_SUCCESS;
-}
-
-int test_prl_no_empty_state(void)
-{
- int i;
-
- for (i = 0; i < test_prl_sm_data_size; ++i) {
- const int rv = test_no_empty_state(&test_prl_sm_data[i]);
-
- if (rv) {
- ccprintf("PRL State machine %d has empty state!\n", i);
- TEST_ASSERT(0);
- }
- }
-
- return EC_SUCCESS;
-}
-
-int test_pe_no_empty_state(void)
-{
- int i;
-
- for (i = 0; i < test_pe_sm_data_size; ++i) {
- const int rv = test_no_empty_state(&test_pe_sm_data[i]);
-
- if (rv) {
- ccprintf("PE State machine %d has empty state!\n", i);
- TEST_ASSERT(0);
- }
- }
-
- return EC_SUCCESS;
-}
-
static volatile int state_printed;
/* Override the implement version of print */
diff --git a/test/usb_sm_checks.h b/test/usb_sm_checks.h
index e6b459f1f3..92529ac385 100644
--- a/test/usb_sm_checks.h
+++ b/test/usb_sm_checks.h
@@ -9,17 +9,14 @@
#define __CROS_EC_USB_SM_CHECKS_H
int test_tc_no_parent_cycles(void);
-int test_tc_no_empty_state(void);
int test_tc_all_states_named(void);
int test_prl_no_parent_cycles(void);
-int test_prl_no_empty_state(void);
int test_prl_all_states_named(void);
int test_pe_no_parent_cycles(void);
-int test_pe_no_empty_state(void);
int test_pe_all_states_named(void);
#endif /* __CROS_EC_USB_SM_CHECKS_H */ \ No newline at end of file
diff --git a/test/usb_typec_ctvpd.c b/test/usb_typec_ctvpd.c
index 08c23eb284..1340c7a093 100644
--- a/test/usb_typec_ctvpd.c
+++ b/test/usb_typec_ctvpd.c
@@ -1523,7 +1523,6 @@ void run_test(int argc, char **argv)
/* Do basic state machine validity checks last. */
RUN_TEST(test_tc_no_parent_cycles);
- RUN_TEST(test_tc_no_empty_state);
RUN_TEST(test_tc_all_states_named);
/*
@@ -1532,7 +1531,6 @@ void run_test(int argc, char **argv)
* te PE statemachine here so we don't have to create another test exe
*/
RUN_TEST(test_pe_no_parent_cycles);
- RUN_TEST(test_pe_no_empty_state);
RUN_TEST(test_pe_all_states_named);
test_print_result();
diff --git a/test/usb_typec_drp_acc_trysrc.c b/test/usb_typec_drp_acc_trysrc.c
index ce1b02e5bc..c94f273cc3 100644
--- a/test/usb_typec_drp_acc_trysrc.c
+++ b/test/usb_typec_drp_acc_trysrc.c
@@ -737,7 +737,6 @@ void run_test(int argc, char **argv)
/* Do basic state machine validity checks last. */
RUN_TEST(test_tc_no_parent_cycles);
- RUN_TEST(test_tc_no_empty_state);
RUN_TEST(test_tc_all_states_named);
test_print_result();