Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
tests: Add logging to STDOUT when __wrap function is called

Calls to __wrap functions are now logged to stdout, makes
it easier to understand what’s happening, really helps
when writing tests (and can be useful when debugging tests).

TEST=builds and ninja test
BUG=b:181803212

Change-Id: Ifcef55c9cdb7756c38dcc44fdc57cd88c3d65e70
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52496
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M tests/tests.c
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/tests.c b/tests/tests.c
index 3124607..5be4216 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -19,13 +19,16 @@
#include <stdio.h>

/* redefinitions/wrapping */
+#define LOG_ME printf("%s is called\n", __func__)
+
void __wrap_physunmap(void *virt_addr, size_t len)
{
- fprintf(stderr, "%s\n", __func__);
+ LOG_ME;
}
+
void *__wrap_physmap(const char *descr, uintptr_t phys_addr, size_t len)
{
- fprintf(stderr, "%s\n", __func__);
+ LOG_ME;
return NULL;
}

@@ -33,6 +36,8 @@
{
int ret = 0;

+ cmocka_set_message_output(CM_OUTPUT_STDOUT);
+
const struct CMUnitTest helpers_tests[] = {
cmocka_unit_test(address_to_bits_test_success),
cmocka_unit_test(bitcount_test_success),

To view, visit change 52496. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifcef55c9cdb7756c38dcc44fdc57cd88c3d65e70
Gerrit-Change-Number: 52496
Gerrit-PatchSet: 5
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged