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>
This commit is contained in:
Jett Rink 2020-08-13 09:44:34 -06:00 committed by Commit Bot
parent 39a526023e
commit 0df97d0e58
7 changed files with 0 additions and 73 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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();

View File

@ -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 */

View File

@ -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 */

View File

@ -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();

View File

@ -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();