-
Notifications
You must be signed in to change notification settings - Fork 870
[cov] Add corner case unit tests for uncovered code #27652
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
Open
sasdf
wants to merge
10
commits into
lowRISC:earlgrey_1.0.0
Choose a base branch
from
sasdf:mgTe83c08b5
base: earlgrey_1.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Change-Id: I54d98cea81a3a55f84490a55109b1eee23c96785 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This commit adds a cc_library `dbg_print_unittest_variant`, which is a variant of the `dbg_print` library built with `DBG_PRINT_UNIT_TEST_` defined. The existing `dbg_print_unittest` is modified to depend on `dbg_print_unittest_variant` rather than directly including the source files. This change enables coverage to be collected for the `dbg_print` module in the unit tests, since test sources are by default uninstrumented. Change-Id: Ifd9cdc950a6ca92bf91e84b538426436d6ce20e1 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
Adds test cases for the `%p` format specifier in `dbg_print` unit tests, which were previously uncovered. Change-Id: I55ce3151f573b251910885342f493995bbe45f0c Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This commit adds two corner cases to cert unittest: - When the certificate is zeroed out, expect the decode size function to return 0. - When the buffer for `cert_x509_asn1_check_serial_number` is too small, expect `kErrorCertInvalidSize` and `kHardenedBoolFalse` to be returned. Change-Id: If99c3fb37c96b1bdfe3a43073d7824861e8426a0 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
Add a unittest for `alert_configure()` and `alert_local_configure()` with `kAlertEnableNone` option for uncovered code. Change-Id: I949004f9355c5b7f1ecde0f731a777af583afe05 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This change adds a unittest to verify that the flash controller init routine correctly applies the `FLASH_HW_INFO_CFG_OVERRIDE` OTP setting. It ensures that if this OTP setting is programmed to a non-zero value, the corresponding flash_ctrl register is updated accordingly. Change-Id: I691d417f9cc1b65d291c4d3888462820cd9764db Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This change adds two new corner cases for manifest checks in `manifest_unittest.cc`: - Checks for an invalid major version of the manifest. - Checks if the signed region extends outside the image boundary. Change-Id: I48ea1639e507ceac18e52e7d2ec4bcfc579fbb77 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This change adds two new tests to verify `isfb_info_flash_erase_policy_get()`. The first test `ErasePolicyOwnershipIsfbNotPreset` validates the `kErrorOwnershipISFBNotPresent` error return when ISFB is not present. The second test `ErasePolicyDisableExpectedCheck` verifies that the function correctly sets `erase_en` to `kHardenedBoolTrue` when all expected checks are disabled. Change-Id: Iff0fde59efe10617486d4c5ff6f51d868aefd0b9 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This adds new tests for `ownership_init()` to check its behavior when the ownership info pages are corrupted. Change-Id: Ifd04ef920a967b5d39cb793e7d9348d0f561348b Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
…y_point This change adds two new unit tests to `rom_ext_boot_policy_unittest`: - `ManifestCheckBadSignedRegion`: Verifies that `rom_ext_boot_policy_manifest_check` correctly returns `kErrorManifestBadSignedRegion` when `signed_region_end` is out of range. - `ManifestCheckBadEntryPoint`: Verifies that `rom_ext_boot_policy_manifest_check` correctly returns `kErrorManifestBadEntryPoint` when `entry_point` is outside the valid code region. Change-Id: Ie83c08b5a935e9bca72cbfca6f33637d194dd1a0 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
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.
This change introduces new unit tests for currently uncovered code, primarily targeting corner-case branches that are difficult to reach through standard functional tests.
Each commit is self-contained and functionally independent.
They have been grouped into a single pull request due to their small individual size
(each adding fewer than three test cases).