-
Notifications
You must be signed in to change notification settings - Fork 43
Add some unit tests and refactor to support tests #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
…sts for CPU list expansion Signed-off-by: Harper, Jason M <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces new unit tests for utility functions while refactoring hex‐string conversion and related helper methods to improve testability. Key changes include:
- Adding tests for IsValidHex, HexToIntList, IntRangeToIntList, and SelectiveIntRangeToIntList in internal/util/util_test.go.
- Refactoring hex conversion functions in internal/util/util.go and updating downstream callers in table_helpers.go and table_defs.go.
- Adding additional unit tests in target, report, and common directories to increase overall coverage.
Reviewed Changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/util/util_test.go | New tests for hex validation and conversion functions |
internal/util/util.go | Introduction of IsValidHex and HexToIntList functions for hex string handling |
internal/target/local_target_test.go | Added tests to verify GetUserPath behavior based on environment variables |
internal/report/table_helpers_test.go | Tests for getFrequenciesFromMSR, getBucketSizesFromMSR and expandTurboFrequencies functions |
internal/report/table_helpers_benchmarking.go | Removal of obsolete frequencyBucketsToFrequencies function |
internal/report/table_helpers.go | Refactoring to replace convertHexStringToDecimals with new helper functions and update ISA frequency expansion |
internal/report/table_defs.go | Updated to use the new expandTurboFrequencies helper |
internal/common/targets_test.go | Added tests for df field extraction and mount output parsing |
Files not reviewed (2)
- go.mod: Language not supported
- scripts/copyright_go.sh: Language not supported
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR “Add some unit tests and refactor to support tests” introduces new unit tests for hex‐string validations, range parsing and target methods while refactoring several utility and report helper functions. Key changes include:
- Adding new test cases for functions such as IsValidHex, HexToIntList, IntRangeToIntList, and SelectiveIntRangeToIntList.
- Refactoring util and report helper functions to use new helper methods like getFrequenciesFromHex and expandTurboFrequencies.
- Enhancing flag validations and target setup error messages.
Reviewed Changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/util/util_test.go | Added unit tests for hex validations and integer list conversion functions. |
internal/util/util.go | New implementations for IsValidHex, HexToIntList, IntRangeToIntList, etc. |
internal/report/table_helpers.go | Refactored functions for parsing and merging report sections and frequency buckets. |
internal/common/targets.go | Updated target temp directory creation and noexec file system check error messaging. |
cmd/telemetry/telemetry.go & cmd/lock/lock.go | Added additional flag validations (interval and frequency). |
cmd/config/* files | New flag definition and flag groups tests added for configuration command validation. |
Files not reviewed (2)
- go.mod: Language not supported
- scripts/copyright_go.sh: Language not supported
Signed-off-by: Harper, Jason M <[email protected]>
No description provided.