-
Notifications
You must be signed in to change notification settings - Fork 8.4k
tests: riscv: pmp: Make permission change tests dynamic #100709
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
base: main
Are you sure you want to change the base?
tests: riscv: pmp: Make permission change tests dynamic #100709
Conversation
6848683 to
a54cdb7
Compare
a54cdb7 to
1574146
Compare
jimmyzhe
left a comment
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.
test_successful_permission_change: Locates the index of the target test region (dt_regions[1]) by matching its base address and size. The test now also inverts the R/W bits of the current permissions to ensure a change is applied and verified.
Seems that test_successful_permission_change uses test region dt_regions[0] and inverts the X bit. Could you update the commit message and the comment?
Other than that, these changes LGTM.
The existing PMP permission tests relied on hardcoded region indices
(e.g., index 0 or 2). This makes the tests fragile and dependent
on the exact memory attribute region setup.
This change refactors the tests to dynamically determine region counts
and indices based on the output of `mem_attr_get_regions()`:
- `test_pmp_change_perm_invalid_permission`: Uses the last valid
region index to test invalid permission flags.
- `test_pmp_change_perm_invalid_region_index`: Uses the total number
of regions as the out-of-bounds index.
- `test_successful_permission_change`: Locates the index of the
target test region (`dt_regions[0]`) by matching its base address
and size. The test now also inverts the X bit of the current
permissions to ensure a change is applied and verified.
These changes make the tests more robust and less dependent on a
specific static configuration.
Signed-off-by: Firas Sammoura <[email protected]>
1574146 to
91ebdde
Compare
Done |
|



The existing PMP permission tests relied on hardcoded region indices (e.g., index 0 or 2). This makes the tests fragile and dependent on the exact memory attribute region setup.
This change refactors the tests to dynamically determine region counts and indices based on the output of
mem_attr_get_regions():test_pmp_change_perm_invalid_permission: Uses the last valid region index to test invalid permission flags.test_pmp_change_perm_invalid_region_index: Uses the total number of regions as the out-of-bounds index.test_successful_permission_change: Locates the index of the target test region (dt_regions[0]) by matching its base address and size. The test now also inverts the X bit of the current permissions to ensure a change is applied and verified.These changes make the tests more robust and less dependent on a specific static configuration.