forked from nrfconnect/sdk-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: cmake: overlays: Add soc_folder_overlay test
Adds a testcase for the new ``socs`` folder, with overlays Signed-off-by: Jamie McCrae <[email protected]>
- Loading branch information
1 parent
1ed6d89
commit da3007e
Showing
14 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(overlays_soc_folder_overlay) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_APP | ||
bool | ||
default "$(dt_alias_enabled,test-app)" | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_BOARD | ||
bool | ||
default "$(dt_alias_enabled,test-board)" | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX | ||
bool | ||
default "$(dt_alias_enabled,test-board-suffix)" | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS | ||
bool | ||
default "$(dt_alias_enabled,test-board-qualifiers)" | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_SOC | ||
bool | ||
default "$(dt_alias_enabled,test-soc)" | ||
|
||
config SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX | ||
bool | ||
default "$(dt_alias_enabled,test-soc-suffix)" | ||
|
||
config TEST_TYPE | ||
int "Test type" | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-app = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-board = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-board-qualifiers = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-board-suffix = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-board-suffix = &uart0; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONFIG_ZTEST=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-soc = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-soc = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-soc-suffix = &uart0; | ||
}; | ||
}; |
5 changes: 5 additions & 0 deletions
5
tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/ { | ||
aliases { | ||
test-soc-suffix = &uart0; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/ztest.h> | ||
|
||
#ifndef CONFIG_TEST_TYPE | ||
#error "Invalid test configuration" | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_APP | ||
#define INCLUDED_APP 1 | ||
#else | ||
#define INCLUDED_APP 0 | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD | ||
#define INCLUDED_BOARD 1 | ||
#else | ||
#define INCLUDED_BOARD 0 | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX | ||
#define INCLUDED_BOARD_SUFFIX 1 | ||
#else | ||
#define INCLUDED_BOARD_SUFFIX 0 | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS | ||
#define INCLUDED_BOARD_QUALIFIERS 1 | ||
#else | ||
#define INCLUDED_BOARD_QUALIFIERS 0 | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC | ||
#define INCLUDED_SOC 1 | ||
#else | ||
#define INCLUDED_SOC 0 | ||
#endif | ||
|
||
#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX | ||
#define INCLUDED_SOC_SUFFIX 1 | ||
#else | ||
#define INCLUDED_SOC_SUFFIX 0 | ||
#endif | ||
|
||
#if CONFIG_TEST_TYPE == 0 | ||
/* Default test */ | ||
ZTEST(soc_folder_overlay, test_default) | ||
{ | ||
zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); | ||
zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); | ||
|
||
#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 | ||
zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); | ||
zassert_true(INCLUDED_BOARD_QUALIFIERS, "Expected board qualifier overlay to be present"); | ||
#else | ||
zassert_true(INCLUDED_BOARD, "Expected board overlay to be present"); | ||
zassert_false(INCLUDED_BOARD_QUALIFIERS, | ||
"Did not expect board qualifier overlay to be present"); | ||
#endif | ||
|
||
zassert_true(INCLUDED_SOC, "Expect soc overlay to be present"); | ||
zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix overlay to be present"); | ||
} | ||
#elif CONFIG_TEST_TYPE == 1 | ||
/* File suffix test */ | ||
ZTEST(soc_folder_overlay, test_suffix) | ||
{ | ||
zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); | ||
zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix overlay to be present"); | ||
zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); | ||
zassert_false(INCLUDED_BOARD_QUALIFIERS, | ||
"Did not expect board qualifier overlay to be present"); | ||
zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); | ||
zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix overlay to be present"); | ||
} | ||
#elif CONFIG_TEST_TYPE == 2 | ||
/* App overlay test */ | ||
ZTEST(soc_folder_overlay, test_app) | ||
{ | ||
zassert_true(INCLUDED_APP, "Expected app overlay to be present"); | ||
zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); | ||
zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); | ||
zassert_false(INCLUDED_BOARD_QUALIFIERS, | ||
"Did not expect board qualifier overlay to be present"); | ||
zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); | ||
zassert_false(INCLUDED_SOC_SUFFIX, "Did not epect soc suffix overlay to be present"); | ||
} | ||
#else | ||
#error "Invalid test type" | ||
#endif | ||
|
||
ZTEST_SUITE(soc_folder_overlay, NULL, NULL, NULL, NULL, NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
common: | ||
tags: | ||
- cmake | ||
tests: | ||
cmake.overlays.soc_folder_overlay.default: | ||
platform_allow: | ||
- native_sim | ||
- native_sim/native/64 | ||
integration_platforms: | ||
- native_sim | ||
- native_sim/native/64 | ||
extra_args: | ||
- CONFIG_TEST_TYPE=0 | ||
cmake.overlays.soc_folder_overlay.suffix: | ||
platform_allow: | ||
- native_sim | ||
- native_sim/native/64 | ||
integration_platforms: | ||
- native_sim | ||
- native_sim/native/64 | ||
extra_args: | ||
- CONFIG_TEST_TYPE=1 | ||
- FILE_SUFFIX=somesuffix | ||
cmake.overlays.soc_folder_overlay.app: | ||
platform_allow: | ||
- qemu_cortex_m3 | ||
integration_platforms: | ||
- qemu_cortex_m3 | ||
extra_args: | ||
- CONFIG_TEST_TYPE=2 |