diff options
| -rw-r--r-- | src/makefile | 3 | ||||
| -rw-r--r-- | src/usr/fapi2/test/fapi2GetVpdTest.H | 42 | ||||
| -rw-r--r-- | src/usr/pnor/test/pnorrptest.H | 212 |
3 files changed, 142 insertions, 115 deletions
diff --git a/src/makefile b/src/makefile index 0c456373d..0278a53c9 100644 --- a/src/makefile +++ b/src/makefile @@ -241,8 +241,7 @@ TESTCASE_MODULES += testsyslib TESTCASE_MODULES += testscom TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testruntime) TESTCASE_MODULES += testintr -# RTC:181401 figure out why we are seeing a data storage exception during fapi2 tests -#TESTCASE_MODULES += testfapi2 +TESTCASE_MODULES += testfapi2 #****************************************************************** #KNOWN ISSUES (I might let these run but there is something wrong) diff --git a/src/usr/fapi2/test/fapi2GetVpdTest.H b/src/usr/fapi2/test/fapi2GetVpdTest.H index a72acedbe..8a8dc0849 100644 --- a/src/usr/fapi2/test/fapi2GetVpdTest.H +++ b/src/usr/fapi2/test/fapi2GetVpdTest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -35,6 +35,9 @@ #include <cxxtest/TestSuite.H> #include <getVpdTest.H> +#include <pnor/pnorif.H> +#include <errl/errlentry.H> +#include <errl/errlmanager.H> class GetVPDTest : public CxxTest::TestSuite { @@ -43,19 +46,42 @@ public: void testGetVPD(void) { - testGetVPD_MR(); +#ifdef CONFIG_SECUREBOOT + errlHndl_t pError=NULL; + do + { + pError = PNOR::loadSecureSection(PNOR::MEMD); + if(pError) + { + TS_FAIL("testGetVPD:: failed to load MEMD secure section"); + ERRORLOG::errlCommit(pError,PNOR_COMP_ID); + break; + } +#endif + testGetVPD_MR(); + + testGetVPD_MT(); - testGetVPD_MT(); + testDecode_MR(); - testDecode_MR(); + testDecode_MT(); - testDecode_MT(); + testGetVPD_Override(); - testGetVPD_Override(); + testGetVPD_DQ(); - testGetVPD_DQ(); + testGetVPD_CK(); +#ifdef CONFIG_SECUREBOOT + pError = PNOR::unloadSecureSection(PNOR::MEMD); + if(pError) + { + TS_FAIL("testGetVPD:: failed to unload MEMD secure section"); + ERRORLOG::errlCommit(pError,PNOR_COMP_ID); + break; + } + } while(0); +#endif - testGetVPD_CK(); } }; // GetVPDTest class diff --git a/src/usr/pnor/test/pnorrptest.H b/src/usr/pnor/test/pnorrptest.H index c0267ebd2..5f1db820a 100644 --- a/src/usr/pnor/test/pnorrptest.H +++ b/src/usr/pnor/test/pnorrptest.H @@ -820,111 +820,113 @@ class PnorRpTest : public CxxTest::TestSuite /** * @brief Tests loading and unloading a secure section */ - void test_loadUnloadSecureSection() - { - // @RTC 156118 Right now these tests just ensure the - // APIs are callable; they should return success always - // until 156118 implements the real support. At that time - // this testcase should be updated. -#ifdef CONFIG_SECUREBOOT - errlHndl_t pError=NULL; - do { - - if (!PNOR::isEnforcedSecureSection(PNOR::MEMD)) - { - break; - } - - pError = PNOR::loadSecureSection(PNOR::MEMD); - if(pError != NULL) - { - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "loadSecureSection returned an error"); - ERRORLOG::errlCommit(pError,PNOR_COMP_ID); - break; - } - - pError = PNOR::unloadSecureSection(PNOR::MEMD); - if(pError != NULL) - { - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "unloadSecureSection returned an error"); - ERRORLOG::errlCommit(pError,PNOR_COMP_ID); - break; - } - - // try loading MEMD a few times - for (int i=0; i<10; i++) - { - pError = PNOR::loadSecureSection(PNOR::MEMD); - if(pError != nullptr) - { - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "loadSecureSection returned an error on MEMD section load attempt %i",i); - break; - } - } - if (pError != nullptr) - { - ERRORLOG::errlCommit(pError,PNOR_COMP_ID); - break; - } - - - // try unloading MEMD the exact same number of times we loaded it - for (int i=0; i<10; i++) - { - pError = PNOR::unloadSecureSection(PNOR::MEMD); - if(pError != nullptr) - { - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "loadSecureSection returned an error on MEMD section unload attempt %i", i); - break; - } - } - if (pError != nullptr) - { - ERRORLOG::errlCommit(pError,PNOR_COMP_ID); - break; - } - - // TODO RTC 181272 - // In order for the below test to work, we need to make sure that - // MEMD is never actually being loaded or unloaded during this test. - // Since all of the tests run in parallel, we can't really - // guarantee this completely if someone decides to write a test for - // MEMD, so ideally we would need some kind of mutex to prevent this. - - // Try to unload the secure section one extra time - // We expect to see an error log - pError = PNOR::unloadSecureSection(PNOR::MEMD); - if(pError == nullptr) - { - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "unloadSecureSection failed to return error on extra invoke"); - break; - } - else - { - if(pError->reasonCode() != PNOR::RC_EXTERNAL_ERROR || - pError->moduleId() != PNOR::MOD_PNORRP_LOADUNLOADSECURESECTION) - { - ERRORLOG::errlCommit(pError, PNOR_COMP_ID); - TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " - "unloadSecureSection return an unexpected error"); - break; - } - else - { - // passed the test - delete pError; - pError = nullptr; - } - } - - } while (0); -#endif - } + // TODO RTC: 181598 Test case cannot used MEMD to test loads and unloads. + // This test should use its own special pnor section to test this functionality. +// void test_loadUnloadSecureSection() +// { +// // @RTC 156118 Right now these tests just ensure the +// // APIs are callable; they should return success always +// // until 156118 implements the real support. At that time +// // this testcase should be updated. +// #ifdef CONFIG_SECUREBOOT +// errlHndl_t pError=NULL; +// do { +// +// if (!PNOR::isEnforcedSecureSection(PNOR::MEMD)) +// { +// break; +// } +// +// pError = PNOR::loadSecureSection(PNOR::MEMD); +// if(pError != NULL) +// { +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "loadSecureSection returned an error"); +// ERRORLOG::errlCommit(pError,PNOR_COMP_ID); +// break; +// } +// +// pError = PNOR::unloadSecureSection(PNOR::MEMD); +// if(pError != NULL) +// { +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "unloadSecureSection returned an error"); +// ERRORLOG::errlCommit(pError,PNOR_COMP_ID); +// break; +// } +// +// // try loading MEMD a few times +// for (int i=0; i<10; i++) +// { +// pError = PNOR::loadSecureSection(PNOR::MEMD); +// if(pError != nullptr) +// { +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "loadSecureSection returned an error on MEMD section load attempt %i",i); +// break; +// } +// } +// if (pError != nullptr) +// { +// ERRORLOG::errlCommit(pError,PNOR_COMP_ID); +// break; +// } +// +// +// // try unloading MEMD the exact same number of times we loaded it +// for (int i=0; i<10; i++) +// { +// pError = PNOR::unloadSecureSection(PNOR::MEMD); +// if(pError != nullptr) +// { +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "loadSecureSection returned an error on MEMD section unload attempt %i", i); +// break; +// } +// } +// if (pError != nullptr) +// { +// ERRORLOG::errlCommit(pError,PNOR_COMP_ID); +// break; +// } +// +// // TODO RTC 181272 +// // In order for the below test to work, we need to make sure that +// // MEMD is never actually being loaded or unloaded during this test. +// // Since all of the tests run in parallel, we can't really +// // guarantee this completely if someone decides to write a test for +// // MEMD, so ideally we would need some kind of mutex to prevent this. +// +// // Try to unload the secure section one extra time +// // We expect to see an error log +// pError = PNOR::unloadSecureSection(PNOR::MEMD); +// if(pError == nullptr) +// { +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "unloadSecureSection failed to return error on extra invoke"); +// break; +// } +// else +// { +// if(pError->reasonCode() != PNOR::RC_EXTERNAL_ERROR || +// pError->moduleId() != PNOR::MOD_PNORRP_LOADUNLOADSECURESECTION) +// { +// ERRORLOG::errlCommit(pError, PNOR_COMP_ID); +// TS_FAIL("PnorRpTest::test_loadUnloadSecureSection: " +// "unloadSecureSection return an unexpected error"); +// break; +// } +// else +// { +// // passed the test +// delete pError; +// pError = nullptr; +// } +// } +// +// } while (0); +// #endif +// } }; |

