Attention is currently required from: Evan Benn.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69267
to look at the new patch set (#7).
Change subject: tests: Detect llvm coverage file io and unmock io functions
......................................................................
tests: Detect llvm coverage file io and unmock io functions
Code coverage writes data to disk, we need to unmock the file io at this
point so that the data is really written.
BUG=b:187647884
BRANCH=None
TEST=llvm-profdata merge -sparse default.profraw -o default.profdata
TEST=llvm-cov show ./flashrom_unit_tests
-instr-profile=default.profdata --format=html --output-dir=.
Change-Id: I21cc1d631e92fa19006b967e85676f108e80b307
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M Documentation/building.md
M tests/tests.c
M tests/unmock_io.c
M tests/wraps.h
4 files changed, 54 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/69267/7
--
To view, visit https://review.coreboot.org/c/flashrom/+/69267
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I21cc1d631e92fa19006b967e85676f108e80b307
Gerrit-Change-Number: 69267
Gerrit-PatchSet: 7
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Evan Benn <evanbenn(a)google.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Thomas Heijligen.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69266
to look at the new patch set (#7).
Change subject: tests: Detect gcov file io and unmock io functions
......................................................................
tests: Detect gcov file io and unmock io functions
Code coverage writes data to disk, we need to unmock the file io at this
point so that the data is really written.
BUG=b:187647884
BRANCH=None
TEST=meson test
TEST=ninja coverage
Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M Documentation/building.md
M tests/meson.build
M tests/tests.c
A tests/unmock_io.c
A tests/unmock_io.h
M tests/wraps.h
6 files changed, 124 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/66/69266/7
--
To view, visit https://review.coreboot.org/c/flashrom/+/69266
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Gerrit-Change-Number: 69266
Gerrit-PatchSet: 7
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: Evan Benn.
Hello build bot (Jenkins), Angel Pons, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69263
to look at the new patch set (#5).
Change subject: tests: Mock the mode_t variant of open
......................................................................
tests: Mock the mode_t variant of open
open has a second form with a mode_t argument. When mocking without this
argument a caller trying to O_CREAT would have their mode_t argument
discarded and a random stack variable would be used instead.
BUG=b:187647884
BRANCH=None
TEST=meson test
Change-Id: I8c134e6d36a248d0f51985e389085a9e585fb83d
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M tests/io_mock.h
M tests/tests.c
M tests/tests.h
M tests/wraps.h
4 files changed, 53 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/63/69263/5
--
To view, visit https://review.coreboot.org/c/flashrom/+/69263
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8c134e6d36a248d0f51985e389085a9e585fb83d
Gerrit-Change-Number: 69263
Gerrit-PatchSet: 5
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
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: Evan Benn <evanbenn(a)google.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Felix Singer, Nico Huber, Thomas Heijligen, Angel Pons, Anastasia Klimchuk, Alexander Goncharov.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/67393 )
Change subject: tree/: Move programmer_delay() out of programmer state machine
......................................................................
Patch Set 6:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/67393/comment/12f8bb3e_7bccaa27
PS4, Line 13:
> Hmmm, looks like the main source of confusion is lack of documentation regarding flashrom layers and […]
If the only remaining question is about scoping global variables used within the two custom programmer delay workers then this is trivial to answer. The custom programmer delay functions are programmer specific and therefore their global scope is to that of the programmers unit of work. It directly follows that the programmers data field may therefore be leverage to carry this state and this is thus accessible via the `flashctx`. The dispatch site of `programmer_delay()` that calls into the programmer specific delays simply just needs to pass the ctx into the callbacks, this is a trivial signature change to `void (*delay) (unsigned int usecs); -> void (*delay) (const struct flashctx *flash, unsigned int usecs);` with both the `par_master` and `spi_master` struct's. Certainly nothing to do with confusion of flashrom layers or structures.
--
To view, visit https://review.coreboot.org/c/flashrom/+/67393
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id059abb58b31a066a408009073912da2b224d40c
Gerrit-Change-Number: 67393
Gerrit-PatchSet: 6
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Alexander Goncharov <chat(a)joursoir.net>
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: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Attention: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Comment-Date: Sun, 13 Nov 2022 22:45:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Thomas Heijligen, Evan Benn.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69268 )
Change subject: tests: Add llvm-cov option and run target for code coverage
......................................................................
Patch Set 5:
(3 comments)
Patchset:
PS5:
Thanks so much Evan for setting up coverage measurement!
File meson.build:
https://review.coreboot.org/c/flashrom/+/69268/comment/f47870ed_6a60aa6c
PS5, Line 534: if get_option('llvm_cov')
Also need to check that tests feature is enabled
File meson_options.txt:
https://review.coreboot.org/c/flashrom/+/69268/comment/000eb271_45383df3
PS5, Line 19: type : 'boolean'
I think this should be a feature, like unit tests themselves. Also llvm_cov feature should depend on tests feature (you can't measure coverage is tests are disabled).
--
To view, visit https://review.coreboot.org/c/flashrom/+/69268
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id6c73bff46e7b88d425956a80def97082b201f56
Gerrit-Change-Number: 69268
Gerrit-PatchSet: 5
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Evan Benn <evanbenn(a)google.com>
Gerrit-Comment-Date: Sun, 13 Nov 2022 22:39:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Evan Benn.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69263 )
Change subject: tests: Mock the mode_t variant of open
......................................................................
Patch Set 4:
(1 comment)
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/69263/comment/55d30bcf_fecbc935
PS4, Line 103: mode_t mode = 0;
: if (flags & O_CREAT) {
: va_list ap;
: va_start(ap, flags);
: mode = va_arg(ap, mode_t);
: va_end(ap);
: }
This code repeats for all variants of open wraps, can this code go to mock_open?
--
To view, visit https://review.coreboot.org/c/flashrom/+/69263
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8c134e6d36a248d0f51985e389085a9e585fb83d
Gerrit-Change-Number: 69263
Gerrit-PatchSet: 4
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
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: Evan Benn <evanbenn(a)google.com>
Gerrit-Comment-Date: Sun, 13 Nov 2022 22:32:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Evan Benn.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69266 )
Change subject: tests: Detect gcov file io and unmock io functions
......................................................................
Patch Set 6:
(5 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/69266/comment/aab6a688_5a3a70bc
PS6, Line 9: atexit
missing space: atexit -> at exit
Patchset:
PS6:
I suggest this patch can be split into 3 patches:
1) Adding two new iom_* custom mocks and calling them from tests.c
2) Implementing coverage.c with unwraps, real_io, check_suffix and anything else needed for coverage (probably includes __real_* wraps too)
3) Calling handle_coverage call into mock_open.
1) ans 2) are no-op , the last patch 3) changes the behaviour.
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/69266/comment/4f52fdef_a2862fae
PS6, Line 110: size_t (*iom_fwrite)(void *state, const void *buf, size_t size, size_t len, FILE *fp);
Adding these (iom_fwrite and iom_fdopen) two can go into a separate patch, together with their callsites in tests.c
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/69266/comment/7ff0aa43_d9238b70
PS6, Line 52: real_io_mock
I think you can drop _mock, this is just real_io
https://review.coreboot.org/c/flashrom/+/69266/comment/a4436626_5391c09b
PS6, Line 29: static int unwrap_open(void *state, const char *pathname, int flags, mode_t mode)
: {
: LOG_ME;
: (void)state;
: return __real_open(pathname, flags, mode);
: }
:
: static FILE *unwrap_fdopen(void *state, int fd, const char *mode)
: {
: LOG_ME;
: (void)state;
: return __real_fdopen(fd, mode);
: }
:
: static size_t unwrap_fwrite(void *state, const void *ptr, size_t size, size_t nmemb, FILE *fp)
: {
: LOG_ME;
: (void)state;
: return __real_fwrite(ptr, size, nmemb, fp);
: }
:
: // Mock ios that defer to the real io functions.
: // These exist so that code coverage can print to real files on disk.
: static const struct io_mock real_io_mock = {
: .iom_open = unwrap_open,
: .iom_fwrite = unwrap_fwrite,
: .iom_fdopen = unwrap_fdopen,
: };
Ideally, if this could go to a separate file for example `coverage.c` which would only expose one function: `handle_coverage` (name is my suggestion). This function will be called in `mock_open`.
The rest of code is inside coverage.c: all unwraps, real_io, check_suffix and anything else coverage specific.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69266
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Gerrit-Change-Number: 69266
Gerrit-PatchSet: 6
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Evan Benn <evanbenn(a)google.com>
Gerrit-Comment-Date: Sun, 13 Nov 2022 22:26:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment