summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2022-07-28 12:53:50 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-03 19:38:36 +0000
commite372db6463482ff5a9da7957c9b411a35cd3b33f (patch)
tree88a9f3ca4ba00863d2d1f32ddf802631fa9df136
parent84b96ab02b35d66d87f1bbf6a850a71267a018d1 (diff)
downloadchrome-ec-e372db6463482ff5a9da7957c9b411a35cd3b33f.tar.gz
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 <tm@semihalf.com> Change-Id: I1b4088bdd79191a8dc6c6c1ad20a5d6b4f17781d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3790851 Tested-by: Tristan Honscheid <honscheid@google.com> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Tristan Honscheid <honscheid@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r--zephyr/test/system/prj.conf1
-rw-r--r--zephyr/test/system/test_system.c13
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 <zephyr/device.h>
#include <zephyr/drivers/bbram.h>
#include <zephyr/logging/log.h>
-#include <ztest.h>
+#include <ztest_assert.h>
+#include <ztest_test_new.h>
#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);
-}