tests: cmake: snippets: test DTS_EXTRA_CPPFLAGS

Add tests for the `DTS_EXTRA_CPPFLAGS` append option in snippets.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2023-07-08 20:30:49 +10:00 committed by Carles Cufí
parent fe498ada60
commit 15b003877f
3 changed files with 16 additions and 0 deletions

View file

@ -4,4 +4,8 @@
/* This node will be deleted by the `bar` snippet if applied. */
added-by-foo {};
#ifdef CMAKE_DTS_CONFIGURE
cmake-dts-configure {};
#endif /* CMAKE_DTS_CONFIGURE */
};

View file

@ -2,3 +2,4 @@ name: foo
append:
EXTRA_CONF_FILE: foo.conf
EXTRA_DTC_OVERLAY_FILE: foo.overlay
DTS_EXTRA_CPPFLAGS: -DCMAKE_DTS_CONFIGURE

View file

@ -128,3 +128,14 @@ ZTEST(snippet_tests, test_dtc_overlay)
zassert(false, "Invalid test type");
}
}
ZTEST(snippet_tests, test_cmake_include)
{
if (IS_ENABLED(CONFIG_TEST_TYPE_FOO) ||
IS_ENABLED(CONFIG_TEST_TYPE_FOO_BAR) ||
IS_ENABLED(CONFIG_TEST_TYPE_BAR_FOO)) {
zassert_true(DT_NODE_EXISTS(DT_PATH(cmake_dts_configure)));
} else {
zassert_false(DT_NODE_EXISTS(DT_PATH(cmake_dts_configure)));
}
}