From e372db6463482ff5a9da7957c9b411a35cd3b33f Mon Sep 17 00:00:00 2001 From: Tomasz Michalec Date: Thu, 28 Jul 2022 12:53:50 +0200 Subject: zephyr: test: Convert system test to new ZTEST API Enable ZTEST_NEW_API for system tests BRANCH=None BUG=b:240343510 TEST=./twister -T zephyr/test/system TEST=zmake -D test test-system Signed-off-by: Tomasz Michalec Change-Id: I1b4088bdd79191a8dc6c6c1ad20a5d6b4f17781d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3790851 Tested-by: Tristan Honscheid Reviewed-by: Yuval Peress Commit-Queue: Tristan Honscheid Reviewed-by: Tristan Honscheid --- zephyr/test/system/prj.conf | 1 + zephyr/test/system/test_system.c | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/zephyr/test/system/prj.conf b/zephyr/test/system/prj.conf index 4b3055b39b..201c2feacc 100644 --- a/zephyr/test/system/prj.conf +++ b/zephyr/test/system/prj.conf @@ -3,6 +3,7 @@ # found in the LICENSE file. CONFIG_ZTEST=y +CONFIG_ZTEST_NEW_API=y CONFIG_PLATFORM_EC=y CONFIG_CROS_EC=y CONFIG_LOG=y diff --git a/zephyr/test/system/test_system.c b/zephyr/test/system/test_system.c index ce83a684d1..77ebd1a715 100644 --- a/zephyr/test/system/test_system.c +++ b/zephyr/test/system/test_system.c @@ -6,7 +6,8 @@ #include #include #include -#include +#include +#include #include "system.h" @@ -20,7 +21,9 @@ LOG_MODULE_REGISTER(test); static char mock_data[64] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@"; -static void test_bbram_get(void) +ZTEST_SUITE(system, NULL, NULL, NULL, NULL, NULL); + +ZTEST(system, test_bbram_get) { const struct device *const bbram_dev = DEVICE_DT_GET(DT_CHOSEN(cros_ec_bbram)); @@ -51,9 +54,3 @@ static void test_bbram_get(void) zassert_mem_equal(output, mock_data + BBRAM_REGION_OFF(try_slot), BBRAM_REGION_SIZE(try_slot), NULL); } - -void test_main(void) -{ - ztest_test_suite(system, ztest_unit_test(test_bbram_get)); - ztest_run_test_suite(system); -} -- cgit v1.2.1