diff options
author | mparuchuri <mparuchuri@google.com> | 2022-10-03 09:43:46 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-06 05:30:19 +0000 |
commit | c374893e0cef15cb3689026a719526e248ef03f3 (patch) | |
tree | c4f67fc455884d957f5d29be83c1303237e9322c | |
parent | a0d947fb5597ac0a6fd39c4cfcd393466daba130 (diff) | |
download | chrome-ec-c374893e0cef15cb3689026a719526e248ef03f3.tar.gz |
rex: zephyr: test: Setup unit test environment
BUG=b:247796816
BRANCH=None
TEST=./twister -T zephyr/test/rex --clobber
Signed-off-by: mparuchuri <mparuchuri@google.com>
Change-Id: I9451056c8707f3e7d9c3d6d0f9f7aa5a94a576d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3931332
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
-rw-r--r-- | zephyr/test/rex/CMakeLists.txt | 11 | ||||
-rw-r--r-- | zephyr/test/rex/Kconfig | 6 | ||||
-rw-r--r-- | zephyr/test/rex/README.md | 3 | ||||
-rw-r--r-- | zephyr/test/rex/boards/native_posix.overlay | 6 | ||||
-rw-r--r-- | zephyr/test/rex/prj.conf | 11 | ||||
-rw-r--r-- | zephyr/test/rex/src/test.c | 13 | ||||
-rw-r--r-- | zephyr/test/rex/testcase.yaml | 8 |
7 files changed, 58 insertions, 0 deletions
diff --git a/zephyr/test/rex/CMakeLists.txt b/zephyr/test/rex/CMakeLists.txt new file mode 100644 index 0000000000..603fcea8f9 --- /dev/null +++ b/zephyr/test/rex/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright 2022 The ChromiumOS Authors. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +cmake_minimum_required(VERSION 3.13.1) +find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}") +project(rex) + +zephyr_include_directories("${PLATFORM_EC}/zephyr/projects/rex/include") + +target_sources(app PRIVATE src/test.c) diff --git a/zephyr/test/rex/Kconfig b/zephyr/test/rex/Kconfig new file mode 100644 index 0000000000..47d2fbe02e --- /dev/null +++ b/zephyr/test/rex/Kconfig @@ -0,0 +1,6 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +source "Kconfig.zephyr" diff --git a/zephyr/test/rex/README.md b/zephyr/test/rex/README.md new file mode 100644 index 0000000000..ef1848a627 --- /dev/null +++ b/zephyr/test/rex/README.md @@ -0,0 +1,3 @@ +Tests for board specific code under `zephyr/projects/rex/src`. + +Run with ./twister -T zephyr/test/rex diff --git a/zephyr/test/rex/boards/native_posix.overlay b/zephyr/test/rex/boards/native_posix.overlay new file mode 100644 index 0000000000..b27b199a12 --- /dev/null +++ b/zephyr/test/rex/boards/native_posix.overlay @@ -0,0 +1,6 @@ +/* Copyright 2022 The ChromiumOS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <board-overlays/native_posix.dts> diff --git a/zephyr/test/rex/prj.conf b/zephyr/test/rex/prj.conf new file mode 100644 index 0000000000..89165e36a8 --- /dev/null +++ b/zephyr/test/rex/prj.conf @@ -0,0 +1,11 @@ +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +CONFIG_ZTEST=y +CONFIG_ZTEST_ASSERT_VERBOSE=1 +CONFIG_ZTEST_NEW_API=y +CONFIG_ASSERT=y + +CONFIG_CROS_EC=y +CONFIG_PLATFORM_EC=y diff --git a/zephyr/test/rex/src/test.c b/zephyr/test/rex/src/test.c new file mode 100644 index 0000000000..d86825e74a --- /dev/null +++ b/zephyr/test/rex/src/test.c @@ -0,0 +1,13 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <zephyr/ztest.h> + +ZTEST_USER(board_power, test_test) +{ + zassert_true(true, NULL, NULL); +} + +ZTEST_SUITE(board_power, NULL, NULL, NULL, NULL, NULL); diff --git a/zephyr/test/rex/testcase.yaml b/zephyr/test/rex/testcase.yaml new file mode 100644 index 0000000000..025fe907ee --- /dev/null +++ b/zephyr/test/rex/testcase.yaml @@ -0,0 +1,8 @@ +# Copyright 2022 The ChromiumOS Authors. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +common: + platform_allow: native_posix +tests: + rex.default: {} |