From 62ec7b7156e1b35da66f54f6d493b38a9e78f94c Mon Sep 17 00:00:00 2001 From: Evan Benn Date: Mon, 14 Nov 2022 16:02:47 +1100 Subject: tests: Add selfcheck to unit tests Add unit tests for programmer_table, flashchips, and board_matches structs. The tests are derived from the selfcheck function, checking that the required fields have been filled in. BUG=b:140595239 BRANCH=None TEST=meson test Change-Id: I41cd014d9bf909296b6c28e3e00548e6883ff41a Signed-off-by: Evan Benn Reviewed-on: https://review.coreboot.org/c/flashrom/+/69620 Reviewed-by: Edward O'Callaghan Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) --- tests/tests.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/tests.c') diff --git a/tests/tests.c b/tests/tests.c index fe702046..abbac643 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -381,6 +381,15 @@ int main(int argc, char *argv[]) }; ret |= cmocka_run_group_tests_name("helpers.c tests", helpers_tests, NULL, NULL); + const struct CMUnitTest selfcheck[] = { + cmocka_unit_test(selfcheck_programmer_table), + cmocka_unit_test(selfcheck_flashchips_table), + cmocka_unit_test(selfcheck_eraseblocks), + cmocka_unit_test(selfcheck_board_matches_table), + }; + ret |= cmocka_run_group_tests_name("selfcheck.c tests", selfcheck, + NULL, NULL); + const struct CMUnitTest flashrom_tests[] = { cmocka_unit_test(flashbuses_to_text_test_success), }; -- cgit v1.2.3