| 287 | } |
| 288 | |
| 289 | int fmap_test(void) |
| 290 | { |
| 291 | int rc = EXIT_SUCCESS; |
| 292 | struct fmap *my_fmap; |
| 293 | |
| 294 | /* |
| 295 | * This test has two parts: Creation of an fmap with one or more |
| 296 | * area(s), and other stuff. Since a valid fmap is required to run |
| 297 | * many tests, we abort if fmap creation fails in any way. |
| 298 | * |
| 299 | * Also, fmap_csum_test() makes some assumptions based on the areas |
| 300 | * appended. See fmap_append_area_test() for details. |
| 301 | */ |
| 302 | if ((my_fmap = fmap_create_test()) == NULL) { |
| 303 | rc = EXIT_FAILURE; |
| 304 | goto fmap_test_exit; |
| 305 | } |
| 306 | |
| 307 | if (fmap_find_test(my_fmap)) { |
| 308 | rc = EXIT_FAILURE; |
| 309 | goto fmap_test_exit; |
| 310 | } |
| 311 | |
| 312 | if (fmap_append_area_test(&my_fmap)) { |
| 313 | rc = EXIT_FAILURE; |
| 314 | goto fmap_test_exit; |
| 315 | } |
| 316 | |
| 317 | rc |= fmap_find_area_test(my_fmap); |
| 318 | rc |= fmap_size_test(); |
| 319 | rc |= fmap_flags_to_string_test(); |
| 320 | rc |= fmap_print_test(my_fmap); |
| 321 | |
| 322 | fmap_test_exit: |
| 323 | fmap_destroy(my_fmap); |
| 324 | if (rc) |
| 325 | printf("FAILED\n"); |
| 326 | return rc; |
| 327 | } |
| 328 | |
| 329 | int main(void) |
| 330 | { |
no test coverage detected