Enable `lg2` logs to be printed to stderr in test
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Ie4922b3bf6adeeb1e6dbe8db7e76ed8ae605d754
diff --git a/test/meson.build b/test/meson.build
index ef8a3a9..e1ab8bb 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -62,11 +62,13 @@
test_deps = [
libhei_dep,
libpdbg_dep,
+ phosphor_logging_dep,
gtest_dep,
]
test_vars = [
pdbg_env,
+ 'LG2_FORCE_STDERR=true',
]
test_util_lib = static_library('test_util_lib',
diff --git a/test/pdbg-sim-only.cpp b/test/pdbg-sim-only.cpp
index 2e81fe5..98519d3 100644
--- a/test/pdbg-sim-only.cpp
+++ b/test/pdbg-sim-only.cpp
@@ -9,8 +9,8 @@
#include <assert.h>
#include <test/sim-hw-access.hpp>
+#include <util/log.hpp>
#include <util/pdbg.hpp>
-#include <util/trace.hpp>
//------------------------------------------------------------------------------
@@ -47,8 +47,10 @@
if (0 != rc)
{
- trace::err("SCOM read failure: target=%s addr=0x%0" PRIx64,
- getPath(i_target), i_addr);
+ lg2::error(
+ "SCOM read failure: target={SCOM_TARGET} addr={SCOM_ADDRESS}",
+ "SCOM_TARGET", getPath(i_target), "SCOM_ADDRESS",
+ (lg2::hex | lg2::field64), i_addr, "SCOM_ACCESS_RC", rc);
}
return rc;
@@ -65,8 +67,10 @@
if (0 != rc)
{
- trace::err("CFAM read failure: target=%s addr=0x%08x",
- getPath(i_target), i_addr);
+ lg2::error(
+ "CFAM read failure: target={CFAM_TARGET} addr={CFAM_ADDRESS}",
+ "CFAM_TARGET", getPath(i_target), "CFAM_ADDRESS",
+ (lg2::hex | lg2::field32), i_addr, "CFAM_ACCESS_RC", rc);
}
return rc;