Edward O'Callaghan has uploaded this change for review.

View Change

tests/chip_wp.c: Allow for logging during test

Hook logging callback so unit-tests print what they are doing.
This make debug far easier for a failing test.

BUG=none
TEST=ninja test.

Change-Id: I7ab0ff0915a76eea9857fc876493615c06193a37
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M tests/chip_wp.c
1 file changed, 24 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/74932/1
diff --git a/tests/chip_wp.c b/tests/chip_wp.c
index 2686f44..1fa6bb9 100644
--- a/tests/chip_wp.c
+++ b/tests/chip_wp.c
@@ -24,6 +24,12 @@
#include "programmer.h"
#include "tests.h"

+static int unittest_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap)
+{
+ if (level > FLASHROM_MSG_INFO) return 0;
+ return vfprintf(stderr, fmt, ap);
+}
+
/*
* Tests in this file do not use any mocking, because using write-protect
* emulation in dummyflasher programmer is sufficient
@@ -47,6 +53,8 @@
flashrom_layout_set(flash, *layout);
}

+ flashrom_set_log_callback((flashrom_log_callback *)&unittest_print_cb);
+
assert_int_equal(0, programmer_init(&programmer_dummy, programmer_param));
/* Assignment below normally happens while probing, but this test is not probing. */
flash->mst = &registered_masters[0];

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I7ab0ff0915a76eea9857fc876493615c06193a37
Gerrit-Change-Number: 74932
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange