summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-08-24 14:12:09 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-25 21:36:21 +0000
commit41be436e2e8617b159eae9e54f39d68d2c030f15 (patch)
treecaaed82deb9a169bcdeae8bce01d8cd41b130305
parente1b26246ac39d2bfa2dc3e3eff2830eb937dc295 (diff)
downloadchrome-ec-41be436e2e8617b159eae9e54f39d68d2c030f15.tar.gz
zephyr: Refactor ec_app test
Change the ec_app test to only call ec_app_main once by moving all setup to the suite setup function, then calling ec_app_main, and then running all the tests to verify the post-conditions. BRANCH=None BUG=None TEST=./twister --clobber -v -i -T zephyr/test/ec_app Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: If5480ce003d06a50fe0540795aede01ab95fb755 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855160 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--zephyr/test/ec_app/src/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/zephyr/test/ec_app/src/main.c b/zephyr/test/ec_app/src/main.c
index ca6f3ed393..c7d0bac021 100644
--- a/zephyr/test/ec_app/src/main.c
+++ b/zephyr/test/ec_app/src/main.c
@@ -91,8 +91,6 @@ DECLARE_HOOK(HOOK_INIT, sample_init_hook, HOOK_PRIO_DEFAULT);
*/
ZTEST(ec_app_tests, test_hook_notify_init)
{
- sample_init_hook_count = 0;
- ec_app_main();
zassert_equal(1, sample_init_hook_count,
"Expected sample_init_hook to run once.");
}
@@ -112,4 +110,11 @@ ZTEST(ec_app_tests, test_start_ec_tasks)
#endif
}
-ZTEST_SUITE(ec_app_tests, NULL, NULL, NULL, NULL, NULL);
+/* Does setup for all of the test cases. */
+void *ec_app_setup(void)
+{
+ ec_app_main();
+ return NULL;
+}
+
+ZTEST_SUITE(ec_app_tests, NULL, ec_app_setup, NULL, NULL, NULL);