This is my attempt to create a unit test template file for the GD32F330c-start and GD32F350g-start board and also a native option.
I started following the procedures from this tutorial: https://piolabs.com/blog/insights/unit-testing-part-1.html
I was able to get it to run properly. I then tried to incorporate the gd32F3x0 spl framework using the directions from this page https://docs.platformio.org/en/latest/tutorials/ststm32/stm32cube_debugging_unit_testing.html#tutorial-stm32cube-debugging-unit-testing
However, I am not able to compile and I get the following errors: Processing test_common in gd32350g_start environment -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Building & Uploading... Library Manager: Installing throwtheswitch/Unity @ ^2.5.2 Unpacking [####################################] 100% Library Manager: [email protected] has been installed! UnitTestSuiteError: Could not find Unity configuration for the spl framework. Learn how to create a custom Unity configuration athttps://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/unity.html:
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiobuildermain.py", line 187:
- env.SConscript("$BUILD_SCRIPT")
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsScriptSConscript.py", line 597:
- return _SConscript(self.fs, *files, **subst_kw)
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsScriptSConscript.py", line 285:
- exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
- File "C:Userskwong.platformioplatformsgd32buildermain.py", line 128:
- target_elf = env.BuildProgram()
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsUtil.py", line 737:
- return self.method(*nargs, **kwargs)
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiobuildertoolspiobuild.py", line 61:
- env.ProcessProjectDeps()
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsUtil.py", line 737:
- return self.method(*nargs, **kwargs)
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiobuildertoolspiobuild.py", line 137:
- plb = env.ConfigureProjectLibBuilder()
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsUtil.py", line 737:
- return self.method(*nargs, **kwargs)
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiobuildertoolspiolib.py", line 1166:
- project.env.ConfigureTestTarget()
- File "C:Userskwong.platformiopackagestool-sconsscons-local-4.4.0SConsUtil.py", line 737:
- return self.method(*nargs, **kwargs)
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiobuildertoolspiotest.py", line 53:
- test_runner.configure_build_env(env)
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiotestrunnersunity.py", line 225:
- self.generate_unity_extras(env.subst("$UNITY_CONFIG_DIR"))
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiotestrunnersunity.py", line 255:
- framework_config = self.get_unity_framework_config()
- File "C:Userskwong.platformiopenvlibsite-packagesplatformiotestrunnersunity.py", line 209:
- raise UnitTestSuiteError(
Uploading stage has failed, see errors above. Use pio test -vvv option to enable verbose output. ------------------------------------------------------------------------------------------------------ gd32350g_start:test_common [ERRORED] Took 4.90 seconds ------------------------------------------------------------------------------------------------------
Building & Uploading... testtest_embeddedunity_config.c: In function 'unityOutputStart': testtest_embeddedunity_config.c:37:34: error: 'UART_TX_AF' undeclared (first use in this function)
- 37 | gpio_af_set(UART_TX_RX_GPIO, UART_TX_AF, UART_TX_GPIO_PIN);
^~~~~~~~~~
testtest_embeddedunity_config.c:37:34: note: each undeclared identifier is reported only once for each function it appears in testtest_embeddedunity_config.c:38:34: error: 'UART_RX_AF' undeclared (first use in this function)
- 38 | gpio_af_set(UART_TX_RX_GPIO, UART_RX_AF, UART_RX_GPIO_PIN);
^~~~~~~~~~
*** [.piobuildgd32350g_starttesttest_embeddedunity_config.o] Error 1 Uploading stage has failed, see errors above. Use pio test -vvv option to enable verbose output. ----------------------------------------------------------------------------------------------------- gd32350g_start:test_embedded [ERRORED] Took 4.31 seconds -----------------------------------------------------------------------------------------------------
============================================================================================================================= SUMMARY ============================================================================================================================= Environment Test Status Duration -------------- ------------- -------- ------------ gd32350g_start test_common ERRORED 00:00:04.903 gd32350g_start test_embedded ERRORED 00:00:04.305 ============================================================================================================ 2 test cases: 0 succeeded in 00:00:09.209 ============================================================================================================
- The terminal process "C:Userskwong.platformiopenvScriptsplatformio.exe 'test', '--environment', 'gd32350g_start'" terminated with exit code: 1.
- Terminal will be reused by tasks, press any key to close it.