From 4648dad462fddbd4e4bd829b04b1a7090be409b5 Mon Sep 17 00:00:00 2001 From: Ilya Smirnov Date: Tue, 30 Jan 2018 14:46:48 -0600 Subject: Populate the Severity of PLAT Errors An issue was observed where recovered PLAT error logs were not being properly hidden/skipped and incorrect severity was assigned to those error logs. The reason is that the path of code that PLAT errors take fails to overwrite the default severity (unrecoverable). A fix is to explicitly set the severity of all errors at the end of rcToErrl. Change-Id: Ib0aff72a800e0ed7a5b48e753049d2f3422406b4 CQ:SW410923 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53221 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes Reviewed-by: Prachi Gupta Reviewed-by: Daniel M. Crowell --- src/usr/fapi2/test/fapi2CreatePlatLogTest.H | 218 ++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 src/usr/fapi2/test/fapi2CreatePlatLogTest.H (limited to 'src/usr/fapi2/test') diff --git a/src/usr/fapi2/test/fapi2CreatePlatLogTest.H b/src/usr/fapi2/test/fapi2CreatePlatLogTest.H new file mode 100644 index 000000000..3cccd74c1 --- /dev/null +++ b/src/usr/fapi2/test/fapi2CreatePlatLogTest.H @@ -0,0 +1,218 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapi2/test/fapi2CreatePlatLogTest.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#include +#include +#include +#include +#include +#include +#include + +extern trace_desc_t* g_trac_runtime; + +class CreatePlatLogTest : public CxxTest::TestSuite +{ +public: + + void testCreatePlatLogCreatorFapi2() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2 running"); + + fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_INVALID_ATTR_GET; + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + createPlatLog(l_rc, l_sev); + errlHndl_t l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_RECOVERED passed"); + } + l_rc.forgetData(); + + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_PREDICTIVE passed"); + } + l_rc.forgetData(); + + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2 done"); + } + + void testCreatePlatLogCreatorPlat() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat running"); + + fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA; + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + // Allocate a fake error log since PLAT code path expects a non-null ptr + errlHndl_t l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + ERRORLOG::ERRL_FIRST_MODULE_ID, + fapi2::RC_HWP_GENERATED_ERROR, + ERRORLOG::ERRL_TEST_REASON_CODE); + l_rc.setPlatDataPtr(reinterpret_cast(l_errl)); + + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_RECOVERED passed"); + } + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_PREDICTIVE passed"); + } + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat done"); + } + + void testCreatePlatLogCreatorHwp() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp running"); + + fapi2::ReturnCode l_rc = 0x00000001; // Fake return code wit creator == HWP + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + createPlatLog(l_rc, l_sev); + errlHndl_t l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_RECOVERED passed"); + } + l_rc.forgetData(); + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_PREDICTIVE passed"); + } + l_rc.forgetData(); + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp done"); + } +}; + -- cgit v1.2.3