Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56753 )
Change subject: tests: Use real spi_send_command for all tests except spi25.c
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
I have good news! I was able to make it work without splitting into two executables, I am so happy!
So this patch is completely re-done (and it's much smaller now). The next one in the chain, with erase test, stays the same.
--
To view, visit https://review.coreboot.org/c/flashrom/+/56753
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I22945cce3d0f36adaa8032167a3ef4e54eccb611
Gerrit-Change-Number: 56753
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 12 Aug 2021 01:24:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Hello build bot (Jenkins), Nico Huber, Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/56753
to look at the new patch set (#3).
Change subject: tests: Use real spi_send_command for all tests except spi25.c
......................................................................
tests: Use real spi_send_command for all tests except spi25.c
At the moment one test (spi25.c) uses wrap of spi_send_command, and
all other existing tests don't care about this function (don't call
it at all). However in the next patch a new test in introduced, which
needs a real spi_send_command.
Following the approach "don't mock unless it is strictly necessary",
all tests that don't care go into real function bucket.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I22945cce3d0f36adaa8032167a3ef4e54eccb611
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/spi25.c
1 file changed, 28 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/53/56753/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/56753
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I22945cce3d0f36adaa8032167a3ef4e54eccb611
Gerrit-Change-Number: 56753
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Peter Marheine.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56911 )
Change subject: tests: add init_shutdown test for realtek_mst_i2c_spi
......................................................................
Patch Set 1:
(8 comments)
Patchset:
PS1:
Thanks for writing a test!
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/8df145ce_db617b87
PS1, Line 302: #include <fcntl.h>
: #include <linux/i2c-dev.h>
Tests should be as lightweight and independent as possible, they only thing to check is CONFIG_REALTEK_MST_I2C_SPI == 1, and that's inside test method.
Detect exactly what is the minimum set of symbols you need from these libraries (is it O_RDWR and I2C_SLAVE?) and define them in io_mock.h (there are some examples of that already).
Remove these includes, remove check for IS_LINUX.
Mock implementations (open,ioctl,read,write) should compile as is, you only check CONFIG_REALTEK_MST_I2C_SPI == 1 inside the test method.
Follow the example of all other tests.
https://review.coreboot.org/c/flashrom/+/56911/comment/4f925a5e_348e9737
PS1, Line 364: io_mock_register(&realtek_mst_io);
You need to unregister at the end,
`io_mock_register(NULL);`
(you can look at the other tests)
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/0bdaa2c5_1fdc3cc9
PS1, Line 93: if (current_io->open64)
: return current_io->open64(current_io->state, pathname, flags);
: if (current_io->open)
: return current_io->open(current_io->state, pathname, flags);
Why do you put both open and open64 into one wrap? There is a dedicated wrap for open, so
`current_io->open`
should go there.
https://review.coreboot.org/c/flashrom/+/56911/comment/7c4aa9ad_0703901f
PS1, Line 120: return -1;
Default behaviour for our wraps is "do nothing, pretend everything is successful". You need to return a value which emulates success. Is it sz for this write operation?
https://review.coreboot.org/c/flashrom/+/56911/comment/27a21a61_69f228be
PS1, Line 127: return current_io->read(current_io->state, fd, buf, sz);
We are following Linux kernel coding style https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Doc… which says that indentations are 8 chars.
https://review.coreboot.org/c/flashrom/+/56911/comment/01ad558a_8a5fc193
PS1, Line 128: return -1;
Same here, you need to return value which means success.
https://review.coreboot.org/c/flashrom/+/56911/comment/cb85340b_14ff6424
PS1, Line 345: cmocka_unit_test
Same thing, indentations should be 8 chars
--
To view, visit https://review.coreboot.org/c/flashrom/+/56911
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5a5c617d1ec35d2a3bbe622e5add82a65eb396f0
Gerrit-Change-Number: 56911
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Wed, 11 Aug 2021 23:30:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Anastasia Klimchuk.
Peter Marheine has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56911 )
Change subject: tests: add init_shutdown test for realtek_mst_i2c_spi
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Not much complexity in the actual mocks here, but it does need to add support for read(), write() and ioctl().
--
To view, visit https://review.coreboot.org/c/flashrom/+/56911
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5a5c617d1ec35d2a3bbe622e5add82a65eb396f0
Gerrit-Change-Number: 56911
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Wed, 11 Aug 2021 06:23:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Angel Pons, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56413 )
Change subject: tests: Mock file i/o for linux_mtd and linux_spi tests
......................................................................
Patch Set 4:
(5 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56413/comment/7ef74282_f8bda603
PS4, Line 208: 2021
this number is very arbitrary. Something that is obvious like -1 or 0x55AA [01010101 10101010] is better.
https://review.coreboot.org/c/flashrom/+/56413/comment/688237a7_01994af0
PS4, Line 219: //
why not just `/` is something special happening here?
https://review.coreboot.org/c/flashrom/+/56413/comment/198059a8_9841a0f3
PS4, Line 230: num_bytes = 0;
seems like a bug? strings in C are null terminated which is a byte.
https://review.coreboot.org/c/flashrom/+/56413/comment/289d44f8_ddde1b1a
PS4, Line 274: Provide pagesize into buf.
It is better to describe where the value is from and why it has it the particular value than re-describing what the code already shows.
`/* Fix pagesize to 1MB. */`
seems to be wht you are doing here?
https://review.coreboot.org/c/flashrom/+/56413/comment/21c89362_580c2fcc
PS4, Line 275: memcpy(buf, "1048576", len);
just, `return memcpy(buf, "1048576", len);` memcpy returns the ptr to dest (buf in this case).
--
To view, visit https://review.coreboot.org/c/flashrom/+/56413
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I73f0d6ff2ad5074add7a721ed3416230d3647e3f
Gerrit-Change-Number: 56413
Gerrit-PatchSet: 4
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Wed, 11 Aug 2021 01:31:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Hello build bot (Jenkins), Nico Huber, Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/56413
to look at the new patch set (#4).
Change subject: tests: Mock file i/o for linux_mtd and linux_spi tests
......................................................................
tests: Mock file i/o for linux_mtd and linux_spi tests
This patch adds an init-shutdown test for linux_mtd. Since
linux_mtd is using file i/o operations, those are added to the
framework and mocked.
Another driver linux_spi which is also using file i/o, got an upgrade
in this patch, and it is now reading pagesize from sysfs (using mocked
file i/o).
A good side-effect is that linux_mtd is the first test for opaque
masters, which is great to have in preparation for a change like
CB:56103 but for opaque masters.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I73f0d6ff2ad5074add7a721ed3416230d3647e3f
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/init_shutdown.c
M tests/io_mock.h
M tests/meson.build
M tests/tests.c
M tests/tests.h
5 files changed, 170 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/13/56413/4
--
To view, visit https://review.coreboot.org/c/flashrom/+/56413
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I73f0d6ff2ad5074add7a721ed3416230d3647e3f
Gerrit-Change-Number: 56413
Gerrit-PatchSet: 4
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/56799 )
Change subject: realtek_mst_i2c_spi: don't always fail init
......................................................................
realtek_mst_i2c_spi: don't always fail init
In some earlier refactoring the init function for this programmer was
broken such that it never succeeds, since the return value was never set
to a value other than a generic failure. Fix it to return success unless
there is a problem.
TEST=flashrom -p realtek_mst_i2c_spi:bus=n --flash-size now works
when n is a bus that has a connected MST.
Change-Id: I0596014fc9b76b4d11de230f9f5c414c1321dff1
Signed-off-by: Peter Marheine <pmarheine(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56799
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Anastasia Klimchuk <aklm(a)chromium.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M realtek_mst_i2c_spi.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
Anastasia Klimchuk: Looks good to me, approved
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 22f7e7a..a45838c 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -445,7 +445,7 @@
static int get_params(int *reset, int *enter_isp)
{
char *reset_str = NULL, *isp_str = NULL;
- int ret = SPI_GENERIC_ERROR;
+ int ret = 0;
reset_str = extract_programmer_param("reset-mcu");
if (reset_str) {
--
To view, visit https://review.coreboot.org/c/flashrom/+/56799
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0596014fc9b76b4d11de230f9f5c414c1321dff1
Gerrit-Change-Number: 56799
Gerrit-PatchSet: 3
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged