From 7c0b8df175832b8ffb7510977283c0c390be9c8c Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Mon, 11 Feb 2019 11:47:13 -0600 Subject: Method to execute testcases early in the boot 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 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes Reviewed-by: Roland Veloz Reviewed-by: Matt Derksen Reviewed-by: William G. Hoffa --- src/usr/runtime/test/hdatservicetest.H | 41 +++++++++++++++++++++++++- src/usr/runtime/test/makefile | 4 +-- src/usr/runtime/test/test_checkHbResMemLimit.H | 38 ++++++++++++++++++++++++ src/usr/runtime/test/testpreverifiedlidmgr.H | 37 +++++++++++++++++++++++ 4 files changed, 117 insertions(+), 3 deletions(-) (limited to 'src/usr/runtime') diff --git a/src/usr/runtime/test/hdatservicetest.H b/src/usr/runtime/test/hdatservicetest.H index cfd70ddfb..0fff39e5b 100644 --- a/src/usr/runtime/test/hdatservicetest.H +++ b/src/usr/runtime/test/hdatservicetest.H @@ -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. */ @@ -38,6 +40,7 @@ #include "../hdatstructs.H" #include "../errlud_hdat.H" #include +#include /* * To test with a custom HDAT do the following: @@ -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); + } + } + } + }; diff --git a/src/usr/runtime/test/makefile b/src/usr/runtime/test/makefile index b948c1a16..a5fec043d 100644 --- a/src/usr/runtime/test/makefile +++ b/src/usr/runtime/test/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2018 +# Contributors Listed Below - COPYRIGHT 2012,2019 # [+] International Business Machines Corp. # # @@ -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 diff --git a/src/usr/runtime/test/test_checkHbResMemLimit.H b/src/usr/runtime/test/test_checkHbResMemLimit.H index e2ab9ca41..234f26426 100644 --- a/src/usr/runtime/test/test_checkHbResMemLimit.H +++ b/src/usr/runtime/test/test_checkHbResMemLimit.H @@ -32,6 +32,7 @@ #include #include #include +#include extern trace_desc_t* g_trac_runtime; @@ -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); + } + } + } }; diff --git a/src/usr/runtime/test/testpreverifiedlidmgr.H b/src/usr/runtime/test/testpreverifiedlidmgr.H index 78fcbd95c..7b47bf98f 100644 --- a/src/usr/runtime/test/testpreverifiedlidmgr.H +++ b/src/usr/runtime/test/testpreverifiedlidmgr.H @@ -33,6 +33,7 @@ #include #include #include +#include extern trace_desc_t* g_trac_runtime; @@ -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 -- cgit v1.2.1