Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/58103 )
Change subject: tests: Add wraps for all variants of stat
......................................................................
tests: Add wraps for all variants of stat
stat() can invoke different variants of stat function and all of them
needs to be wrapped in tests. For all existing tests it is sufficient
for stat to "do nothing, return 0", so all wraps do just that.
Without this patch linux_mtd test fails on a system where __xstat64
is used.
BUG=b:181803212
TEST=running tests on two different environments,
with 1) stat64 and 2) __xstat64 invoked
Change-Id: I4c5c243acde09dc5bb6b2a14042fcd23a49707db
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/meson.build
M tests/tests.c
2 files changed, 14 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/03/58103/1
diff --git a/tests/meson.build b/tests/meson.build
index 8019bd3..e0f3c68 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -43,6 +43,8 @@
'-Wl,--wrap=fflush',
'-Wl,--wrap=stat',
'-Wl,--wrap=stat64',
+ '-Wl,--wrap=__xstat',
+ '-Wl,--wrap=__xstat64',
'-Wl,--wrap=fstat',
'-Wl,--wrap=fstat64',
'-Wl,--wrap=fileno',
diff --git a/tests/tests.c b/tests/tests.c
index ac59470..eceb1c5 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -154,6 +154,18 @@
return 0;
}
+int __wrap___xstat(const char *path, void *buf)
+{
+ LOG_ME;
+ return 0;
+}
+
+int __wrap___xstat64(const char *path, void *buf)
+{
+ LOG_ME;
+ return 0;
+}
+
int __wrap_fstat(int fd, void *buf)
{
LOG_ME;
--
To view, visit https://review.coreboot.org/c/flashrom/+/58103
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4c5c243acde09dc5bb6b2a14042fcd23a49707db
Gerrit-Change-Number: 58103
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Nico Huber, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57269 )
Change subject: tests: Add NON_ZERO macro and not_null function instead of MOCK_HANDLE
......................................................................
Patch Set 5:
(2 comments)
Patchset:
PS4:
> I wonder if `io_mock` is the right place for it. not_null() doesn't […]
Yes, I was also thinking about whether io_mock is the right header ... so probably it's not.
include/test.h gets LOG_ME further in this chain anyway CB:57914, so I can move non zero and not null there as well.
But I would need include/tests.c for not_null() implementation, is that correct?
Another thing I wanted to ask before I start changing everything: I am using io_mock.c later in this chain for current_io CB:57915 is that correct approach? If yes, I think I can remove io_mock.c from this patch and delay its creation until CB:57915.
Patchset:
PS5:
Rebased to replace one more occurrence of MOCK_HANDLE from the latest merged test.
--
To view, visit https://review.coreboot.org/c/flashrom/+/57269
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5ad6ee4aa9091447c6c9108c92bf7f6e755fca48
Gerrit-Change-Number: 57269
Gerrit-PatchSet: 5
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: Tue, 05 Oct 2021 03:30:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
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/+/57917
to look at the new patch set (#3).
Change subject: tests: Add wrap for libusb_init and use it in dediprog test
......................................................................
tests: Add wrap for libusb_init and use it in dediprog test
Missing wrap for libusb_init has been discovered while working
on the test for raiden_debug_spi. Both dediprog (existing test) and
raiden_debug_spi (new test, see later in this chain) are using
libusb_init, so it definitely needs to be wrapped and added to io_mock.
Why tests worked before, without the wrap: my understanding is that
real libusb_init was called for dediprog test? Given that tests
definitely should not call any real libusb functions, wrap is needed.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I51c9cb96db1afb3298f4d098df96509d3cb3c046
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/init_shutdown.c
M tests/io_mock.h
M tests/libusb_wraps.c
M tests/meson.build
4 files changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/57917/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/57917
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I51c9cb96db1afb3298f4d098df96509d3cb3c046
Gerrit-Change-Number: 57917
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: Nico Huber, Angel Pons, Anastasia Klimchuk.
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/+/57269
to look at the new patch set (#5).
Change subject: tests: Add NON_ZERO macro and not_null function instead of MOCK_HANDLE
......................................................................
tests: Add NON_ZERO macro and not_null function instead of MOCK_HANDLE
This patch adds NON_ZERO macro and not_null function into io_mock.h,
so that they can be used anywhere in tests. Common usage for not_null
is to indicate a valid pointer, where it doesn't matter what the
pointer is, only matters it is not null. Common usage of NON_ZERO is
to indicate a valid file descriptor, where it only matters the
descriptor is non-zero integer.
New features replace all usages of previous MOCK_HANDLE.
This patch corrects return value from __wrap_ioctl to be successful
by default. It used to be MOCK_HANDLE, but should be 0. Included in
this patch because this is also a replacement of MOCK_HANDLE.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I5ad6ee4aa9091447c6c9108c92bf7f6e755fca48
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/init_shutdown.c
A tests/io_mock.c
M tests/io_mock.h
M tests/meson.build
M tests/tests.c
5 files changed, 41 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/69/57269/5
--
To view, visit https://review.coreboot.org/c/flashrom/+/57269
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5ad6ee4aa9091447c6c9108c92bf7f6e755fca48
Gerrit-Change-Number: 57269
Gerrit-PatchSet: 5
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-MessageType: newpatchset
Attention is currently required from: Edward O'Callaghan, Angel Pons, Nikolai Artemiev.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57974 )
Change subject: raiden_debug_spi: Move shutdown function above spi_master struct
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS1:
> It's the ugly LIBUSB() macro, it contains __LINE__ which changes with this […]
This explains everything, thank you so much!
--
To view, visit https://review.coreboot.org/c/flashrom/+/57974
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I567e24c9d39e24a4a1634ddcbdd05930760afcdc
Gerrit-Change-Number: 57974
Gerrit-PatchSet: 2
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: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Tue, 05 Oct 2021 00:51:42 +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
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Nikolai Artemiev.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57973 )
Change subject: raiden_debug_spi: Use spi data in configure_protocol
......................................................................
Patch Set 2:
(2 comments)
File raiden_debug_spi.c:
https://review.coreboot.org/c/flashrom/+/57973/comment/0cad7b61_9282a110
PS1, Line 1599: spi_config->data = data; /* data is needed to configure protocol below */
> Maybe worth to mention in the commit message, that this is not […]
This line was here for configure_protocol, because it needs both data and spi_config. But it was inconsistent with other spi masters and confusing. Confusing because the same line had been removed from all the other spi masters, and left here, just for configure_protocol. I was waiting for a chance to remove this line, and finally I can! :)
I updated commit message, added more info.
https://review.coreboot.org/c/flashrom/+/57973/comment/708b21a5_d18e1ef3
PS1, Line 1327: struct raiden_debug_spi_data *ctx_data =
: (struct raiden_debug_spi_data *)data;
> No cast necessary, it already has that type. Or... […]
That's a good idea, renamed parameter ctx_data.
--
To view, visit https://review.coreboot.org/c/flashrom/+/57973
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5df0609efcd1fdb274b8cc84536253d5dbae5270
Gerrit-Change-Number: 57973
Gerrit-PatchSet: 2
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: Nikolai Artemiev <nartemiev(a)google.com>
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-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Tue, 05 Oct 2021 00:51:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: comment