mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-28 15:33:42 +02:00
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>
This commit is contained in:
parent
3cc70c25f9
commit
76d2445d39
@ -168,3 +168,22 @@ void probe_spi_at25f_test_success(void **state)
|
||||
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));
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ int main(void)
|
||||
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);
|
||||
|
||||
|
@ -23,5 +23,6 @@ void probe_spi_res1_test_success(void **state);
|
||||
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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user