kfdtest: track Test Status in syslog

Track Test Status in syslog, it will help understand
sys log assoicated with test cases.

Change-Id: I7c0749102db9bc73d6ae3a237ec347a8fefb12e9
Signed-off-by: James Zhu <James.Zhu@amd.com>
This commit is contained in:
James Zhu
2022-11-29 17:08:00 -05:00
parent 7787a039bd
commit 7db29c4797
@@ -21,6 +21,8 @@
*
*/
#include <syslog.h>
#include "KFDBaseComponentTest.hpp"
#include "KFDTestUtil.hpp"
@@ -70,6 +72,14 @@ void KFDBaseComponentTest::SetUp() {
m_pAsm = new Assembler(GetGfxVersion(nodeProperties));
const testing::TestInfo* curr_test_info =
::testing::UnitTest::GetInstance()->current_test_info();
openlog("KFDTEST", LOG_CONS , LOG_USER);
syslog(LOG_INFO, "[Node#%03d] STARTED ========== %s.%s ==========",
m_NodeInfo.HsaDefaultGPUNode(),
curr_test_info->test_case_name(), curr_test_info->name());
ROUTINE_END
}
@@ -92,6 +102,20 @@ void KFDBaseComponentTest::TearDown() {
delete m_pAsm;
m_pAsm = nullptr;
const testing::TestInfo* curr_test_info =
::testing::UnitTest::GetInstance()->current_test_info();
if (curr_test_info->result()->Passed())
syslog(LOG_INFO, "[Node#%03d] PASSED ========== %s.%s ==========",
m_NodeInfo.HsaDefaultGPUNode(),
curr_test_info->test_case_name(), curr_test_info->name());
else
syslog(LOG_WARNING, "[Node#%03d] FAILED ========== %s.%s ==========",
m_NodeInfo.HsaDefaultGPUNode(),
curr_test_info->test_case_name(), curr_test_info->name());
closelog();
ROUTINE_END
}