Change in flashrom[master]: tests/spi25.c: Add unit-test coverage of spi95.c
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/41656 ) Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... tests/spi25.c: Add unit-test coverage of spi95.c BUG=b:157280555 BRANCH=none TEST=builds Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Signed-off-by: Edward O'Callaghan <quasisec@google.com> --- M tests/spi25.c M tests/tests.c M tests/tests.h 3 files changed, 21 insertions(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/56/41656/1 diff --git a/tests/spi25.c b/tests/spi25.c index cf8345c..8a9b9ee 100644 --- a/tests/spi25.c +++ b/tests/spi25.c @@ -168,3 +168,22 @@ will_return(__wrap_spi_send_command, AT25F_RDID_INSIZE); assert_int_equal(0, probe_spi_at25f(&flashctx)); } + +/* spi95.c */ +void probe_spi_st95_test_success(void **state) +{ + (void) state; /* unused */ + + /* setup initial test state. */ + struct flashctx flashctx = { .chip = &mock_chip }; + expect_memory(__wrap_spi_send_command, flash, + &flashctx, sizeof(flashctx)); + + /* chip total size < 64K. */ + uint32_t rdid_outsize = ST_M95_RDID_2BA_OUTSIZE; // 16 bit address + + will_return(__wrap_spi_send_command, rdid_outsize); + will_return(__wrap_spi_send_command, ST_M95_RDID); + will_return(__wrap_spi_send_command, ST_M95_RDID_INSIZE); + assert_int_equal(0, probe_spi_st95(&flashctx)); +} diff --git a/tests/tests.c b/tests/tests.c index 2ba293b..e04e204 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -50,6 +50,7 @@ cmocka_unit_test(probe_spi_res2_test_success), cmocka_unit_test(probe_spi_res3_test_success), cmocka_unit_test(probe_spi_at25f_test_success), + cmocka_unit_test(probe_spi_st95_test_success), /* spi95.c */ }; ret |= cmocka_run_group_tests_name("spi25.c tests", spi25_tests, NULL, NULL); diff --git a/tests/tests.h b/tests/tests.h index b4913f1..a20fb95 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -26,5 +26,6 @@ void probe_spi_res2_test_success(void **state); void probe_spi_res3_test_success(void **state); void probe_spi_at25f_test_success(void **state); +void probe_spi_st95_test_success(void **state); /* spi95.c */ #endif /* TESTS_H */ -- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 1 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-MessageType: newchange
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/41656 ) Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... Patch Set 1: Code-Review+1 (1 comment) https://review.coreboot.org/c/flashrom/+/41656/1//COMMIT_MSG Commit Message: https://review.coreboot.org/c/flashrom/+/41656/1//COMMIT_MSG@7 PS1, Line 7: spi95.c Oh, we have a file that is called spi95.c Maybe mention in the commit message that it's added to spi25 because it's similar enough? -- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 1 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-Comment-Date: Fri, 22 May 2020 12:34:34 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/41656 ) Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... Patch Set 1: (1 comment) https://review.coreboot.org/c/flashrom/+/41656/1//COMMIT_MSG Commit Message: https://review.coreboot.org/c/flashrom/+/41656/1//COMMIT_MSG@7 PS1, Line 7: spi95.c
Oh, we have a file that is called spi95.c […] Done
-- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 1 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-Comment-Date: Fri, 22 May 2020 14:56:05 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Angel Pons <th3fanbus@gmail.com> Gerrit-MessageType: comment
Hello build bot (Jenkins), Angel Pons, I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/flashrom/+/41656 to look at the new patch set (#2). Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... tests/spi25.c: Add unit-test coverage of spi95.c Add spi95.c unit-tests to spi25.c to avoid some clutter. BUG=b:157280555 BRANCH=none TEST=builds Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Signed-off-by: Edward O'Callaghan <quasisec@google.com> --- M tests/spi25.c M tests/tests.c M tests/tests.h 3 files changed, 21 insertions(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/56/41656/2 -- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 2 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-MessageType: newpatchset
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/41656 ) Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 2 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-Comment-Date: Tue, 16 Jun 2020 12:06:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/41656 ) Change subject: tests/spi25.c: Add unit-test coverage of spi95.c ...................................................................... tests/spi25.c: Add unit-test coverage of spi95.c Add spi95.c unit-tests to spi25.c to avoid some clutter. BUG=b:157280555 BRANCH=none TEST=builds Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/41656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> --- M tests/spi25.c M tests/tests.c M tests/tests.h 3 files changed, 21 insertions(+), 0 deletions(-) Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved diff --git a/tests/spi25.c b/tests/spi25.c index 9932574..aa1eea0 100644 --- a/tests/spi25.c +++ b/tests/spi25.c @@ -168,3 +168,22 @@ will_return(__wrap_spi_send_command, AT25F_RDID_INSIZE); assert_int_equal(0, probe_spi_at25f(&flashctx)); } + +/* spi95.c */ +void probe_spi_st95_test_success(void **state) +{ + (void) state; /* unused */ + + /* setup initial test state. */ + struct flashctx flashctx = { .chip = &mock_chip }; + expect_memory(__wrap_spi_send_command, flash, + &flashctx, sizeof(flashctx)); + + /* chip total size < 64K. */ + uint32_t rdid_outsize = ST_M95_RDID_2BA_OUTSIZE; // 16 bit address + + will_return(__wrap_spi_send_command, rdid_outsize); + will_return(__wrap_spi_send_command, ST_M95_RDID); + will_return(__wrap_spi_send_command, ST_M95_RDID_INSIZE); + assert_int_equal(0, probe_spi_st95(&flashctx)); +} diff --git a/tests/tests.c b/tests/tests.c index 02f0438..1a6b65f 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -47,6 +47,7 @@ cmocka_unit_test(probe_spi_res2_test_success), cmocka_unit_test(probe_spi_res3_test_success), cmocka_unit_test(probe_spi_at25f_test_success), + cmocka_unit_test(probe_spi_st95_test_success), /* spi95.c */ }; ret |= cmocka_run_group_tests_name("spi25.c tests", spi25_tests, NULL, NULL); diff --git a/tests/tests.h b/tests/tests.h index 83cfdea..107cb51 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -23,5 +23,6 @@ void probe_spi_res2_test_success(void **state); void probe_spi_res3_test_success(void **state); void probe_spi_at25f_test_success(void **state); +void probe_spi_st95_test_success(void **state); /* spi95.c */ #endif /* TESTS_H */ -- To view, visit https://review.coreboot.org/c/flashrom/+/41656 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b Gerrit-Change-Number: 41656 Gerrit-PatchSet: 3 Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-MessageType: merged
participants (2)
-
Angel Pons (Code Review) -
Edward O'Callaghan (Code Review)