Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, 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 3: Code-Review+1
(3 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/8b60edfe_05f27ab9
PS3, Line 234: // Only access to I2C address 0x4a is expected
Do we really have one line comments, I am not sure... I thought it is /* */ everywhere?
https://review.coreboot.org/c/flashrom/+/56911/comment/4c72f5ea_251e87c0
PS3, Line 252: else if (sz == 1 || sz == 2)
: return sz;
: else
: return -1;
Since you return, else if, and else is not needed
https://review.coreboot.org/c/flashrom/+/56911/comment/36e1264c_f90190d8
PS3, Line 267: io_mock_register(&realtek_mst_io);
: run_lifecycle(state, &programmer_realtek_mst_i2c_spi, "bus=254,enter-isp=0");
: io_mock_register(NULL);
This is a small thing, but for consistency and readability, if you could add empty lines between io_mock_register and run_lifecycle? (like in the other tests)
--
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: 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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.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-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 12 Aug 2021 06:32:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Peter Marheine.
Anastasia Klimchuk 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 6:
(7 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56413/comment/5e27b152_06d61a1a
PS4, Line 208: 2021
> this number is very arbitrary. […]
I switched to 0x55AA, because I need a "valid" descriptor.
Next thing I will do (after this one), move MOCK_HANDLER one level up (in io_mock.h I think) and then it can be used everywhere in tests.
https://review.coreboot.org/c/flashrom/+/56413/comment/074cbb6e_ebd6d286
PS4, Line 214: int num_bytes = 0;
> Hmmm, I'd like to get rid of `num_bytes`: […]
Wow thank you for the whole code! I only removed
`const char *data = NULL;`
it seemed unused.
https://review.coreboot.org/c/flashrom/+/56413/comment/a2ec7ca8_9d6e8016
PS4, Line 219: //
> why not just `/` is something special happening here?
"//" is what's in the actual path which is constructed by linux_mtd. This programmer is definitely active and working, right?
Or do you mean that one / is more correct and would also work? If that's the case, that better be a separate change, which starts with the programmer itself and test will follow.
https://review.coreboot.org/c/flashrom/+/56413/comment/ca172755_ad549a0a
PS4, Line 221: memcpy(buf, "nor", num_bytes);
> Use strcpy instead?
Yes right, and I am now using your idea from previous comment anyway
https://review.coreboot.org/c/flashrom/+/56413/comment/ab2a827d_33d05566
PS4, Line 230: num_bytes = 0;
> seems like a bug? strings in C are null terminated which is a byte.
Oh yes... how did it even work?? But this chunk is now re-written anyway, number of bytes is strlen.
https://review.coreboot.org/c/flashrom/+/56413/comment/88c779a0_2ed0b5c1
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-desc […]
I added slightly different comment (took it from programmer code), but yes.
https://review.coreboot.org/c/flashrom/+/56413/comment/12e1d50c_c008ab2e
PS4, Line 275: memcpy(buf, "1048576", len);
> Hmmm, why use `len` here? If its value is larger than the length of "1048576", undefined behavior wo […]
Hope I fixed both comments in one go.
--
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: 6
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-CC: Peter Marheine <pmarheine(a)chromium.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-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 12 Aug 2021 05:26:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, 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 3:
(5 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/7f1bc964_1fec5f60
PS2, Line 307: 0x10ec
> This number has some meaning, also I see it is used in other mocks, so surely it is important. […]
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/faebd0d3_189b299f
PS2, Line 319: printf("ioctl(0x10ec, I2C_SLAVE, %#lx)\n", addr);
> This looks like a debugging statement, not sure we need it. […]
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/f4196069_4fe656d8
PS2, Line 320: 0x4a
> This number also needs a comment
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/eb310661_16dda928
PS2, Line 341: printf("i2c set register address %#x\n", bytes_buf[0]);
: return 1;
> If you remove printf statements, this looks like one error path which returns -1 and one normal path […]
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/dec2c946_ca5ee94e
PS2, Line 365: T
> typo
Done
--
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: 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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.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-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Thu, 12 Aug 2021 05:22:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Peter Marheine.
Hello build bot (Jenkins), Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/56911
to look at the new patch set (#3).
Change subject: tests: add init_shutdown test for realtek_mst_i2c_spi
......................................................................
tests: add init_shutdown test for realtek_mst_i2c_spi
This can catch regressions like the earlier one in this programmer that
caused initialization to always fail. Requires support for mocking POSIX
file I/O functions because the programmer does ioctls on the opened
file.
TEST=ninja test
Signed-off-by: Peter Marheine <pmarheine(a)chromium.org>
Change-Id: I5a5c617d1ec35d2a3bbe622e5add82a65eb396f0
---
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, 110 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/11/56911/3
--
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: 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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.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-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk, Peter Marheine.
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 (#6).
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 max buffer size 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, 163 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/13/56413/6
--
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: 6
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: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
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 2:
(5 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/6e8a138b_0bd1ace7
PS2, Line 307: 0x10ec
This number has some meaning, also I see it is used in other mocks, so surely it is important. Could you please add a short comment here on what this is? Does it have to be exactly this number, or any number, but the same in all mocks? Maybe it can be #define REALTEK_MOCK_FD ?
https://review.coreboot.org/c/flashrom/+/56911/comment/c6e004be_1b7d5a11
PS2, Line 319: printf("ioctl(0x10ec, I2C_SLAVE, %#lx)\n", addr);
This looks like a debugging statement, not sure we need it. Wrap invocations log themselves already (that first line LOG_ME does it), which should be sufficient for a normal situation, when tests pass.
Same for the rest of printf, let's remove. I use them a lot when writing a test, but once test is ready that would just make log larger.
(and when tests fail that would be a more targeted debugging anyway).
For future, if I discover a way to tune verbosity level in cmocka, we may add debug-only messages.
https://review.coreboot.org/c/flashrom/+/56911/comment/2a7af034_ea6cbf70
PS2, Line 320: 0x4a
This number also needs a comment
https://review.coreboot.org/c/flashrom/+/56911/comment/d916089d_b9c5cc24
PS2, Line 341: printf("i2c set register address %#x\n", bytes_buf[0]);
: return 1;
If you remove printf statements, this looks like one error path which returns -1 and one normal path which returns sz?
https://review.coreboot.org/c/flashrom/+/56911/comment/46a57ea7_61298014
PS2, Line 365: T
typo
--
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: 2
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: Thu, 12 Aug 2021 03:50:00 +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 2:
(7 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/db94d22d_08b304de
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_REALT […]
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/bb3ee746_c289f31c
PS1, Line 364: io_mock_register(&realtek_mst_io);
> You need to unregister at the end, […]
Done
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/56911/comment/373fcab8_07027324
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 […]
The intent is to have open64 delegate to open because I expect users mostly won't care about the difference, but neglected to implement the latter. Moved the open() part to __wrap_open and made __wrap_open64 delegate to it.
https://review.coreboot.org/c/flashrom/+/56911/comment/e27d85d2_55315429
PS1, Line 120: return -1;
> Default behaviour for our wraps is "do nothing, pretend everything is successful". […]
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/ff623a2b_3ab106d1
PS1, Line 127: return current_io->read(current_io->state, fd, buf, sz);
> We are following Linux kernel coding style https://git.kernel. […]
Neglected to reformat this file but did the other one. Fixed.
https://review.coreboot.org/c/flashrom/+/56911/comment/3a534342_e08bd9c4
PS1, Line 128: return -1;
> Same here, you need to return value which means success.
Done
https://review.coreboot.org/c/flashrom/+/56911/comment/8dd198a5_8635858c
PS1, Line 345: cmocka_unit_test
> Same thing, indentations should be 8 chars
Done
--
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: 2
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: Thu, 12 Aug 2021 02:40:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Peter Marheine.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/56911
to look at the new patch set (#2).
Change subject: tests: add init_shutdown test for realtek_mst_i2c_spi
......................................................................
tests: add init_shutdown test for realtek_mst_i2c_spi
This can catch regressions like the earlier one in this programmer that
caused initialization to always fail. Requires support for mocking POSIX
file I/O functions because the programmer does ioctls on the opened
file.
TEST=ninja test
Signed-off-by: Peter Marheine <pmarheine(a)chromium.org>
Change-Id: I5a5c617d1ec35d2a3bbe622e5add82a65eb396f0
---
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, 117 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/11/56911/2
--
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: 2
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-MessageType: newpatchset
Attention is currently required from: Nico Huber, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56501 )
Change subject: tests: Add tests to erase a chip
......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS2:
> Some more explanations (sorry for spam :D) […]
I made it work, so that wrap redirects into real function for all tests except spi25.c, uploaded into #1 in this chain. This one doesn't need any changes!
--
To view, visit https://review.coreboot.org/c/flashrom/+/56501
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Gerrit-Change-Number: 56501
Gerrit-PatchSet: 9
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-Comment-Date: Thu, 12 Aug 2021 01:26:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment