From 79b2bfdefe12917c9445b743363338257c66ae29 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 May 2022 15:34:50 +0300 Subject: [PATCH] Fix an issue with multiple symbol definitions when framework uses own Unity // Resolve #4259 --- platformio/builder/tools/piotest.py | 6 +++--- platformio/test/runners/unity.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio/builder/tools/piotest.py b/platformio/builder/tools/piotest.py index 0ebe7637..08d475d2 100644 --- a/platformio/builder/tools/piotest.py +++ b/platformio/builder/tools/piotest.py @@ -26,6 +26,7 @@ def ConfigureTestTarget(env): CPPDEFINES=["UNIT_TEST", "PIO_UNIT_TESTING"], PIOTEST_SRC_FILTER=[f"+<*.{ext}>" for ext in piotool.SRC_BUILD_EXT], ) + env.Prepend(CPPPATH=["$PROJECT_TEST_DIR"]) if "PIOTEST_RUNNING_NAME" in env: test_name = env["PIOTEST_RUNNING_NAME"] @@ -34,7 +35,7 @@ def ConfigureTestTarget(env): # skip nested tests (user's side issue?) if not test_name or os.path.basename(test_name).startswith("test_"): break - env.Append( + env.Prepend( PIOTEST_SRC_FILTER=[ f"+<{test_name}{os.path.sep}*.{ext}>" for ext in piotool.SRC_BUILD_EXT @@ -42,12 +43,11 @@ def ConfigureTestTarget(env): CPPPATH=[os.path.join("$PROJECT_TEST_DIR", test_name)], ) - env.Append( + env.Prepend( PIOTEST_SRC_FILTER=[f"+<$PIOTEST_RUNNING_NAME{os.path.sep}>"], CPPPATH=[os.path.join("$PROJECT_TEST_DIR", "$PIOTEST_RUNNING_NAME")], ) - env.Append(CPPPATH=["$PROJECT_TEST_DIR"]) test_runner = TestRunnerFactory.new( TestSuite(env["PIOENV"], env.get("PIOTEST_RUNNING_NAME", "*")), env.GetProjectConfig(), diff --git a/platformio/test/runners/unity.py b/platformio/test/runners/unity.py index 299dd3ea..6e0eae5a 100644 --- a/platformio/test/runners/unity.py +++ b/platformio/test/runners/unity.py @@ -216,7 +216,7 @@ void unityOutputComplete(void) { unittest_uart_end(); } UNITY_CONFIG_DIR=os.path.join("$BUILD_DIR", "unity_config"), BUILD_UNITY_CONFIG_DIR=os.path.join("$BUILD_DIR", "unity_config_build"), ) - env.Append(CPPPATH=["$UNITY_CONFIG_DIR"]) + env.Prepend(CPPPATH=["$UNITY_CONFIG_DIR"]) self.generate_unity_extras(env.subst("$UNITY_CONFIG_DIR")) env.BuildSources("$BUILD_UNITY_CONFIG_DIR", "$UNITY_CONFIG_DIR") return env