diff options
Diffstat (limited to 'zephyr/test/system')
-rw-r--r-- | zephyr/test/system/CMakeLists.txt | 10 | ||||
-rw-r--r-- | zephyr/test/system/overlay.dts | 34 | ||||
-rw-r--r-- | zephyr/test/system/prj.conf | 4 | ||||
-rw-r--r-- | zephyr/test/system/test_system.c | 76 | ||||
-rw-r--r-- | zephyr/test/system/zmake.yaml | 14 |
5 files changed, 0 insertions, 138 deletions
diff --git a/zephyr/test/system/CMakeLists.txt b/zephyr/test/system/CMakeLists.txt deleted file mode 100644 index f91786841e..0000000000 --- a/zephyr/test/system/CMakeLists.txt +++ /dev/null @@ -1,10 +0,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) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(system_test) - -target_sources(app PRIVATE test_system.c - ${PLATFORM_EC}/zephyr/shim/src/system.c) diff --git a/zephyr/test/system/overlay.dts b/zephyr/test/system/overlay.dts deleted file mode 100644 index 37bac97680..0000000000 --- a/zephyr/test/system/overlay.dts +++ /dev/null @@ -1,34 +0,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. - */ - -/ { - named-bbram-regions { - compatible = "named-bbram-regions"; - pd0 { - offset = <0x00>; - size = <0x01>; - }; - pd1 { - offset = <0x01>; - size = <0x02>; - }; - try_slot { - offset = <0x03>; - size = <0x04>; - }; - pd2 { - offset = <0x07>; - size = <0x05>; - }; - scratchpad { - offset = <0x0c>; - size = <0x04>; - }; - saved-reset-flags { - offset = <0x10>; - size = <0x04>; - }; - }; -}; diff --git a/zephyr/test/system/prj.conf b/zephyr/test/system/prj.conf deleted file mode 100644 index 03357fa10f..0000000000 --- a/zephyr/test/system/prj.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_ZTEST=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 deleted file mode 100644 index e8eba44fc8..0000000000 --- a/zephyr/test/system/test_system.c +++ /dev/null @@ -1,76 +0,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. - */ - -#include <device.h> -#include <drivers/bbram.h> -#include <logging/log.h> -#include <ztest.h> - -#include "bbram.h" -#include "system.h" - -LOG_MODULE_REGISTER(test); - -#define BBRAM_REGION_OFF(name) \ - DT_PROP(DT_PATH(named_bbram_regions, name), offset) -#define BBRAM_REGION_SIZE(name) \ - DT_PROP(DT_PATH(named_bbram_regions, name), size) - -static char mock_data[64] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@"; - -static int mock_bbram_read(const struct device *unused, size_t offset, - size_t size, uint8_t *data) -{ - if (offset < 0 || offset + size >= ARRAY_SIZE(mock_data)) - return -1; - memcpy(data, mock_data + offset, size); - return EC_SUCCESS; -} - -static const struct bbram_driver_api bbram_api = { - .read = mock_bbram_read, -}; - -static const struct device bbram_dev_instance = { - .name = "TEST_BBRAM_DEV", - .config = NULL, - .api = &bbram_api, - .data = NULL, -}; - -const struct device *bbram_dev = &bbram_dev_instance; - -static void test_bbram_get(void) -{ - uint8_t output[10]; - int rc; - - rc = system_get_bbram(SYSTEM_BBRAM_IDX_PD0, output); - zassert_equal(rc, 0, NULL); - zassert_mem_equal(output, mock_data + BBRAM_REGION_OFF(pd0), - BBRAM_REGION_SIZE(pd0), NULL); - - rc = system_get_bbram(SYSTEM_BBRAM_IDX_PD1, output); - zassert_equal(rc, 0, NULL); - zassert_mem_equal(output, mock_data + BBRAM_REGION_OFF(pd1), - BBRAM_REGION_SIZE(pd1), NULL); - - rc = system_get_bbram(SYSTEM_BBRAM_IDX_PD2, output); - zassert_equal(rc, 0, NULL); - zassert_mem_equal(output, mock_data + BBRAM_REGION_OFF(pd2), - BBRAM_REGION_SIZE(pd2), NULL); - - rc = system_get_bbram(SYSTEM_BBRAM_IDX_TRY_SLOT, output); - zassert_equal(rc, 0, NULL); - 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); -} diff --git a/zephyr/test/system/zmake.yaml b/zephyr/test/system/zmake.yaml deleted file mode 100644 index c3fca2272e..0000000000 --- a/zephyr/test/system/zmake.yaml +++ /dev/null @@ -1,14 +0,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. - -board: native_posix -supported-zephyr-versions: - - v2.6 -output-type: elf -supported-toolchains: - - llvm - - host -is-test: true -dts-overlays: - - overlay.dts |