Add some unit tests and refactor to support tests#326
Merged
Conversation
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
HarpPDX
reviewed
Apr 29, 2025
HarpPDX
reviewed
Apr 29, 2025
HarpPDX
reviewed
Apr 29, 2025
…sts for CPU list expansion Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Contributor
There was a problem hiding this comment.
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 <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Contributor
There was a problem hiding this comment.
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 <jason.m.harper@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.