Skip to content

Commit 15b0038

Browse files
Jordan Yatescarlescufi
authored andcommitted
tests: cmake: snippets: test DTS_EXTRA_CPPFLAGS
Add tests for the `DTS_EXTRA_CPPFLAGS` append option in snippets. Signed-off-by: Jordan Yates <[email protected]>
1 parent fe498ad commit 15b0038

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

tests/cmake/snippets/snippets/foo/foo.overlay

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
/* This node will be deleted by the `bar` snippet if applied. */
66
added-by-foo {};
7+
8+
#ifdef CMAKE_DTS_CONFIGURE
9+
cmake-dts-configure {};
10+
#endif /* CMAKE_DTS_CONFIGURE */
711
};

tests/cmake/snippets/snippets/foo/snippet.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ name: foo
22
append:
33
EXTRA_CONF_FILE: foo.conf
44
EXTRA_DTC_OVERLAY_FILE: foo.overlay
5+
DTS_EXTRA_CPPFLAGS: -DCMAKE_DTS_CONFIGURE

tests/cmake/snippets/src/main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ ZTEST(snippet_tests, test_dtc_overlay)
128128
zassert(false, "Invalid test type");
129129
}
130130
}
131+
132+
ZTEST(snippet_tests, test_cmake_include)
133+
{
134+
if (IS_ENABLED(CONFIG_TEST_TYPE_FOO) ||
135+
IS_ENABLED(CONFIG_TEST_TYPE_FOO_BAR) ||
136+
IS_ENABLED(CONFIG_TEST_TYPE_BAR_FOO)) {
137+
zassert_true(DT_NODE_EXISTS(DT_PATH(cmake_dts_configure)));
138+
} else {
139+
zassert_false(DT_NODE_EXISTS(DT_PATH(cmake_dts_configure)));
140+
}
141+
}

0 commit comments

Comments
 (0)