diff options
author | Paul Fagerburg <pfagerburg@google.com> | 2021-01-22 16:59:50 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-25 20:55:46 +0000 |
commit | bfc29b475e280e442fed7a234d1b381f0dd70ec6 (patch) | |
tree | e11249eb078a33af31e4bfcca2554f21c35e330d /zephyr/test | |
parent | 0f7a6d893cd3ae751a587d763e8d01394b69255e (diff) | |
download | chrome-ec-bfc29b475e280e442fed7a234d1b381f0dd70ec6.tar.gz |
zephyr: test: update unit tests for zmake
Many of the options in CMakeLists.txt and prj.conf are no longer
necessary with zmake and Kconfig handling them automatically now.
BUG=b:178220157
BRANCH=none
TEST=`zmake testall`
Signed-off-by: Paul Fagerburg <pfagerburg@google.com>
Change-Id: I845f42c4b51214f28ab7771734232fec763c04f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645696
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/test')
-rw-r--r-- | zephyr/test/accel_cal/prj.conf | 16 | ||||
-rw-r--r-- | zephyr/test/base32/CMakeLists.txt | 20 | ||||
-rw-r--r-- | zephyr/test/base32/prj.conf | 2 | ||||
-rw-r--r-- | zephyr/test/crc/CMakeLists.txt | 9 | ||||
-rw-r--r-- | zephyr/test/crc/prj.conf | 2 | ||||
-rw-r--r-- | zephyr/test/hooks/CMakeLists.txt | 20 | ||||
-rw-r--r-- | zephyr/test/hooks/prj.conf | 3 | ||||
-rw-r--r-- | zephyr/test/i2c/CMakeLists.txt | 30 | ||||
-rw-r--r-- | zephyr/test/i2c/prj.conf | 4 | ||||
-rw-r--r-- | zephyr/test/i2c/src/main.c | 3 | ||||
-rw-r--r-- | zephyr/test/i2c_dts/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/test/system/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/test/system/prj.conf | 18 | ||||
-rw-r--r-- | zephyr/test/tasks/CMakeLists.txt | 24 | ||||
-rw-r--r-- | zephyr/test/tasks/prj.conf | 3 |
15 files changed, 27 insertions, 131 deletions
diff --git a/zephyr/test/accel_cal/prj.conf b/zephyr/test/accel_cal/prj.conf index 648eb63dd7..5efe3ec6b7 100644 --- a/zephyr/test/accel_cal/prj.conf +++ b/zephyr/test/accel_cal/prj.conf @@ -4,21 +4,5 @@ CONFIG_ZTEST=y CONFIG_HAS_TEST_TASKS=y -CONFIG_POLL=y - CONFIG_PLATFORM_EC=y -CONFIG_PLATFORM_EC_I2C=n -CONFIG_PLATFORM_EC_KEYBOARD=n -CONFIG_PLATFORM_EC_HOSTCMD=n -CONFIG_PLATFORM_EC_TIMER=n - CONFIG_CROS_EC=y -# Define necessary program memory locations. These are meaning less though -CONFIG_CROS_EC_PROGRAM_MEMORY_BASE=0x10090000 -CONFIG_CROS_EC_RAM_BASE=0x200c0000 -CONFIG_CROS_EC_DATA_RAM_SIZE=0x00010000 -CONFIG_CROS_EC_RAM_SIZE=0x0000f800 -CONFIG_CROS_EC_RO_MEM_OFF=0x0 -CONFIG_CROS_EC_RO_SIZE=0xb000 -CONFIG_CROS_EC_RW_MEM_OFF=0xb000 -CONFIG_CROS_EC_RW_SIZE=0x75000 diff --git a/zephyr/test/base32/CMakeLists.txt b/zephyr/test/base32/CMakeLists.txt index 6ae6f232a9..674ad0d244 100644 --- a/zephyr/test/base32/CMakeLists.txt +++ b/zephyr/test/base32/CMakeLists.txt @@ -1,23 +1,9 @@ -# SPDX-License-Identifier: Apache-2.0 +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# 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) -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base32) -# Need to ensure that we are including only zephyr definitions in include files -# We cannot set these via kconfig, since this unit test does not bring in the -# zephyr-chrome repository -zephyr_compile_definitions("CONFIG_ZEPHYR") - -# We need to include the EC include directory and this local test directory -# for the task defines -zephyr_include_directories( - "${PLATFORM_EC}/zephyr/shim/include" - "${PLATFORM_EC}/fuzz" - "${PLATFORM_EC}/test" - "${PLATFORM_EC}/include") - -# Include test file, test under test and console dependency target_sources(app PRIVATE "${PLATFORM_EC}/test/base32.c") -target_sources(app PRIVATE "${PLATFORM_EC}/common/base32.c") diff --git a/zephyr/test/base32/prj.conf b/zephyr/test/base32/prj.conf index 3940ec99eb..ec8c5035f5 100644 --- a/zephyr/test/base32/prj.conf +++ b/zephyr/test/base32/prj.conf @@ -3,3 +3,5 @@ # found in the LICENSE file. CONFIG_ZTEST=y +CONFIG_PLATFORM_EC=y +CONFIG_CROS_EC=y diff --git a/zephyr/test/crc/CMakeLists.txt b/zephyr/test/crc/CMakeLists.txt index 8c1a38b56a..0b46729578 100644 --- a/zephyr/test/crc/CMakeLists.txt +++ b/zephyr/test/crc/CMakeLists.txt @@ -1,17 +1,10 @@ # Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.13.1) -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(tasks) - -# We need to include the EC include directory and this local test directory -# for the task defines -zephyr_include_directories("${PLATFORM_EC}/include") +project(crc) # Include the test source and the file under test target_sources(app PRIVATE main.c) -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/crc.c") diff --git a/zephyr/test/crc/prj.conf b/zephyr/test/crc/prj.conf index 3940ec99eb..ec8c5035f5 100644 --- a/zephyr/test/crc/prj.conf +++ b/zephyr/test/crc/prj.conf @@ -3,3 +3,5 @@ # found in the LICENSE file. CONFIG_ZTEST=y +CONFIG_PLATFORM_EC=y +CONFIG_CROS_EC=y diff --git a/zephyr/test/hooks/CMakeLists.txt b/zephyr/test/hooks/CMakeLists.txt index 2236963762..81ff57d69d 100644 --- a/zephyr/test/hooks/CMakeLists.txt +++ b/zephyr/test/hooks/CMakeLists.txt @@ -3,27 +3,7 @@ # found in the LICENSE file. cmake_minimum_required(VERSION 3.13.1) -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hooks) -# Need to ensure that we are including only zephyr definitions in include files -# We cannot set these via kconfig, since this unit test does not bring in the -# zephyr-chrome repository -zephyr_compile_definitions("CONFIG_ZEPHYR") -zephyr_compile_definitions("CONFIG_PLATFORM_EC_HOOKS") - -# We need to include the EC include directory and this local test directory -# for the task defines -zephyr_include_directories( - "${PLATFORM_EC}/zephyr/shim/include" - "${PLATFORM_EC}/fuzz" - "${PLATFORM_EC}/test" - "${PLATFORM_EC}/include") - -# Include test file, test under test and console dependency target_sources(app PRIVATE hooks.c) -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../common/printf.c") -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/hooks.c") -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/console.c") -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/util.c") diff --git a/zephyr/test/hooks/prj.conf b/zephyr/test/hooks/prj.conf index 3940ec99eb..c0c02e22ca 100644 --- a/zephyr/test/hooks/prj.conf +++ b/zephyr/test/hooks/prj.conf @@ -3,3 +3,6 @@ # found in the LICENSE file. CONFIG_ZTEST=y +CONFIG_PLATFORM_EC=y +CONFIG_PLATFORM_EC_HOOKS=y +CONFIG_CROS_EC=y diff --git a/zephyr/test/i2c/CMakeLists.txt b/zephyr/test/i2c/CMakeLists.txt index 4edbfb9006..214177013f 100644 --- a/zephyr/test/i2c/CMakeLists.txt +++ b/zephyr/test/i2c/CMakeLists.txt @@ -1,29 +1,9 @@ -# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 The Chromium OS Authors. All rights reserved. +# 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) -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(base32) +project(i2c) -# Need to ensure that we are including only zephyr definitions in include files -# We cannot set these via kconfig, since this unit test does not bring in the -# zephyr-chrome repository -zephyr_compile_definitions("CONFIG_ZEPHYR") -zephyr_compile_definitions("CONFIG_PLATFORM_EC_I2C") - -# We need to include the EC include directory and this local test directory -# for the task defines -zephyr_include_directories( - "${PLATFORM_EC}/zephyr/shim/include" - "${PLATFORM_EC}/fuzz" - "${PLATFORM_EC}/test" - "${PLATFORM_EC}/include") - -# Include test file, test under test and console dependency -target_sources(app PRIVATE - src/main.c - "${PLATFORM_EC}/zephyr/shim/src/console.c" - "${PLATFORM_EC}/zephyr/shim/src/i2c.c" - "${PLATFORM_EC}/zephyr/shim/src/util.c" - "${PLATFORM_EC}/common/i2c_controller.c" - "${PLATFORM_EC}/common/printf.c") +target_sources(app PRIVATE src/main.c) diff --git a/zephyr/test/i2c/prj.conf b/zephyr/test/i2c/prj.conf index bbf4d93e8e..8023c0492b 100644 --- a/zephyr/test/i2c/prj.conf +++ b/zephyr/test/i2c/prj.conf @@ -13,6 +13,10 @@ CONFIG_EMUL_BMI160=y CONFIG_SENSOR=y CONFIG_BMI160_TRIGGER_NONE=y +CONFIG_PLATFORM_EC=y +CONFIG_PLATFORM_EC_I2C=y +CONFIG_CROS_EC=y + # TODO(b/173711210) figure out why SPI is required here when we're not using it. CONFIG_SPI=y CONFIG_SPI_EMUL=y diff --git a/zephyr/test/i2c/src/main.c b/zephyr/test/i2c/src/main.c index 6a6afe19fe..064ce78816 100644 --- a/zephyr/test/i2c/src/main.c +++ b/zephyr/test/i2c/src/main.c @@ -10,9 +10,6 @@ #include "i2c/i2c.h" /* Unused: required for shimming i2c. */ -uint32_t sleep_mask; - -/* Unused: required for shimming i2c. */ void watchdog_reload(void) { } diff --git a/zephyr/test/i2c_dts/CMakeLists.txt b/zephyr/test/i2c_dts/CMakeLists.txt index 1537267349..eea2834af1 100644 --- a/zephyr/test/i2c_dts/CMakeLists.txt +++ b/zephyr/test/i2c_dts/CMakeLists.txt @@ -3,8 +3,6 @@ # found in the LICENSE file. cmake_minimum_required(VERSION 3.13.1) -set(BOARD native_posix) - find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(i2c_test) diff --git a/zephyr/test/system/CMakeLists.txt b/zephyr/test/system/CMakeLists.txt index dda6be4a4b..2afa9d6301 100644 --- a/zephyr/test/system/CMakeLists.txt +++ b/zephyr/test/system/CMakeLists.txt @@ -3,8 +3,6 @@ # found in the LICENSE file. cmake_minimum_required(VERSION 3.13.1) - -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(system_test) diff --git a/zephyr/test/system/prj.conf b/zephyr/test/system/prj.conf index bcaca677c5..03357fa10f 100644 --- a/zephyr/test/system/prj.conf +++ b/zephyr/test/system/prj.conf @@ -1,22 +1,4 @@ CONFIG_ZTEST=y CONFIG_PLATFORM_EC=y -CONFIG_PLATFORM_EC_I2C=n CONFIG_CROS_EC=y CONFIG_LOG=y - -# Disable all other shimmed code. -CONFIG_SHIMMED_TASKS=n -CONFIG_PLATFORM_EC_I2C=n -CONFIG_PLATFORM_EC_KEYBOARD=n -CONFIG_PLATFORM_EC_HOSTCMD=n -CONFIG_PLATFORM_EC_TIMER=n - -CONFIG_CROS_EC_PROGRAM_MEMORY_BASE=0x10090000 -CONFIG_CROS_EC_RAM_BASE=0x200c0000 -CONFIG_CROS_EC_DATA_RAM_SIZE=0x00010000 -CONFIG_CROS_EC_RAM_SIZE=0x0000f800 - -CONFIG_CROS_EC_RO_MEM_OFF=0x0 -CONFIG_CROS_EC_RO_SIZE=0xb000 -CONFIG_CROS_EC_RW_MEM_OFF=0xb000 -CONFIG_CROS_EC_RW_SIZE=0x75000 diff --git a/zephyr/test/tasks/CMakeLists.txt b/zephyr/test/tasks/CMakeLists.txt index 174d3b6428..f5ea76e67e 100644 --- a/zephyr/test/tasks/CMakeLists.txt +++ b/zephyr/test/tasks/CMakeLists.txt @@ -1,28 +1,14 @@ # Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.13.1) -set(BOARD native_posix) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(tasks) -# Need to ensure that we are including only zephyr definitions in include files -# We cannot set these via kconfig, since this unit test does not bring in the -# zephyr-chrome repository -zephyr_compile_definitions("CONFIG_ZEPHYR") -zephyr_compile_definitions("CONFIG_SHIMMED_TASKS") +# Include the local test directory for shimmed_test_tasks.h +zephyr_include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -# We need to include the EC include directory and this local test directory -# for the task defines -zephyr_include_directories( - "${CMAKE_CURRENT_SOURCE_DIR}" - "${PLATFORM_EC}/zephyr/shim/include" - "${PLATFORM_EC}/fuzz" - "${PLATFORM_EC}/test" - "${PLATFORM_EC}/include") - -# Include the test source and the file under test -target_sources(app PRIVATE main.c) -target_sources(app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/tasks.c") +target_sources(app PRIVATE + main.c + "${CMAKE_CURRENT_SOURCE_DIR}/../../shim/src/tasks.c")
\ No newline at end of file diff --git a/zephyr/test/tasks/prj.conf b/zephyr/test/tasks/prj.conf index d2cdafda60..77e8ab9b0c 100644 --- a/zephyr/test/tasks/prj.conf +++ b/zephyr/test/tasks/prj.conf @@ -4,4 +4,5 @@ CONFIG_ZTEST=y CONFIG_HAS_TEST_TASKS=y -CONFIG_POLL=y +CONFIG_PLATFORM_EC=y +CONFIG_CROS_EC=y |