diff options
Diffstat (limited to 'src/usr/runtime/test/hdatservicetest.H')
-rw-r--r-- | src/usr/runtime/test/hdatservicetest.H | 41 |
1 files changed, 40 insertions, 1 deletions
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 <runtime/runtime_reasoncodes.H> +#include <vfs/vfs.H> /* * 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); + } + } + } + }; |