Attention is currently required from: Xiang Wang, Angel Pons.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49254 )
Change subject: sysfsgpio.c implement spi interface via linux sysfs
......................................................................
Patch Set 17:
(1 comment)
Patchset:
PS17:
> Have anything update?
I am good to merge this if Angel is happy?
--
To view, visit https://review.coreboot.org/c/flashrom/+/49254
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1bc47ef8011bba560326b501a80869340bb9f733
Gerrit-Change-Number: 49254
Gerrit-PatchSet: 17
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 11 Mar 2021 00:24:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49599 )
Change subject: flashrom.c: automatic generated programmer_enum.h
......................................................................
Patch Set 4: Code-Review+2
(1 comment)
Patchset:
PS4:
> Have anything update?
Sorry for any delays, hard to be on top of everything.
I think there is some outstanding comments by Idwer who has good insight into supporting non-Linux distros please fix however we should try to land this change as its a very good idea!
--
To view, visit https://review.coreboot.org/c/flashrom/+/49599
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3f4370ccae2b64da3c4178243b192700d3d205d2
Gerrit-Change-Number: 49599
Gerrit-PatchSet: 4
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Thu, 11 Mar 2021 00:21:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-MessageType: comment
Angel Pons has submitted this change. ( https://review.coreboot.org/c/flashrom/+/51114 )
Change subject: usb_device.h: Improve `LIBUSB_ERROR` macro
......................................................................
usb_device.h: Improve `LIBUSB_ERROR` macro
Guard macro parameters and correct a typo in the parameter name.
TEST=Build with `make distclean && make VERSION=none -j` with and
without this patch, the flashrom executable does not change.
Change-Id: Ifc917b001713bc96adee46019d267f2090ef184a
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51114
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
M usb_device.h
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Paul Menzel: Looks good to me, approved
diff --git a/usb_device.h b/usb_device.h
index b2c7656..4abf751 100644
--- a/usb_device.h
+++ b/usb_device.h
@@ -34,7 +34,7 @@
* flashrom recognizes. It does so without displaying an error code allowing us
* to compare error codes against the library enumeration values.
*/
-#define LIBUSB_ERROR(eror_code) (0x20000 | -eror_code)
+#define LIBUSB_ERROR(error_code) (0x20000 | -(error_code))
/*
* The LIBUSB macro converts a libusb failure code into an error code that
--
To view, visit https://review.coreboot.org/c/flashrom/+/51114
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifc917b001713bc96adee46019d267f2090ef184a
Gerrit-Change-Number: 51114
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Evgeny Zinoviev.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51320 )
Change subject: chipset_enable: Mark QS67 as DEP
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/51320/comment/180b336a_408877b8
PS1, Line 9: MBA
MacBook Air? (I wouldn't use an abbreviation here)
--
To view, visit https://review.coreboot.org/c/flashrom/+/51320
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia31c9d336d6ffe441323616174018b0f6a8897bd
Gerrit-Change-Number: 51320
Gerrit-PatchSet: 1
Gerrit-Owner: Evgeny Zinoviev <me(a)ch1p.io>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Evgeny Zinoviev <me(a)ch1p.io>
Gerrit-Comment-Date: Sat, 06 Mar 2021 18:31:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/51243 )
Change subject: Enable dynamic memory allocation checks for cmocka unit tests.
......................................................................
Enable dynamic memory allocation checks for cmocka unit tests.
This commit enables the feature and makes changes to existing
files and tests.
I am writing more new tests with this.
Commit includes tests/flashrom.c because after enabling memory
checks the test started to fail (it used to leak memory indeed).
If you are wondering how to verify it works (because at the moment
all tests [still] pass so it’s not obvious that anything has
changed), then for example:
1) Remove free’s in flashbuses_to_text_test_success test, and it
will fail with message similar to this (line numbers from your local
source)
[ ERROR ] --- Blocks allocated...
../flashrom.c:1239: note: block 0x55f42304b640 allocated here
../flashrom.c:1239: note: block 0x55f42304b5c0 allocated here
../flashrom.c:1239: note: block 0x55f42304b3d0 allocated here
../flashrom.c:1239: note: block 0x55f42304b700 allocated here
../flashrom.c:1239: note: block 0x55f42304b780 allocated here
../flashrom.c:1239: note: block 0x55f42304bb00 allocated here
../flashrom.c:1239: note: block 0x55f42304b810 allocated here
ERROR: flashbuses_to_text_test_success leaked 7 block(s)
2) Add char *temp = malloc just before return from strcat_realloc
[ ERROR ] --- Blocks allocated...
../helpers.c:88: note: block 0x55a51307b6c0 allocated here
../helpers.c:88: note: block 0x55a51307b9e0 allocated here
ERROR: strcat_realloc_test_success leaked 2 block(s)
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M flashrom.c
M helpers.c
M tests/flashrom.c
M tests/helpers.c
M tests/meson.build
A tests/unittest.h
A unittest_env.h
7 files changed, 110 insertions(+), 12 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/43/51243/1
diff --git a/flashrom.c b/flashrom.c
index c89abad..8084fb9 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -39,6 +39,7 @@
#include "programmer.h"
#include "hwaccess.h"
#include "chipdrivers.h"
+#include "unittest_env.h"
const char flashrom_version[] = FLASHROM_VERSION;
const char *chip_to_probe = NULL;
diff --git a/helpers.c b/helpers.c
index 289848d..2465b54 100644
--- a/helpers.c
+++ b/helpers.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include "flash.h"
+#include "unittest_env.h"
/* Returns the minimum number of bits needed to represent the given address.
* FIXME: use mind-blowing implementation. */
diff --git a/tests/flashrom.c b/tests/flashrom.c
index 50464dd..000f954 100644
--- a/tests/flashrom.c
+++ b/tests/flashrom.c
@@ -16,36 +16,49 @@
#include <include/test.h>
#include "programmer.h"
+#include "unittest.h"
void flashbuses_to_text_test_success(void **state)
{
(void) state; /* unused */
enum chipbustype bustype;
+ char *text;
bustype = BUS_NONSPI;
- assert_string_equal(flashbuses_to_text(bustype), "Non-SPI");
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "Non-SPI");
+ free(text);
bustype |= BUS_PARALLEL;
- assert_string_not_equal(flashbuses_to_text(bustype), "Non-SPI, Parallel");
+ text = flashbuses_to_text(bustype);
+ assert_string_not_equal(text, "Non-SPI, Parallel");
+ free(text);
bustype = BUS_PARALLEL;
bustype |= BUS_LPC;
- assert_string_equal(flashbuses_to_text(bustype), "Parallel, LPC");
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "Parallel, LPC");
+ free(text);
bustype |= BUS_FWH;
//BUS_NONSPI = BUS_PARALLEL | BUS_LPC | BUS_FWH,
- assert_string_equal(flashbuses_to_text(bustype), "Non-SPI");
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "Non-SPI");
+ free(text);
bustype |= BUS_SPI;
- assert_string_equal(flashbuses_to_text(bustype), "Parallel, LPC, FWH, SPI");
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "Parallel, LPC, FWH, SPI");
+ free(text);
bustype |= BUS_PROG;
- assert_string_equal(
- flashbuses_to_text(bustype),
- "Parallel, LPC, FWH, SPI, Programmer-specific"
- );
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "Parallel, LPC, FWH, SPI, Programmer-specific");
+ free(text);
bustype = BUS_NONE;
- assert_string_equal(flashbuses_to_text(bustype), "None");
+ text = flashbuses_to_text(bustype);
+ assert_string_equal(text, "None");
+ free(text);
}
diff --git a/tests/helpers.c b/tests/helpers.c
index a920c15..7fc866e 100644
--- a/tests/helpers.c
+++ b/tests/helpers.c
@@ -16,10 +16,9 @@
#include <include/test.h>
#include "flash.h"
+#include "unittest.h"
#include <stdint.h>
-#include <stdlib.h>
-
void address_to_bits_test_success(void **state)
{
diff --git a/tests/meson.build b/tests/meson.build
index f0cb76d..6d65094 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -35,6 +35,7 @@
'-ffunction-sections',
'-fdata-sections',
# '-DSTANDALONE',
+ '-DUNIT_TEST_ENV',
'-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_DUMMY',
'-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""',
],
diff --git a/tests/unittest.h b/tests/unittest.h
new file mode 100644
index 0000000..a0a55fc
--- /dev/null
+++ b/tests/unittest.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright 2021 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * Header file for tests that want to enable cmocka's dynamic memory
+ * allocation checks (checks for memory leaks, buffer overflows and
+ * underflows).
+ * https://api.cmocka.org/group__cmocka__alloc.html
+ *
+ * Note: file under test need to include unittest_env.h
+ */
+
+#ifdef UNIT_TEST_ENV
+
+#define malloc test_malloc
+#define realloc test_realloc
+#define calloc test_calloc
+#define free test_free
+
+#endif
diff --git a/unittest_env.h b/unittest_env.h
new file mode 100644
index 0000000..d1e4b44
--- /dev/null
+++ b/unittest_env.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright 2021 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * Include this header into the file which needs to be covered by
+ * dynamic memory allocation checks (checks for memory leaks, buffer
+ * overflows and underflows).
+ * https://api.cmocka.org/group__cmocka__alloc.html
+ *
+ * Note: the test for the file needs to include tests/unittest.h
+ */
+
+#ifdef UNIT_TEST_ENV
+
+extern void* _test_malloc(const size_t size, const char* file, const int line);
+extern void* _test_realloc(void *ptr, const size_t size, const char* file, const int line);
+extern void* _test_calloc(const size_t number_of_elements, const size_t size,
+ const char* file, const int line);
+extern void _test_free(void* const ptr, const char* file, const int line);
+
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef calloc
+#undef calloc
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+#ifdef free
+#undef free
+#endif
+
+#define malloc(size) _test_malloc(size, __FILE__, __LINE__)
+#define realloc(ptr, size) _test_realloc(ptr, size, __FILE__, __LINE__)
+#define calloc(num, size) _test_calloc(num, size, __FILE__, __LINE__)
+#define free(ptr) _test_free(ptr, __FILE__, __LINE__)
+
+#endif
--
To view, visit https://review.coreboot.org/c/flashrom/+/51243
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f
Gerrit-Change-Number: 51243
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange