Export a "PIO_UNIT_TESTING" macro to the project source files and dependent libraries in the Unit Testing mode

This commit is contained in:
Ivan Kravets committed 2022-07-14 14:45:31 +03:00
1 parent 10ff4ae77a
commit 842679c32b
3 files changed
+6 -1

No files matched your search

+4
View File
@@ -145,6 +145,10 @@ class LibBuilderBase:
self._circular_deps = []
self._processed_search_files = []
# pass a macro to the projenv + libs
if "test" in env.GetBuildType():
self.env.Append(CPPDEFINES=["PIO_UNIT_TESTING"])
# reset source filter, could be overridden with extra script
self.env["SRC_FILTER"] = ""
+1 -1
View File
@@ -23,7 +23,7 @@ from platformio.test.runners.factory import TestRunnerFactory
def ConfigureTestTarget(env):
env.Append(
CPPDEFINES=["UNIT_TEST", "PIO_UNIT_TESTING"],
CPPDEFINES=["UNIT_TEST"], # deprecated, use PIO_UNIT_TESTING
PIOTEST_SRC_FILTER=[f"+<*.{ext}>" for ext in piotool.SRC_BUILD_EXT],
)
env.Prepend(CPPPATH=["$PROJECT_TEST_DIR"])