Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/59238 )
Change subject: tests: Add comprehensive comment for chip.c
......................................................................
tests: Add comprehensive comment for chip.c
Change-Id: Ie498ec55cce8460fc0b2e1fe27254d3a9f763fac
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/chip.c
1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/38/59238/1
diff --git a/tests/chip.c b/tests/chip.c
index a166bb6..f5110c0 100644
--- a/tests/chip.c
+++ b/tests/chip.c
@@ -24,6 +24,27 @@
#define MOCK_CHIP_SIZE (8*MiB)
#define MOCK_CHIP_CONTENT 0xff
+/*
+ * This file contains tests for operations on flash chip.
+ *
+ * All of the tests emulate operations on flash chip. Importantly
+ * there are two types of tests here, corresponding to two ways of
+ * emulating a chip:
+ *
+ * 1) Tests which use mock chip struct (chip_8MiB for example). In the
+ * struct all operations read/write/unlock/erase are delegated to mock
+ * functions defined in this file. Mock functions are using g_chip_state
+ * as representation of flash chip.
+ * Example of test: erase_chip_test_success.
+ *
+ * 2) Tests which use dummyflasher's capabilities to emulate operations
+ * on flash chip. Chip struct looks very close to a real flashchip struct
+ * as it is defined in flashchip.c (chip_W25Q128_V for example).
+ * Dummyflasher controls chip state and emulates read/write/unlock/erase.
+ * g_chip_state is NOT used for these type of tests.
+ * Example of test: erase_chip_with_dummyflasher_test_success.
+ */
+
static struct {
unsigned int unlock_calls; /* how many times unlock function was called */
uint8_t buf[MOCK_CHIP_SIZE]; /* buffer of total size of chip, to emulate a chip */
--
To view, visit https://review.coreboot.org/c/flashrom/+/59238
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie498ec55cce8460fc0b2e1fe27254d3a9f763fac
Gerrit-Change-Number: 59238
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/+/59237 )
Change subject: tests: Setup mock chip memory in consistent and predictable way
......................................................................
tests: Setup mock chip memory in consistent and predictable way
This patch adds a macro MOCK_CHIP_CONTENT which represents a memory
state of a mock chip. The macro is used to initialise mock chip
memory at the beginning of a test (in setup_chip function).
Previously mock chip memory was not reset between tests. For
existing tests that did not matter, however new test for verify
operation (added later in this chain) needs mock chip memory to
be setup in a predictable way.
BUG=b:181803212
TEST=ninja test
Change-Id: I0d7623a601c207bfc62d54ab89d94cda56d85871
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/chip.c
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/37/59237/1
diff --git a/tests/chip.c b/tests/chip.c
index 9c06fe7..a166bb6 100644
--- a/tests/chip.c
+++ b/tests/chip.c
@@ -22,13 +22,14 @@
#include "programmer.h"
#define MOCK_CHIP_SIZE (8*MiB)
+#define MOCK_CHIP_CONTENT 0xff
static struct {
unsigned int unlock_calls; /* how many times unlock function was called */
uint8_t buf[MOCK_CHIP_SIZE]; /* buffer of total size of chip, to emulate a chip */
} g_chip_state = {
.unlock_calls = 0,
- .buf = { 0 },
+ .buf = { MOCK_CHIP_CONTENT },
};
int read_chip(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
@@ -92,6 +93,7 @@
flashctx->chip = chip;
g_chip_state.unlock_calls = 0;
+ memset(&g_chip_state.buf[0], MOCK_CHIP_CONTENT, MOCK_CHIP_SIZE);
printf("Creating layout with one included region... ");
assert_int_equal(0, flashrom_layout_new(layout));
--
To view, visit https://review.coreboot.org/c/flashrom/+/59237
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0d7623a601c207bfc62d54ab89d94cda56d85871
Gerrit-Change-Number: 59237
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.
Sergii Dmytruk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59075 )
Change subject: [RFC] tests: add test of write protection
......................................................................
Patch Set 3:
(3 comments)
Patchset:
PS2:
> Just to double-check, is this chain going to be on the top of https://review.coreboot. […]
Correct, I exclude those commits before pushing because last time I didn't gerrit updated patchsets for changes that I didn't mean to update.
File tests/write_protection.c:
https://review.coreboot.org/c/flashrom/+/59075/comment/df5d3c0c_7c6c5ed5
PS2, Line 2: This file
> How about a bit shorter name: write_protect.c? Same meaning, less chars. […]
Done
https://review.coreboot.org/c/flashrom/+/59075/comment/f16e1293_b1977d2d
PS2, Line 101: test_failure
> Is this […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/59075
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I49af7f6d173eb4c56c22d80b01a473b8c499c0f8
Gerrit-Change-Number: 59075
Gerrit-PatchSet: 3
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
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: Thu, 11 Nov 2021 23:45:00 +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, Angel Pons, Sergii Dmytruk.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59075 )
Change subject: [RFC] tests: add test of write protection
......................................................................
Patch Set 2:
(3 comments)
Patchset:
PS2:
Just to double-check, is this chain going to be on the top of https://review.coreboot.org/c/flashrom/+/58738 ?
And thanks for writing tests! I will do a better review later.
File tests/write_protection.c:
https://review.coreboot.org/c/flashrom/+/59075/comment/abf6a104_e06e4fa9
PS2, Line 2: This file
How about a bit shorter name: write_protect.c? Same meaning, less chars. And everyone talking about this feature as "write-protect" anyway.
https://review.coreboot.org/c/flashrom/+/59075/comment/767425d4_90857c9a
PS2, Line 101: test_failure
Is this
1) a test which is expected to fail
2) or a test which is executing failure scenario?
It looks like 2) , in this case it should be test_success.
We don't have currently tests of type 1, however you definitely can intro one if you want.
--
To view, visit https://review.coreboot.org/c/flashrom/+/59075
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I49af7f6d173eb4c56c22d80b01a473b8c499c0f8
Gerrit-Change-Number: 59075
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Comment-Date: Thu, 11 Nov 2021 23:25:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Angel Pons.
Hello build bot (Jenkins), Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/59075
to look at the new patch set (#2).
Change subject: [RFC] tests: add test of write protection
......................................................................
[RFC] tests: add test of write protection
Tests both WP implementation and its emulation in dummy programmer.
Change-Id: I49af7f6d173eb4c56c22d80b01a473b8c499c0f8
Signed-off-by: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
---
M tests/meson.build
M tests/tests.c
M tests/tests.h
A tests/write_protection.c
4 files changed, 279 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/59075/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/59075
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I49af7f6d173eb4c56c22d80b01a473b8c499c0f8
Gerrit-Change-Number: 59075
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Nico Huber, Angel Pons.
Hello build bot (Jenkins), Nico Huber, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/59074
to look at the new patch set (#2).
Change subject: [RFC] dummyflasher: write protection for W25Q128FV
......................................................................
[RFC] dummyflasher: write protection for W25Q128FV
Start taking bits related to write protection into account.
Also add "wp" parameter for dummy programmer that sets state of WP pin.
Change-Id: I9fd1417f941186391bd213bd355530143c8f04a0
Signed-off-by: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
---
M dummyflasher.c
M flashrom.8.tmpl
2 files changed, 158 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/74/59074/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/59074
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9fd1417f941186391bd213bd355530143c8f04a0
Gerrit-Change-Number: 59074
Gerrit-PatchSet: 2
Gerrit-Owner: Sergii Dmytruk <sergii.dmytruk(a)3mdeb.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Maciej Pijanowski <maciej.pijanowski(a)3mdeb.com>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset