Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk, Peter Marheine.
Felix Singer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67312 )
Change subject: tests: Add workaround to allow tests mock fileno on FreeBSD
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/67312
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3789ea9107a4cf8033cf59bb96d3c82aa58de026
Gerrit-Change-Number: 67312
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 02 Sep 2022 08:29:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk, Peter Marheine.
Felix Singer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67310 )
Change subject: tests: Use MOCK_FD instead of NON_ZERO for file operations
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/67310
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b
Gerrit-Change-Number: 67310
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 02 Sep 2022 08:28:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Thomas Heijligen, Anastasia Klimchuk, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67310 )
Change subject: tests: Use MOCK_FD instead of NON_ZERO for file operations
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/67310
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b
Gerrit-Change-Number: 67310
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 02 Sep 2022 08:28:30 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67269 )
Change subject: MAINTAINERS: Add Felix Singer for test_build.sh
......................................................................
Patch Set 3:
(1 comment)
File MAINTAINERS:
https://review.coreboot.org/c/flashrom/+/67269/comment/a8b6eef7_808ab162
PS3, Line 145: TEST
> implications related to the purpose.
The real name is "build with tests script" but it's probably too long :)
"test build" sounds as if it is not a real build. Yes I think the name of file is not ideal too.
Maybe DEV BUILD SCRIPT?
--
To view, visit https://review.coreboot.org/c/flashrom/+/67269
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I36267e6c080b14e90e820d3e26abaefe642f9c65
Gerrit-Change-Number: 67269
Gerrit-PatchSet: 3
Gerrit-Owner: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Comment-Date: Fri, 02 Sep 2022 07:52:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Singer <felixsinger(a)posteo.net>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67312 )
Change subject: tests: Add workaround to allow tests mock fileno on FreeBSD
......................................................................
tests: Add workaround to allow tests mock fileno on FreeBSD
fileno can be a function and a macro in FreeBSD, depending on whether
the environment in multi-threaded or single-threaded. For single
thread, macro is used. Macro is expanded into a inline code which
accesses private field of file descriptor. This is impossible to
mock in tests.
Pretending that environment is multi-threaded makes fileno function
to be called instead of a macro. Function can be mocked for tests.
Change-Id: I3789ea9107a4cf8033cf59bb96d3c82aa58de026
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/chip.c
1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/12/67312/1
diff --git a/tests/chip.c b/tests/chip.c
index 6f03172..7b2bd82 100644
--- a/tests/chip.c
+++ b/tests/chip.c
@@ -131,6 +131,17 @@
/* Assignment below normally happens while probing, but this test is not probing. */
flashctx->mst = ®istered_masters[0];
printf("done\n");
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ /*
+ * Pretending to be a multithreaded environment so that `fileno`
+ * is called as a function (and not as a macro).
+ * fileno macro in FreeBSD is expanded into inline access of
+ * private field of file descriptor, which is impossible to mock.
+ * Calling fileno as a function allows the test to mock it.
+ */
+ __isthreaded = 1;
+#endif
}
static void teardown(struct flashrom_layout **layout)
@@ -144,6 +155,11 @@
printf("done\n");
io_mock_register(NULL);
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ /* Restoring the state, see comment in setup_chip. */
+ __isthreaded = 0;
+#endif
}
static const struct flashchip chip_8MiB = {
--
To view, visit https://review.coreboot.org/c/flashrom/+/67312
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3789ea9107a4cf8033cf59bb96d3c82aa58de026
Gerrit-Change-Number: 67312
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67310 )
Change subject: tests: Use MOCK_FD instead of NON_ZERO for file operations
......................................................................
tests: Use MOCK_FD instead of NON_ZERO for file operations
NON_ZERO can be a negative number, so MOCK_FD is safer option to
use as a mock file descriptor. Also it is more readable.
Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/tests.c
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/67310/1
diff --git a/tests/tests.c b/tests/tests.c
index 2994c02..f6b4df1 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -24,7 +24,7 @@
void *not_null(void)
{
- return (void *)NON_ZERO;
+ return (void *)MOCK_FD;
}
/* Workaround for https://github.com/clibs/cmocka/issues/17 */
@@ -253,7 +253,7 @@
int __wrap_fileno(FILE *fp)
{
LOG_ME;
- return NON_ZERO;
+ return MOCK_FD;
}
int __wrap_fsync(int fd)
--
To view, visit https://review.coreboot.org/c/flashrom/+/67310
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b
Gerrit-Change-Number: 67310
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange