added unittest for strip pName/vendor and minor changes#236
added unittest for strip pName/vendor and minor changes#236
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive unit tests for STM32CubeMX generator functionality, specifically testing the parsing and handling of vendor::project::pName combinations in device specifications. The tests validate the device name extraction logic that strips vendor prefixes and handles various device naming patterns.
- Added extensive unit test coverage for WriteProjectFile function
- Updated test data files with generated STM32F2 project configurations
- Minor code improvements including error handling and comment clarifications
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/stm32CubeMX/stm32CubeMX_test.go | Added comprehensive unit tests for WriteProjectFile function with multiple device naming scenarios |
| testdata/testExamples/STM32F2/* | Added complete STM32F2 test project files including CBUILD configurations and device definitions |
| testdata/stm32cubemx/cfg/MX_Device.h | Added MX_Device.h template file for test data |
| internal/common/common.go | Added missing error return in ReadYml function |
| internal/readFile/readFile.go | Added clarifying comments for file type detection |
| vcpkg-configuration.json | Added vcpkg configuration for ARM toolchain dependencies |
| testdata/testExamples/STM32H7_SC/STM32CubeMX/device/MX_Device/MX_Device.h | Updated timestamp in generated file header |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Diff Coverage: The code coverage on the diff in this pull request is 0.0%. Total Coverage: This PR will increase coverage by 1.68%. File Coverage Changes
🛟 Help
|
jkrech
left a comment
There was a problem hiding this comment.
I do not understand what the new files are required for, except vcpkg-configuration.json as they are all generated when calling cbuild setup. Afterwards the launch of the generator will generate the *.cbuild-gen-idx.yml and *.cbuild-gen.yml files which contain the information to be used by cbridge.
|
I also do not know why all these testdata/.../tmp directories and files exist in github. But they are in since long time and I didn't dare to remove them. Maybe @DavidLesnjak knows more about them. |
…ubeMX.Debug+STM32F217IGHx.cbuild.yml Depending on the call the tests require the generator variants of cbuild-idx and cbuild from the tmp directory but not the ones from out.
|
The reason the In other words: rather than synthetic minimal inputs, we purposely used actual CubeMX project exports so the test environment more closely mimics what users will see in practice. I fully agree that the testExample could likely be cleaned up: we should keep only the necessary files (i.e., the minimal files needed by the generator to parse and generate the output), rather than the full example tree. |
Fixes
#226
Changes
Checklist