summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2023-06-22 11:07:18 -0700
committerEdward O'Callaghan <quasisec@chromium.org>2023-07-18 01:17:04 +0000
commite08899fcf4127de5cb2ad2dd134539d41f7e33b0 (patch)
tree19cd45fa1c6bc251967ea948355e7c44b81b2535 /tests
parent91aa2d85269fa8cf214e3eeb9e9df60e874be0f2 (diff)
downloadflashrom-e08899fcf4127de5cb2ad2dd134539d41f7e33b0.tar.gz
flashrom-e08899fcf4127de5cb2ad2dd134539d41f7e33b0.tar.bz2
flashrom-e08899fcf4127de5cb2ad2dd134539d41f7e33b0.zip
libflashrom: Add layout "exclude" API
Layouts can be expensive to derive (reading from flash), so we might want to reuse a layout for different purposes. Today, it's not possible to undo a flashrom_layout_include_region() operation (to, say, operate on a different region). Add such an API. Change-Id: I7ea3e0674f25e34bf2cfc8f464ae7ca1c1a3fbfd Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/76005 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/layout.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/layout.c b/tests/layout.c
index e71debfe2..917d77e24 100644
--- a/tests/layout.c
+++ b/tests/layout.c
@@ -110,6 +110,8 @@ void layout_pass_sanity_checks_test_success(void **state)
unsigned int region_start = 0x00021000;
unsigned int region_end = 0x00031000;
+ unsigned int region2_start = 0x00041000;
+ unsigned int region2_end = 0x00051000;
unsigned int start = 0;
unsigned int len = 0;
@@ -119,6 +121,9 @@ void layout_pass_sanity_checks_test_success(void **state)
assert_int_equal(0, flashrom_layout_new(&layout));
assert_int_equal(0, flashrom_layout_add_region(layout, region_start, region_end, "region"));
assert_int_equal(0, flashrom_layout_include_region(layout, "region"));
+ assert_int_equal(0, flashrom_layout_add_region(layout, region2_start, region2_end, "region2"));
+ assert_int_equal(0, flashrom_layout_include_region(layout, "region2"));
+ assert_int_equal(0, flashrom_layout_exclude_region(layout, "region2"));
printf("done\n");
printf("Asserting region range... ");