diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2022-01-10 13:36:47 +0000 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-01-14 14:29:29 +0000 |
commit | c08b6a7037e4dd21f08a2fc8d40db51c7b4e051b (patch) | |
tree | bcab84b0853151766b0fe4a3c324e962fb05bb4c /tests/lib/fmap-test.c | |
parent | 63ec2ac97aab17a7e5c8e929c96a188bcd59b9c0 (diff) |
tests: Fix tests code and comments style
This patch applies clang-format settings to most of tests files. Some
files were fixed "by-hand" to exclude some lines, which whould be less
readable after automatic style fixing.
Moreover, some comments (mostly in tests/lib/edid-test.c) were adjusted
to match coreboot coding style guidelines.
Change-Id: I69f25a7b6d8265800c731754e2fbb2255f482134
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60970
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'tests/lib/fmap-test.c')
-rw-r--r-- | tests/lib/fmap-test.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/lib/fmap-test.c b/tests/lib/fmap-test.c index 044c3121a9..1cc8246b4b 100644 --- a/tests/lib/fmap-test.c +++ b/tests/lib/fmap-test.c @@ -31,7 +31,7 @@ static void prepare_flash_buffer(void) /* Fill rest of buffer with dummy data */ for (int i = FMAP_SECTION_FMAP_START + FMAP_SECTION_FMAP_SIZE; - i < FMAP_SECTION_FLASH_SIZE; ++i) + i < FMAP_SECTION_FLASH_SIZE; ++i) flash_buffer[i] = 'a' + i % ('z' - 'a'); } @@ -140,13 +140,13 @@ static void test_fmap_locate_area_as_rdev_rw(void **state) /* Test if returned section region device is writable */ assert_int_not_equal(-1, fmap_locate_area_as_rdev_rw("MISC_RW", &rdev)); assert_int_equal(ro_rw_section_size, - rdev_readat(&rdev, buffer1, 0, ro_rw_section_size)); + rdev_readat(&rdev, buffer1, 0, ro_rw_section_size)); assert_int_equal(ro_rw_section_size, - rdev_writeat(&rdev, dummy_data, 0, ro_rw_section_size)); + rdev_writeat(&rdev, dummy_data, 0, ro_rw_section_size)); /* Check if written data is visible and correct after locating area as RO */ assert_int_not_equal(-1, fmap_locate_area_as_rdev("MISC_RW", &rdev)); assert_int_equal(ro_rw_section_size, - rdev_readat(&rdev, buffer2, 0, ro_rw_section_size)); + rdev_readat(&rdev, buffer2, 0, ro_rw_section_size)); assert_memory_not_equal(buffer1, buffer2, ro_rw_section_size); assert_memory_equal(dummy_data, buffer2, ro_rw_section_size); @@ -261,7 +261,7 @@ static void test_fmap_overwrite_area(void **state) /* Overwrite part of section. */ assert_int_equal(section_size / 2, - fmap_overwrite_area(section_name, new_data, section_size / 2)); + fmap_overwrite_area(section_name, new_data, section_size / 2)); /* Read and check if memory has changed as expected */ assert_int_equal(section_size, fmap_read_area(section_name, buffer2, section_size)); @@ -272,8 +272,8 @@ static void test_fmap_overwrite_area(void **state) assert_memory_equal(buffer2 + (section_size / 2), zero_buffer, section_size / 2); /* Expect error when overwriting incorrect section */ - assert_int_equal(-1, fmap_overwrite_area("NONEXISTENT_SECTION", - new_data, section_size / 2)); + assert_int_equal( + -1, fmap_overwrite_area("NONEXISTENT_SECTION", new_data, section_size / 2)); assert_int_equal(-1, fmap_overwrite_area(NULL, new_data, section_size / 2)); /* Function fmap_overwrite_area is not tested with NULL @@ -288,18 +288,17 @@ static void test_fmap_overwrite_area(void **state) int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test_setup_teardown(test_fmap_locate_area_as_rdev, - setup_fmap, teardown_fmap), - cmocka_unit_test_setup_teardown(test_fmap_locate_area_as_rdev_rw, - setup_fmap, teardown_fmap), - cmocka_unit_test_setup_teardown(test_fmap_locate_area, - setup_fmap, teardown_fmap), - cmocka_unit_test_setup_teardown(test_fmap_find_region_name, - setup_fmap, teardown_fmap), - cmocka_unit_test_setup_teardown(test_fmap_read_area, - setup_fmap, teardown_fmap), - cmocka_unit_test_setup_teardown(test_fmap_overwrite_area, - setup_fmap, teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_locate_area_as_rdev, setup_fmap, + teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_locate_area_as_rdev_rw, setup_fmap, + teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_locate_area, setup_fmap, + teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_find_region_name, setup_fmap, + teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_read_area, setup_fmap, teardown_fmap), + cmocka_unit_test_setup_teardown(test_fmap_overwrite_area, setup_fmap, + teardown_fmap), }; return cb_run_group_tests(tests, NULL, NULL); |