Skip to content

Commit

Permalink
Method to execute testcases early in the boot
Browse files Browse the repository at this point in the history
A new CONFIG variable has been created that will trigger the
istep dispatcher to start the CXX unit test execution at some
point during the boot rather than waiting until the end.  This
is useful for quick targeted testing and also for early bringup
of new platforms.

CONFIG_EARLY_TESTCASES is the new flag, and it uses
ATTR_EARLY_TESTCASES_ISTEP to determine where in the boot to stop.

Changes were required in several testcases to either skip the
test completely (typically due to not having enough memory) or
to add additional logic to load new support libraries on demand.

The Axone platform has this flag enabled by default to execute
testcases at the end of istep 6.9 (host_gard).

Change-Id: I1da9479e2147d68102f44d60e064c3b79cc41bb6
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71693
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Feb 28, 2019
1 parent cbea08d commit 7c0b8df
Show file tree
Hide file tree
Showing 16 changed files with 234 additions and 18 deletions.
11 changes: 9 additions & 2 deletions src/build/configs/simics_axone.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#fetch dimm spd via i2c
set DJVPD_READ_FROM_HW

# You can enabled MVPD read from HW but adds time to IPL
Expand All @@ -6,7 +7,13 @@ set DJVPD_READ_FROM_HW
#skip enabling checkstop analysis until OCC is ready in simics
unset IPLTIME_CHECKSTOP_ANALYSIS

set AXONE_BRING_UP

#enable EEPROM caching
set SUPPORT_EEPROM_CACHING

#run cxx testcases during boot
set EARLY_TESTCASES

#Try to keep a list of things this does
# - skipping setting voltages in istep 8.12, nothing on other side of AVSbus
# in simics currently.
set AXONE_BRING_UP
4 changes: 2 additions & 2 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testmdia)
TESTCASE_MODULES += testpirformat
TESTCASE_MODULES += testi2c
TESTCASE_MODULES += testmbox
TESTCASE_MODULES += testrtloader
TESTCASE_MODULES += $(if $(CONFIG_EARLY_TESTCASES),,testrtloader)
TESTCASE_MODULES += testsbe
TESTCASE_MODULES += testsbeio
TESTCASE_MODULES += testerrl
Expand All @@ -255,7 +255,7 @@ TESTCASE_MODULES += testscom
TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testruntime)
TESTCASE_MODULES += testintr
TESTCASE_MODULES += testfapi2
TESTCASE_MODULES += $(if $(CONFIG_FSP_BUILD),,testnvram)
TESTCASE_MODULES += $(if $(CONFIG_EARLY_TESTCASES) && $(FSP_BUILD) ,,testnvram)
TESTCASE_MODULES += testsmf
TESTCASE_MODULES += testexpscom

Expand Down
6 changes: 6 additions & 0 deletions src/usr/cxxtest/HBconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config EARLY_TESTCASES
default n
help
Execute unit tests at the end of the istep specified in
EARLY_TESTCASES_ISTEP and then shut down.

19 changes: 16 additions & 3 deletions src/usr/fapi2/test/fapi2MvpdTestCxx.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -320,10 +320,15 @@ public:

void testMvpdGetPoundVBucket(void)
{
FAPI_INF("MvpdGetPoundVBucket Test entry... ");
int numTests = 0;
int numFails = 0;

#ifdef CONFIG_EARLY_TESTCASES
// Requires some prereqs of step7
FAPI_INF("Skipping poundv tests");
#else
fapi2::ReturnCode l_rc;
FAPI_INF("MvpdGetPoundVBucket Test entry... ");

// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_chipletList;
Expand Down Expand Up @@ -403,6 +408,7 @@ public:
FAPI_INF("Bucket for HUID: 0x%X is = %d", l_huid, voltageData.bucketId);
}

#endif
FAPI_INF("MvpdGetPoundVBucket:: Test Complete. %d/%d fails", numFails , numTests);
FAPI_INF("MvpdGetPoundVBucket Test exit... ");
}
Expand All @@ -411,9 +417,14 @@ public:
{
int numTests = 0;
int numFails = 0;
fapi2::ReturnCode l_rc;
FAPI_INF("MvpdGetPoundWBucket Test entry... ");

#ifdef CONFIG_EARLY_TESTCASES
// Requires some prereqs of step7
FAPI_INF("Skipping poundv tests");
#else
fapi2::ReturnCode l_rc;

// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_chipletList;

Expand Down Expand Up @@ -471,6 +482,8 @@ public:
FAPI_INF("Bucket for HUID: 0x%X is = %d", l_huid, vdmData.bucketId);
}

#endif

FAPI_INF("MvpdGetPoundWBucket:: Test Complete. %d/%d fails",
numFails,
numTests);
Expand Down
41 changes: 39 additions & 2 deletions src/usr/initservice/istepdispatcher/istepdispatcher.C
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
#include <devicefw/userif.H>
#include <p9_perv_scom_addresses.H>
// ---------------------------
#include <initservice/extinitserviceif.H>


namespace ISTEPS_TRACE
{
Expand Down Expand Up @@ -871,6 +873,9 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,

do {

TARGETING::Target* l_pTopLevel = NULL;
TARGETING::targetService().getTopLevelTarget(l_pTopLevel);

// If the step has valid work to be done, then execute it.
if(NULL != theStep)
{
Expand Down Expand Up @@ -973,8 +978,6 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
}

// Zero ATTR_RECONFIGURE_LOOP
TARGETING::Target* l_pTopLevel = NULL;
TARGETING::targetService().getTopLevelTarget(l_pTopLevel);
l_pTopLevel->setAttr<TARGETING::ATTR_RECONFIGURE_LOOP>(0);

// Read ATTR_ISTEP_PAUSE_ENABLE attribute
Expand Down Expand Up @@ -1122,6 +1125,40 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
INFO_MRK"doIstep: Empty Istep, nothing to do!" );
}

#ifdef CONFIG_EARLY_TESTCASES
// Check to see if we should run testcases here
TARGETING::ATTR_EARLY_TESTCASES_ISTEP_type l_runCxxIstep =
l_pTopLevel->getAttr<TARGETING::ATTR_EARLY_TESTCASES_ISTEP>();
if( (((i_istep & 0xFF) << 8) | (i_substep & 0xFF))
== l_runCxxIstep )
{
TRACFCOMP(g_trac_initsvc, "doIstep: Executing CXX testcases!");
uint32_t l_status = SHUTDOWN_STATUS_GOOD;

// - Run CXX testcases
err = INITSERVICE::executeUnitTests();
if(err)
{
errlCommit (err, INITSVC_COMP_ID);
l_status = SHUTDOWN_STATUS_UT_FAILED;
}

// - Call shutdown using payload base, and payload entry.
// NOTE: this call will not return if successful.
TARGETING::Target* l_pSys = NULL;
TARGETING::targetService().getTopLevelTarget( l_pSys );
uint64_t payloadBase =
l_pSys->getAttr<TARGETING::ATTR_PAYLOAD_BASE>();
payloadBase = (payloadBase * MEGABYTE);
uint64_t payloadEntry =
l_pSys->getAttr<TARGETING::ATTR_PAYLOAD_ENTRY>();
INITSERVICE::doShutdown( l_status,
false,
payloadBase,
payloadEntry );
}
#endif

} while (0); // if there was an error break here

if (!err && theStep)
Expand Down
41 changes: 40 additions & 1 deletion src/usr/runtime/test/hdatservicetest.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* COPYRIGHT International Business Machines Corp. 2012,2014 */
/* Contributors Listed Below - COPYRIGHT 2012,2019 */
/* [+] 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. */
Expand Down Expand Up @@ -38,6 +40,7 @@
#include "../hdatstructs.H"
#include "../errlud_hdat.H"
#include <runtime/runtime_reasoncodes.H>
#include <vfs/vfs.H>

/*
* To test with a custom HDAT do the following:
Expand Down Expand Up @@ -441,6 +444,42 @@ class HdatServiceTest: public CxxTest::TestSuite
#endif
}

// Handle the case where we are running the testcases before the
// libruntime.so module has been loaded
bool iv_loaded_libruntime;

HdatServiceTest()
: CxxTest::TestSuite(), iv_loaded_libruntime(false)
{
// Need to load up the runtime module if it isn't already loaded
if ( !VFS::module_is_loaded( "libruntime.so" ) )
{
errlHndl_t errhdl = VFS::module_load( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("HdatServiceTest> Failed to load libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
else
{
iv_loaded_libruntime = true;
}
}
}

~HdatServiceTest()
{
if( iv_loaded_libruntime )
{
errlHndl_t errhdl = VFS::module_unload( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("HdatServiceTest> Failed to unload libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
}
}

};


Expand Down
4 changes: 2 additions & 2 deletions src/usr/runtime/test/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2012,2018
# Contributors Listed Below - COPYRIGHT 2012,2019
# [+] International Business Machines Corp.
#
#
Expand All @@ -24,7 +24,7 @@
# IBM_PROLOG_END_TAG
ROOTPATH = ../../../..
MODULE = testruntime
TESTS += testpreverifiedlidmgr.H
TESTS += $(if $(CONFIG_EARLY_TESTCASES),,testpreverifiedlidmgr.H)
TESTS += test_checkHbResMemLimit.H
#@TODO RTC 132750
#TESTS += hdatservicetest.H
Expand Down
38 changes: 38 additions & 0 deletions src/usr/runtime/test/test_checkHbResMemLimit.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <runtime/interface.h>
#include <runtime/runtime_reasoncodes.H>
#include <vmmconst.h>
#include <vfs/vfs.H>

extern trace_desc_t* g_trac_runtime;

Expand Down Expand Up @@ -151,6 +152,43 @@ public:
}while(0);
TRACFCOMP(g_trac_runtime, "testAddressBelowHbResMemRange finished");
}


// Handle the case where we are running the testcases before the
// libruntime.so module has been loaded
bool iv_loaded_libruntime;

CheckHbResMemLimitTest()
: CxxTest::TestSuite(), iv_loaded_libruntime(false)
{
// Need to load up the runtime module if it isn't already loaded
if ( !VFS::module_is_loaded( "libruntime.so" ) )
{
errlHndl_t errhdl = VFS::module_load( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("CheckHbResMemLimitTest> Failed to load libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
else
{
iv_loaded_libruntime = true;
}
}
}

~CheckHbResMemLimitTest()
{
if( iv_loaded_libruntime )
{
errlHndl_t errhdl = VFS::module_unload( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("CheckHbResMemLimitTest> Failed to unload libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
}
}
};


Expand Down
37 changes: 37 additions & 0 deletions src/usr/runtime/test/testpreverifiedlidmgr.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <runtime/populate_hbruntime.H>
#include <pnor/pnorif.H>
#include <runtime/common/runtime_utils.H>
#include <vfs/vfs.H>

extern trace_desc_t* g_trac_runtime;

Expand Down Expand Up @@ -138,6 +139,42 @@ class PreVerifiedLidMgrTest : public CxxTest::TestSuite

TRACFCOMP( g_trac_runtime, EXIT_MRK"testLoadFromPnor complete" );
}

// Handle the case where we are running the testcases before the
// libruntime.so module has been loaded
bool iv_loaded_libruntime;

PreVerifiedLidMgrTest()
: CxxTest::TestSuite(), iv_loaded_libruntime(false)
{
// Need to load up the runtime module if it isn't already loaded
if ( !VFS::module_is_loaded( "libruntime.so" ) )
{
errlHndl_t errhdl = VFS::module_load( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("PreVerifiedLidMgrTest> Failed to load libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
else
{
iv_loaded_libruntime = true;
}
}
}

~PreVerifiedLidMgrTest()
{
if( iv_loaded_libruntime )
{
errlHndl_t errhdl = VFS::module_unload( "libruntime.so" );
if ( errhdl )
{
TS_FAIL("PreVerifiedLidMgrTest> Failed to unload libruntime.so");
errlCommit(errhdl,RUNTIME_COMP_ID);
}
}
}
};

#endif
17 changes: 17 additions & 0 deletions src/usr/targeting/common/xmltohb/attribute_types_hb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@
<writeable/>
</attribute>

<attribute>
<id>EARLY_TESTCASES_ISTEP</id>
<description>
Indicates which istep we should execute the CXX testcases after, if
CONFIG_EARLY_TESTCASES is set.
Format: 0xMMmm, where MM=major step, mm=minor step, e.g. 6.9=0x0609.
</description>
<simpleType>
<uint16_t>
<!-- Default to running as soon as Hostboot is able -->
<default>0x0609</default>
</uint16_t>
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
</attribute>

<attribute>
<id>EEPROM_PAGE_ARRAY</id>
<description>
Expand Down
4 changes: 4 additions & 0 deletions src/usr/targeting/common/xmltohb/simics_AXONE.system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@
<id>X_EREPAIR_THRESHOLD_MNFG</id>
<default>0</default>
</attribute>
<attribute>
<id>EARLY_TESTCASES_ISTEP</id>
<default>0x0609</default>
</attribute>
</targetInstance>

<!-- ===================================================================== -->
Expand Down

0 comments on commit 7c0b8df

Please sign in to comment.