diff options
author | Adam Muhle <armuhle@us.ibm.com> | 2013-01-21 16:52:43 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-02-14 15:38:34 -0600 |
commit | a753459c20affff821477924808ea5b9412504c5 (patch) | |
tree | 32bc3f2581564f53167440b76cb7ad1db3a8fe58 /src/usr/vpd/test | |
parent | 5f5ecb46d1838847dedd33791d4da86d3df39638 (diff) | |
download | talos-hostboot-a753459c20affff821477924808ea5b9412504c5.tar.gz talos-hostboot-a753459c20affff821477924808ea5b9412504c5.zip |
CVPD Device Driver updates.
Implemented Device Driver support for Centaur VPD.
Since CVPD is almost identical to MVPD, I moved the MVPD
code to a base class so the actual logic is now common between
the two. To support CVPD in the standalone configs, the
hb-preload script was updated to populate the CVPD partition
as well. I also started migrating the VPD code to a common
trace buffer.
RTC: 44009
Change-Id: I6e96d5e993d6d74d40df3d296cdcf8f34e4b5cc5
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3029
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/vpd/test')
-rwxr-xr-x | src/usr/vpd/test/cvpdtest.H | 744 | ||||
-rwxr-xr-x | src/usr/vpd/test/mvpdtest.H | 739 |
2 files changed, 1052 insertions, 431 deletions
diff --git a/src/usr/vpd/test/cvpdtest.H b/src/usr/vpd/test/cvpdtest.H new file mode 100755 index 000000000..b9bdf2e7d --- /dev/null +++ b/src/usr/vpd/test/cvpdtest.H @@ -0,0 +1,744 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/vpd/test/cvpdtest.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __CVPDTEST_H +#define __CVPDTEST_H + +/** + * @file cvpdtest.H + * + * @brief Test cases for CVPD code + */ +#include <sys/time.h> + +#include <cxxtest/TestSuite.H> +#include <errl/errlmanager.H> +#include <errl/errlentry.H> +#include <devicefw/driverif.H> +#include <targeting/common/predicates/predicatectm.H> + +#include <vpd/cvpdenums.H> +#include <vpd/vpdreasoncodes.H> +#include "../cvpd.H" +#include "../ipvpd.H" + + +extern trace_desc_t* g_trac_vpd; + +using namespace TARGETING; + +/** + * @brief Structure to define record/keyword pairs for CVPD tests. + */ +struct cvpdTestData +{ + IpVpdFacade::ipVpdRecord record; + IpVpdFacade::ipVpdRecord keyword; +}; + +/** + * @brief Data sample to be used for CVPD testing. + * NOTE: By reading this entire list, it also validates that the records + * and keywords that we expect to be there are actually there... + */ +cvpdTestData cvpdData[] = +{ + { CVPD::VEIR, CVPD::pdI }, + { CVPD::MER0, CVPD::pdI }, + +}; + +void getMembufTargets( TargetHandleList & o_membufList ) +{ + // Get top level system target + TARGETING::TargetService & tS = TARGETING::targetService(); + TARGETING::Target * sysTarget = NULL; + tS.getTopLevelTarget( sysTarget ); + assert( sysTarget != NULL ); + + // Get a Membuf Target + TARGETING::PredicateCTM predMemb( TARGETING::CLASS_CHIP, + TARGETING::TYPE_MEMBUF ); + tS.getAssociated( o_membufList, + sysTarget, + TARGETING::TargetService::CHILD, + TARGETING::TargetService::ALL, + &predMemb ); + + TRACDCOMP( g_trac_vpd, + "getMembufTargets() - found %d Memory Buffers", + o_membufList.size() ); + + return; +} + +TARGETING::Target* getFunctionalMembufTarget() +{ + TARGETING::Target * theTarget = NULL; + TRACDCOMP( g_trac_vpd, + "getFunctionalMembufTarget() - Finding a membuf" ); + + do { + // Get the Memory Buffer targets + TargetHandleList membufList; + getMembufTargets( membufList ); + + if( ( 0 == membufList.size() ) || + ( NULL == membufList[0] ) ) + { + continue; // add continue because have no Membuf targets + } + + for(uint32_t i=0; i<membufList.size(); i++) + { + if(membufList[i]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + { + theTarget = membufList[i]; + break; + } + } + }while(0); + + return theTarget; + +} + +class CVPDTest: public CxxTest::TestSuite +{ + public: + + /** + * @brief This function will test CVPD reads. + */ + void testCvpdRead ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + uint64_t theRecord = 0x0; + uint64_t theKeyword = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdRead()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdRead() - No Functional Targets found!"); + break; + } + + uint8_t * theData = NULL; + size_t theSize = 0; + const uint32_t numCmds = sizeof(cvpdData)/sizeof(cvpdData[0]); + for( uint32_t curCmd = 0; curCmd < numCmds; curCmd++ ) + { + cmds++; + theRecord = (uint64_t)cvpdData[curCmd].record; + theKeyword = (uint64_t)cvpdData[curCmd].keyword; + err = deviceRead( theTarget, + NULL, + theSize, + DEVICE_CVPD_ADDRESS( theRecord, + theKeyword ) ); + + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdRead() - failure reading " + "keyword size!! rec: 0x%04x, kwd: 0x%04x", + theRecord, + theKeyword ); + TS_FAIL( "testCvpdRead() - Failure reading keyword size!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + + theData = static_cast<uint8_t*>(malloc( theSize )); + + // Read record/keyword pair + err = deviceRead( theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS( theRecord, + theKeyword ) ); + + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdRead() - Failure on Record: " + "0x%04x, keyword: 0x%04x, of size: 0x%04x " + "- test %d", + theRecord, + theKeyword, + theSize, curCmd ); + TS_FAIL( "testCvpdRead() - Failure during CVPD read!" ); + errlCommit( err, + VPD_COMP_ID ); + + // Free the data + if( NULL != theData ) + { + free( theData ); + theData = NULL; + } + continue; + } + + TRACDCOMP( g_trac_vpd, + INFO_MRK"testCvpdRead Results:" ); + for( uint32_t i = 0; i < theSize; i++ ) + { + TRACDCOMP( g_trac_vpd, + INFO_MRK" Byte[%d]: 0x%02x", + i, theData[i] ); + } + + // Free the data + if( NULL != theData ) + { + free( theData ); + theData = NULL; + } + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdRead - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test CVPD writes. + */ + void testCvpdWrite ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + uint8_t* testData = NULL; + uint8_t* origData = NULL; + uint8_t* verifyData = NULL; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdWrite()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdWrite() - No Functional Targets found!"); + break; + } + + // first figure out how big the keyword is + cmds++; + size_t theSize = 0; + err = deviceRead( theTarget, + testData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR,CVPD::pdI) ); + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdWrite() - failure getting size of VEIR/#I, RC=%.4X", + err->reasonCode() ); + TS_FAIL( "testCvpdWrite() - Failure calling deviceRead!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + + // save off the original data + origData = new uint8_t[theSize]; + cmds++; + err = deviceRead( theTarget, + origData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR,CVPD::pdI) ); + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdWrite() - failure reading VEIR/#I, RC=%.4X", + err->reasonCode() ); + TS_FAIL( "testCvpdWrite() - Failure calling deviceRead!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + TRACFBIN( g_trac_vpd, "testCvpdWrite() - orig=", + origData, theSize ); + + // fill it up with some dummy data + testData = new uint8_t[theSize]; + for( size_t x=0; x<theSize; x++ ) + { + testData[x] = x; + } + + // write the new data in + cmds++; + err = deviceWrite( theTarget, + testData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR,CVPD::pdI) ); + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdWrite() - failure writing VEIR/#I, RC=%.4X", + err->reasonCode() ); + TS_FAIL( "testCvpdWrite() - Failure calling deviceWrite!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + + // verify the data got written + cmds++; + verifyData = new uint8_t[theSize]; + err = deviceRead( theTarget, + verifyData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR,CVPD::pdI) ); + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdWrite() - failure reading VEIR/#I to verify, RC=%.4X", + err->reasonCode() ); + TS_FAIL( "testCvpdWrite() - Failure calling deviceRead!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + TRACFBIN( g_trac_vpd, "testCvpdWrite() - verif=", + verifyData, theSize ); + + // compare what we read to what we wrote + if( memcmp( testData, verifyData, theSize ) ) + { + fails++; + TRACFBIN( g_trac_vpd, "testCvpdWrite() - wrote=", + testData, theSize ); + TRACFBIN( g_trac_vpd, "testCvpdWrite() - read=", + verifyData, theSize ); + TS_FAIL( "testCvpdWrite - Data mismatch!" ); + } + + // put the original data back to be a good citizen + cmds++; + err = deviceWrite( theTarget, + origData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR,CVPD::pdI) ); + if( err ) + { + fails++; + TRACFCOMP( g_trac_vpd, + ERR_MRK"testCvpdWrite() - failure writing original data back into VEIR/#I, RC=%.4X", + err->reasonCode() ); + TS_FAIL( "testCvpdWrite() - Failure calling deviceRead!" ); + errlCommit( err, + VPD_COMP_ID ); + continue; + } + + } while( 0 ); + + if( NULL != testData ) + { + delete[] testData; + testData = NULL; + } + + if( NULL != origData ) + { + delete[] origData; + origData = NULL; + } + + if( NULL != verifyData ) + { + delete[] verifyData; + verifyData = NULL; + } + + if( cmds == 0 ) + { + TS_FAIL(x"testCvpdWrite - No tests ran, something is wrong..."); + } + + TRACFCOMP( g_trac_vpd, + "testCvpdWrite - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test that an error is generated when a + * record is passed in that cannot be found in the structure + * that defines the Records string representation. + */ + void testCvpdInvalidRecord ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdInvalidRecord()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdInvalidRecord() - No Functional Targets found!"); + break; + } + + + size_t theSize = 1; + uint8_t * theData = new uint8_t[theSize]; + + cmds++; + err = deviceRead( theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS( CVPD::CVPD_LAST_RECORD, + CVPD::pdI ) ); + + if( NULL == err ) + { + fails++; + TS_FAIL( "testCvpdInvalidRecord() - Error expected with " + "record of type CVPD_LAST_RECORD (0x%04x), but " + "no error returned!", + CVPD::CVPD_LAST_RECORD ); + } + else + { + delete err; + err = NULL; + } + + if( NULL != theData ) + { + delete theData; + theData = NULL; + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdInvalidRecord - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test for a record which is not in the TOC + * of the CVPD area. + */ + void testCvpdMissingRecord ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdMissingRecord()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdMissingRecord() - No Functional Targets found!"); + break; + } + + size_t theSize = 1; + uint8_t * theData = new uint8_t[theSize]; + + cmds++; + err = deviceRead( theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS( CVPD::CVPD_TEST_RECORD, + CVPD::pdI ) ); + + if( NULL == err ) + { + fails++; + TS_FAIL( "testCvpdMissingRecord() - "); + } + else + { + delete err; + err = NULL; + } + + if( NULL != theData ) + { + delete theData; + theData = NULL; + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdMissingRecord - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test for a keyword that cannot be found + * in the expected record + */ + void testCvpdMissingKeyword ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdMissingKeyword()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdMissingKeyword() - No Functional Targets found!"); + break; + } + + size_t theSize = 1; + uint8_t * theData = new uint8_t[theSize]; + + cmds++; + err = deviceRead(theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::CVPD_FIRST_RECORD, + CVPD::CVPD_TEST_KEYWORD)); + + if( NULL == err ) + { + fails++; + TS_FAIL("testCvpdMissingKeyword() - Expected error from " + "invalid Keyword missing from associated record!"); + } + else + { + delete err; + err = NULL; + } + + if( NULL != theData ) + { + delete theData; + theData = NULL; + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdMissingKeyword - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test that an error is generated when a + * keyword is passed in that cannot be found in the structure + * that defines the Keywords string representation. + */ + void testCvpdInvalidKeyword ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdInvalidKeyword()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdInvalidKeyword() - No Functional Targets found!"); + break; + } + + size_t theSize = 1; + uint8_t * theData = new uint8_t[theSize]; + + cmds++; + err = deviceRead(theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS(CVPD::VEIR, + CVPD::CVPD_LAST_KEYWORD)); + + if( NULL == err ) + { + fails++; + TS_FAIL( "testCvpdInvalidKeyword() - Error expected with " + "keyword of type CVPD_LAST_KEYWORD (0x%04x), but " + "no error returned!", + CVPD::CVPD_LAST_KEYWORD ); + } + else + { + delete err; + err = NULL; + } + + if( NULL != theData ) + { + delete theData; + theData = NULL; + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdInvalidKeyword - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test that an error is generated when a + * buffer that has an insufficient size is passed in to read a + * record/keyword. + */ + void testCvpdInvalidBufferSize ( void ) + { + errlHndl_t err = NULL; + uint64_t cmds = 0x0; + uint64_t fails = 0x0; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdInvalidBufferSize()" ); + + do + { + TARGETING::Target * theTarget = getFunctionalMembufTarget(); + if(theTarget == NULL) + { + TS_FAIL("testCvpdInvalidBufferSize() - No Functional Targets found!"); + break; + } + + uint8_t * theData = new uint8_t[1]; + size_t theSize = 0; + + cmds++; + err = deviceRead( theTarget, + theData, + theSize, + DEVICE_CVPD_ADDRESS( CVPD::VEIR, + CVPD::pdI ) ); + + if( NULL == err ) + { + fails++; + TS_FAIL( "testCvpdInvalidBufferSize() - Error was expected " + "for an invalid size of 0x0 for a CVPD read!" ); + } + else + { + delete err; + err = NULL; + } + + if( NULL != theData ) + { + delete theData; + theData = NULL; + } + } while( 0 ); + + TRACFCOMP( g_trac_vpd, + "testCvpdInvalidBufferSize - %d/%d fails", + fails, cmds ); + } + + /** + * @brief This function will test the numerical order of the cvpdRecords + * and cvpdKeywords structures. + */ + void testCvpdCheckStructOrder ( void ) + { + uint64_t fails = 0x0; + IpVpdFacade::ipVpdRecord prevRecord = CVPD::CVPD_FIRST_RECORD; + IpVpdFacade::ipVpdKeyword prevKeyword = CVPD::CVPD_FIRST_KEYWORD; + + TRACFCOMP( g_trac_vpd, + ENTER_MRK"testCvpdCheckStructOrder()" ); + + // Check the cvpdRecords structure for proper order + uint32_t entry = 0x0; + for( entry = 0; + entry < (sizeof(CVPD::cvpdRecords)/ + sizeof(CVPD::cvpdRecords[0])); + entry++ ) + { + if( !(CVPD::cvpdRecords[entry].record >= prevRecord) ) + { + fails++; + TS_FAIL( "testCvpdCheckStructOrder() - Record table out of " + "order! Cur Record: 0x%04x, Prev Record: 0x%04x", + CVPD::cvpdRecords[entry].record, + prevRecord ); + } + prevRecord = CVPD::cvpdRecords[entry].record; + } + + // Check the cvpdKeywords structure for proper order + for( entry = 0; + entry < (sizeof(CVPD::cvpdKeywords)/ + sizeof(CVPD::cvpdKeywords[0])); + entry++ ) + { + if( !(CVPD::cvpdKeywords[entry].keyword >= prevKeyword) ) + { + fails++; + TS_FAIL( "testCvpdCheckStructOrder() - Keyword table out of order! Cur Keyword: 0x%04x, Prev Keyword: 0x%04x", + CVPD::cvpdKeywords[entry].keyword, + prevKeyword ); + } + prevKeyword = CVPD::cvpdKeywords[entry].keyword; + } + + TRACFCOMP( g_trac_vpd, + "testCvpdCheckStructOrder - %d fails", + fails ); + } +}; + +#endif diff --git a/src/usr/vpd/test/mvpdtest.H b/src/usr/vpd/test/mvpdtest.H index a7685550e..94faefc58 100755 --- a/src/usr/vpd/test/mvpdtest.H +++ b/src/usr/vpd/test/mvpdtest.H @@ -39,20 +39,20 @@ #include <vpd/mvpdenums.H> #include <vpd/vpdreasoncodes.H> #include "../mvpd.H" +#include "../ipvpd.H" -extern trace_desc_t* g_trac_mvpd; +extern trace_desc_t* g_trac_vpd; using namespace TARGETING; -using namespace MVPD; /** * @brief Structure to define record/keyword pairs for MVPD tests. */ struct mvpdTestData { - mvpdRecord record; - mvpdKeyword keyword; + IpVpdFacade::ipVpdRecord record; + IpVpdFacade::ipVpdRecord keyword; }; /** @@ -62,157 +62,158 @@ struct mvpdTestData */ mvpdTestData mvpdData[] = { - { CRP0, VD }, - { CRP0, ED }, - { CRP0, TE }, - { CRP0, DD }, -// { CRP0, pdP }, // TODO - no #P in test data - { CRP0, ST }, - { CP00, VD }, - { CP00, PG }, -// { CP00, PK }, // TODO - no PK in test data - { CP00, pdR }, - { CP00, pdG }, - { CP00, pdV }, - { CP00, pdH }, -// { CP00, pdP }, // TODO - no #P in test data - { CP00, SB }, - { CP00, MK }, - { CP00, PB }, - { LRP4, VD }, - { LRP4, pdV }, - { LRP4, pdP }, - { LRP4, pdM }, - { LRP4, CH }, - { LRP5, VD }, - { LRP5, pdV }, - { LRP5, pdP }, - { LRP5, pdM }, - { LRP5, CH }, - { LRP6, VD }, - { LRP6, pdV }, - { LRP6, pdP }, - { LRP6, pdM }, - { LRP6, CH }, -/* // TODO no LRP7,LRP8,LRP9,LRPA,LRPB,LWPO,LWP1,LWP2,LWP3 in test data - { LRP7, VD }, - { LRP7, pdV }, - { LRP7, pdP }, - { LRP7, pdM }, - { LRP7, CH }, - { LRP8, VD }, - { LRP8, pdV }, - { LRP8, pdP }, - { LRP8, pdM }, - { LRP8, CH }, - { LRP9, VD }, - { LRP9, pdV }, - { LRP9, pdP }, - { LRP9, pdM }, - { LRP9, CH }, - { LRPA, VD }, - { LRPA, pdV }, - { LRPA, pdP }, - { LRPA, pdM }, - { LRPA, CH }, - { LRPB, VD }, - { LRPB, pdV }, - { LRPB, pdP }, - { LRPB, pdM }, - { LRPB, CH }, - { LRPC, VD }, - { LRPC, pdV }, - { LRPC, pdP }, - { LRPC, pdM }, - { LRPC, CH }, - { LRPD, VD }, - { LRPD, pdV }, - { LRPD, pdP }, - { LRPD, pdM }, - { LRPD, CH }, - { LRPE, VD }, - { LRPE, pdV }, - { LRPE, pdP }, - { LRPE, pdM }, - { LRPE, CH }, - { LWP0, VD }, - { LWP0, pd2 }, - { LWP0, pd3 }, - { LWP0, IN }, - { LWP1, VD }, - { LWP1, pd2 }, - { LWP1, pd3 }, - { LWP1, IN }, - { LWP2, VD }, - { LWP2, pd2 }, - { LWP2, pd3 }, - { LWP2, IN }, - { LWP3, VD }, - { LWP3, pd2 }, - { LWP3, pd3 }, - { LWP3, IN }, -*/ - { LWP4, VD }, - { LWP4, pd2 }, - { LWP4, pd3 }, - { LWP4, IN }, - { LWP5, VD }, - { LWP5, pd2 }, - { LWP5, pd3 }, - { LWP5, IN }, - { LWP6, VD }, - { LWP6, pd2 }, - { LWP6, pd3 }, - { LWP6, IN }, -/* // TODO no LWP7,LWP8,LWP9,LWPA,LWPB in test data - { LWP7, VD }, - { LWP7, pd2 }, - { LWP7, pd3 }, - { LWP7, IN }, - { LWP8, VD }, - { LWP8, pd2 }, - { LWP8, pd3 }, - { LWP8, IN }, - { LWP9, VD }, - { LWP9, pd2 }, - { LWP9, pd3 }, - { LWP9, IN }, - { LWPA, VD }, - { LWPA, pd2 }, - { LWPA, pd3 }, - { LWPA, IN }, - { LWPB, VD }, - { LWPB, pd2 }, - { LWPB, pd3 }, - { LWPB, IN }, - { LWPC, VD }, - { LWPC, pd2 }, - { LWPC, pd3 }, - { LWPC, IN }, - { LWPD, VD }, - { LWPD, pd2 }, - { LWPD, pd3 }, - { LWPD, IN }, - { LWPE, VD }, - { LWPE, pd2 }, - { LWPE, pd3 }, - { LWPE, IN }, -*/ - { VINI, DR }, - { VINI, VZ }, - { VINI, CC }, - { VINI, CE }, - { VINI, FN }, - { VINI, PN }, - { VINI, SN }, - { VINI, PR }, - { VINI, HE }, - { VINI, CT }, - { VINI, HW }, - - { VWML, pdI }, - - { MER0, pdI }, + { MVPD::CRP0, MVPD::VD }, + { MVPD::CRP0, MVPD::ED }, + { MVPD::CRP0, MVPD::TE }, + { MVPD::CRP0, MVPD::DD }, + //{ MVPD::CRP0, pdP }, // no #P in test data + { MVPD::CRP0, MVPD::ST }, + { MVPD::CP00, MVPD::VD }, + { MVPD::CP00, MVPD::PG }, + // { MVPD::CP00, MVPD::PK }, // no PK in test data + { MVPD::CP00, MVPD::pdR }, + { MVPD::CP00, MVPD::pdG }, + { MVPD::CP00, MVPD::pdV }, + { MVPD::CP00, MVPD::pdH }, + // { MVPD::CP00, pdP }, // no #P in test data + { MVPD::CP00, MVPD::SB }, + { MVPD::CP00, MVPD::MK }, + { MVPD::CP00, MVPD::PB }, + { MVPD::LRP4, MVPD::VD }, + { MVPD::LRP4, MVPD::pdV }, + { MVPD::LRP4, MVPD::pdP }, + { MVPD::LRP4, MVPD::pdM }, + { MVPD::LRP4, MVPD::CH }, + { MVPD::LRP5, MVPD::VD }, + { MVPD::LRP5, MVPD::pdV }, + { MVPD::LRP5, MVPD::pdP }, + { MVPD::LRP5, MVPD::pdM }, + { MVPD::LRP5, MVPD::CH }, + { MVPD::LRP6, MVPD::VD }, + { MVPD::LRP6, MVPD::pdV }, + { MVPD::LRP6, MVPD::pdP }, + { MVPD::LRP6, MVPD::pdM }, + { MVPD::LRP6, MVPD::CH }, + /* // no LRP7,LRP8,LRP9,LRPA,LRPB,LWPO,LWP1,LWP2,LWP3 + in test data + { MVPD::LRP7, VD }, + { MVPD::LRP7, MVPD::pdV }, + { MVPD::LRP7, MVPD::pdP }, + { MVPD::LRP7, MVPD::pdM }, + { MVPD::LRP7, MVPD::CH }, + { MVPD::LRP8, MVPD::VD }, + { MVPD::LRP8, MVPD::pdV }, + { MVPD::LRP8, MVPD::pdP }, + { MVPD::LRP8, MVPD::pdM }, + { MVPD::LRP8, MVPD::CH }, + { MVPD::LRP9, MVPD::VD }, + { MVPD::LRP9, MVPD::pdV }, + { MVPD::LRP9, MVPD::pdP }, + { MVPD::LRP9, MVPD::pdM }, + { MVPD::LRP9, MVPD::CH }, + { MVPD::LRPA, MVPD::VD }, + { MVPD::LRPA, MVPD::pdV }, + { MVPD::LRPA, MVPD::pdP }, + { MVPD::LRPA, MVPD::pdM }, + { MVPD::LRPA, MVPD::CH }, + { MVPD::LRPB, MVPD::VD }, + { MVPD::LRPB, MVPD::pdV }, + { MVPD::LRPB, MVPD::pdP }, + { MVPD::LRPB, MVPD::pdM }, + { MVPD::LRPB, MVPD::CH }, + { MVPD::LRPC, MVPD::VD }, + { MVPD::LRPC, MVPD::pdV }, + { MVPD::LRPC, MVPD::pdP }, + { MVPD::LRPC, MVPD::pdM }, + { MVPD::LRPC, MVPD::CH }, + { MVPD::LRPD, MVPD::VD }, + { MVPD::LRPD, MVPD::pdV }, + { MVPD::LRPD, MVPD::pdP }, + { MVPD::LRPD, MVPD::pdM }, + { MVPD::LRPD, MVPD::CH }, + { MVPD::LRPE, MVPD::VD }, + { MVPD::LRPE, MVPD::pdV }, + { MVPD::LRPE, MVPD::pdP }, + { MVPD::LRPE, MVPD::pdM }, + { MVPD::LRPE, MVPD::CH }, + { MVPD::LWP0, MVPD::VD }, + { MVPD::LWP0, MVPD::pd2 }, + { MVPD::LWP0, MVPD::pd3 }, + { MVPD::LWP0, MVPD::IN }, + { MVPD::LWP1, MVPD::VD }, + { MVPD::LWP1, MVPD::pd2 }, + { MVPD::LWP1, MVPD::pd3 }, + { MVPD::LWP1, MVPD::IN }, + { MVPD::LWP2, MVPD::VD }, + { MVPD::LWP2, MVPD::pd2 }, + { MVPD::LWP2, MVPD::pd3 }, + { MVPD::LWP2, MVPD::IN }, + { MVPD::LWP3, MVPD::VD }, + { MVPD::LWP3, MVPD::pd2 }, + { MVPD::LWP3, MVPD::pd3 }, + { MVPD::LWP3, MVPD::IN }, + */ + { MVPD::LWP4, MVPD::VD }, + { MVPD::LWP4, MVPD::pd2 }, + { MVPD::LWP4, MVPD::pd3 }, + { MVPD::LWP4, MVPD::IN }, + { MVPD::LWP5, MVPD::VD }, + { MVPD::LWP5, MVPD::pd2 }, + { MVPD::LWP5, MVPD::pd3 }, + { MVPD::LWP5, MVPD::IN }, + { MVPD::LWP6, MVPD::VD }, + { MVPD::LWP6, MVPD::pd2 }, + { MVPD::LWP6, MVPD::pd3 }, + { MVPD::LWP6, MVPD::IN }, + /* // no LWP7,LWP8,LWP9,LWPA,LWPB in test data + { MVPD::LWP7, MVPD::VD }, + { MVPD::LWP7, MVPD::pd2 }, + { MVPD::LWP7, MVPD::pd3 }, + { MVPD::LWP7, MVPD::IN }, + { MVPD::LWP8, MVPD::VD }, + { MVPD::LWP8, MVPD::pd2 }, + { MVPD::LWP8, MVPD::pd3 }, + { MVPD::LWP8, MVPD::IN }, + { MVPD::LWP9, MVPD::VD }, + { MVPD::LWP9, MVPD::pd2 }, + { MVPD::LWP9, MVPD::pd3 }, + { MVPD::LWP9, MVPD::IN }, + { MVPD::LWPA, MVPD::VD }, + { MVPD::LWPA, MVPD::pd2 }, + { MVPD::LWPA, MVPD::pd3 }, + { MVPD::LWPA, MVPD::IN }, + { MVPD::LWPB, MVPD::VD }, + { MVPD::LWPB, MVPD::pd2 }, + { MVPD::LWPB, MVPD::pd3 }, + { MVPD::LWPB, MVPD::IN }, + { MVPD::LWPC, MVPD::VD }, + { MVPD::LWPC, MVPD::pd2 }, + { MVPD::LWPC, MVPD::pd3 }, + { MVPD::LWPC, MVPD::IN }, + { MVPD::LWPD, MVPD::VD }, + { MVPD::LWPD, MVPD::pd2 }, + { MVPD::LWPD, MVPD::pd3 }, + { MVPD::LWPD, MVPD::IN }, + { MVPD::LWPE, MVPD::VD }, + { MVPD::LWPE, MVPD::pd2 }, + { MVPD::LWPE, MVPD::pd3 }, + { MVPD::LWPE, MVPD::IN }, + */ + { MVPD::VINI, MVPD::DR }, + { MVPD::VINI, MVPD::VZ }, + { MVPD::VINI, MVPD::CC }, + { MVPD::VINI, MVPD::CE }, + { MVPD::VINI, MVPD::FN }, + { MVPD::VINI, MVPD::PN }, + { MVPD::VINI, MVPD::SN }, + { MVPD::VINI, MVPD::PR }, + { MVPD::VINI, MVPD::HE }, + { MVPD::VINI, MVPD::CT }, + { MVPD::VINI, MVPD::HW }, + + { MVPD::VWML, MVPD::pdI }, + + { MVPD::MER0, MVPD::pdI }, }; void getProcTargets( TargetHandleList & o_procList ) @@ -232,17 +233,50 @@ void getProcTargets( TargetHandleList & o_procList ) TARGETING::TargetService::ALL, &predProc ); - TRACDCOMP( g_trac_mvpd, + TRACDCOMP( g_trac_vpd, "getProcTargets() - found %d Processors", o_procList.size() ); return; } +TARGETING::Target* getFunctionalProcTarget() +{ + TARGETING::Target * theTarget = NULL; + TRACDCOMP( g_trac_vpd, + "getFunctionalProcTarget() - Finding a processor" ); + + do { + // Get the Processor targets + TargetHandleList procList; + getProcTargets( procList ); + + if( ( 0 == procList.size() ) || + ( NULL == procList[0] ) ) + { + continue; // add continue because have no Proc targets + } + + for(uint32_t i=0; i<procList.size(); i++) + { + if(procList[i]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + { + theTarget = procList[i]; + break; + } + } + }while(0); + + return theTarget; + +} + + class MVPDTest: public CxxTest::TestSuite { public: + /** * @brief This function will test MVPD reads. */ @@ -254,38 +288,16 @@ class MVPDTest: public CxxTest::TestSuite uint64_t theRecord = 0x0; uint64_t theKeyword = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdRead()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - TRACFCOMP( g_trac_mvpd, - "testMvpdRead() - No Proc Targets found!" ); - - continue; // add continue because have no proc targets - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) - { - - TRACFCOMP( g_trac_mvpd, - "testMvpdRead() - Proc Target [0] non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdRead() - No Functional Targets found!"); + break; } uint8_t * theData = NULL; @@ -305,12 +317,12 @@ class MVPDTest: public CxxTest::TestSuite if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdRead() - failure reading " "keyword size!! rec: 0x%04x, kwd: 0x%04x", theRecord, theKeyword ); - TS_FAIL( "testMvpdRead() - Failure reading keyword size!" ); + TS_FAIL("testMvpdRead() -Failure reading keyword size!"); errlCommit( err, VPD_COMP_ID ); continue; @@ -328,7 +340,7 @@ class MVPDTest: public CxxTest::TestSuite if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdRead() - Failure on Record: " "0x%04x, keyword: 0x%04x, of size: 0x%04x " "- test %d", @@ -348,11 +360,11 @@ class MVPDTest: public CxxTest::TestSuite continue; } - TRACDCOMP( g_trac_mvpd, + TRACDCOMP( g_trac_vpd, INFO_MRK"testMvpdRead Results:" ); for( uint32_t i = 0; i < theSize; i++ ) { - TRACDCOMP( g_trac_mvpd, + TRACDCOMP( g_trac_vpd, INFO_MRK" Byte[%d]: 0x%02x", i, theData[i] ); } @@ -366,7 +378,7 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdRead - %d/%d fails", fails, cmds ); } @@ -383,50 +395,29 @@ class MVPDTest: public CxxTest::TestSuite uint8_t* origData = NULL; uint8_t* verifyData = NULL; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdWrite()" ); do { - TARGETING::Target * theTgt = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) - { - TRACFCOMP( g_trac_mvpd, - "testMvpdWrite() - No Proc Targets found!" ); - - continue; // no proc targets. - } - - // Use the first Proc in the list - theTgt = procList[0]; - - // check to see if the target is functional - if(!theTgt->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - - TRACFCOMP( g_trac_mvpd, - "testMvpdWrite() - Proc Target [0] non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdWrite() - No Functional Targets found!"); + break; } // first figure out how big the keyword is cmds++; size_t theSize = 0; - err = deviceRead( theTgt, + err = deviceRead( theTarget, testData, theSize, - DEVICE_MVPD_ADDRESS(VWML,pdI) ); + DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdWrite() - failure getting size of VWML/#I, RC=%.4X", err->reasonCode() ); TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" ); @@ -438,14 +429,14 @@ class MVPDTest: public CxxTest::TestSuite // save off the original data origData = new uint8_t[theSize]; cmds++; - err = deviceRead( theTgt, + err = deviceRead( theTarget, origData, theSize, - DEVICE_MVPD_ADDRESS(VWML,pdI) ); + DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdWrite() - failure reading VWML/#I, RC=%.4X", err->reasonCode() ); TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" ); @@ -453,7 +444,8 @@ class MVPDTest: public CxxTest::TestSuite VPD_COMP_ID ); continue; } - TRACFBIN( g_trac_mvpd, "orig=", origData, theSize ); + TRACFBIN( g_trac_vpd, "testMvpdWrite() - orig=", + origData, theSize ); // fill it up with some dummy data testData = new uint8_t[theSize]; @@ -464,14 +456,14 @@ class MVPDTest: public CxxTest::TestSuite // write the new data in cmds++; - err = deviceWrite( theTgt, + err = deviceWrite( theTarget, testData, theSize, - DEVICE_MVPD_ADDRESS(VWML,pdI) ); + DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdWrite() - failure writing VWML/#I, RC=%.4X", err->reasonCode() ); TS_FAIL( "testMvpdWrite() - Failure calling deviceWrite!" ); @@ -483,14 +475,14 @@ class MVPDTest: public CxxTest::TestSuite // verify the data got written cmds++; verifyData = new uint8_t[theSize]; - err = deviceRead( theTgt, + err = deviceRead( theTarget, verifyData, theSize, - DEVICE_MVPD_ADDRESS(VWML,pdI) ); + DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdWrite() - failure reading VWML/#I to verify, RC=%.4X", err->reasonCode() ); TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" ); @@ -498,27 +490,30 @@ class MVPDTest: public CxxTest::TestSuite VPD_COMP_ID ); continue; } - TRACFBIN( g_trac_mvpd, "verif=", verifyData, theSize ); + TRACFBIN( g_trac_vpd, "testMvpdWrite() - verif=", + verifyData, theSize ); // compare what we read to what we wrote if( memcmp( testData, verifyData, theSize ) ) { fails++; - TRACFBIN( g_trac_mvpd, "wrote=", testData, theSize ); - TRACFBIN( g_trac_mvpd, "read=", verifyData, theSize ); + TRACFBIN( g_trac_vpd, "testMvpdWrite() - wrote=", + testData, theSize ); + TRACFBIN( g_trac_vpd, "testMvpdWrite() - read=", + verifyData, theSize ); TS_FAIL( "testMvpdWrite - Data mismatch!" ); } // put the original data back to be a good citizen cmds++; - err = deviceWrite( theTgt, + err = deviceWrite( theTarget, origData, theSize, - DEVICE_MVPD_ADDRESS(VWML,pdI) ); + DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); if( err ) { fails++; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ERR_MRK"testMvpdWrite() - failure writing original data back into VWML/#I, RC=%.4X", err->reasonCode() ); TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" ); @@ -552,15 +547,15 @@ class MVPDTest: public CxxTest::TestSuite TS_FAIL( "testMvpdWrite - No tests ran, something is wrong..." ); } - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdWrite - %d/%d fails", fails, cmds ); } /** - * @brief This function will test that an error is generated when a record - * is passed in that cannot be found in the structure that defines the - * Records string representation. + * @brief This function will test that an error is generated when a + * record is passed in that cannot be found in the structure + * that defines the Records string representation. */ void testMvpdInvalidRecord ( void ) { @@ -568,40 +563,16 @@ class MVPDTest: public CxxTest::TestSuite uint64_t cmds = 0x0; uint64_t fails = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdInvalidRecord()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) - { - TRACFCOMP( g_trac_mvpd, - "testMvpdInvalidRecord() - No Proc Targets " - "found!" ); - - continue; - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - - TRACFCOMP( g_trac_mvpd, - "testMvpdInvalidRecord() - Proc Target [0] non " - "functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdInvalidRecord() - No Functional Targets found!"); + break; } size_t theSize = 1; @@ -611,8 +582,8 @@ class MVPDTest: public CxxTest::TestSuite err = deviceRead( theTarget, theData, theSize, - DEVICE_MVPD_ADDRESS( MVPD_LAST_RECORD, - pdP ) ); + DEVICE_MVPD_ADDRESS( MVPD::MVPD_LAST_RECORD, + MVPD::pdP ) ); if( NULL == err ) { @@ -620,7 +591,7 @@ class MVPDTest: public CxxTest::TestSuite TS_FAIL( "testMvpdInvalidRecord() - Error expected with " "record of type MVPD_LAST_RECORD (0x%04x), but " "no error returned!", - MVPD_LAST_RECORD ); + MVPD::MVPD_LAST_RECORD ); } else { @@ -635,14 +606,14 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdInvalidRecord - %d/%d fails", fails, cmds ); } /** - * @brief This function will test for a record which is not in the TOC of - * the MVPD area. + * @brief This function will test for a record which is not in the TOC + * of the MVPD area. */ void testMvpdMissingRecord ( void ) { @@ -650,40 +621,16 @@ class MVPDTest: public CxxTest::TestSuite uint64_t cmds = 0x0; uint64_t fails = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdMissingRecord()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) - { - TRACFCOMP( g_trac_mvpd, - - "testMvpdMissingRecord() - No Proc Targets found!" ); - - continue; - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - - TRACFCOMP( g_trac_mvpd, - "testMvpdMissingRecord() - Proc Target [0] " - "non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdMissingRecord() - No Functional Targets found!"); + break; } size_t theSize = 1; @@ -693,8 +640,8 @@ class MVPDTest: public CxxTest::TestSuite err = deviceRead( theTarget, theData, theSize, - DEVICE_MVPD_ADDRESS( MVPD_TEST_RECORD, - pdP ) ); + DEVICE_MVPD_ADDRESS( MVPD::MVPD_TEST_RECORD, + MVPD::pdP ) ); if( NULL == err ) { @@ -714,7 +661,7 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdMissingRecord - %d/%d fails", fails, cmds ); } @@ -729,57 +676,33 @@ class MVPDTest: public CxxTest::TestSuite uint64_t cmds = 0x0; uint64_t fails = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdMissingKeyword()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) - { - TRACFCOMP( g_trac_mvpd, - - "testMvpdMissingKeyword() - No Proc Targets found!" ); - - continue; - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - - TRACFCOMP( g_trac_mvpd, - "testMvpdMissingKeyword() - Proc Target [0] " - "non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdMissingKeyword() - No Functional Targets found!"); + break; } size_t theSize = 1; uint8_t * theData = new uint8_t[theSize]; cmds++; - err = deviceRead( theTarget, - theData, - theSize, - DEVICE_MVPD_ADDRESS( MVPD_FIRST_RECORD, - MVPD_TEST_KEYWORD ) ); + err = deviceRead(theTarget, + theData, + theSize, + DEVICE_MVPD_ADDRESS(MVPD::MVPD_FIRST_RECORD, + MVPD::MVPD_TEST_KEYWORD)); if( NULL == err ) { fails++; - TS_FAIL( "testMvpdMissingKeyword() - Expected error from " - "invalid Keyword missing from associated record!" ); + TS_FAIL("testMvpdMissingKeyword() - Expected error from " + "invalid Keyword missing from associated record!"); } else { @@ -794,15 +717,15 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdMissingKeyword - %d/%d fails", fails, cmds ); } /** - * @brief This function will test that an error is generated when a keyword - * is passed in that cannot be found in the structure that defines the - * Keywords string representation. + * @brief This function will test that an error is generated when a + * keyword is passed in that cannot be found in the structure + * that defines the Keywords string representation. */ void testMvpdInvalidKeyword ( void ) { @@ -810,51 +733,27 @@ class MVPDTest: public CxxTest::TestSuite uint64_t cmds = 0x0; uint64_t fails = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdInvalidKeyword()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) - { - TRACFCOMP( g_trac_mvpd, - - "testMvpdInvalidKeyword() - No Proc Targets found!" ); - - continue; - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - - TRACFCOMP( g_trac_mvpd, - "testMvpdInvalidKeyword() - Proc Target [0] " - "non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdInvalidKeyword() - No Functional Targets found!"); + break; } size_t theSize = 1; uint8_t * theData = new uint8_t[theSize]; cmds++; - err = deviceRead( theTarget, - theData, - theSize, - DEVICE_MVPD_ADDRESS( CRP0, - MVPD_LAST_KEYWORD ) ); + err = deviceRead(theTarget, + theData, + theSize, + DEVICE_MVPD_ADDRESS(MVPD::CRP0, + MVPD::MVPD_LAST_KEYWORD)); if( NULL == err ) { @@ -862,7 +761,7 @@ class MVPDTest: public CxxTest::TestSuite TS_FAIL( "testMvpdInvalidKeyword() - Error expected with " "keyword of type MVPD_LAST_KEYWORD (0x%04x), but " "no error returned!", - MVPD_LAST_KEYWORD ); + MVPD::MVPD_LAST_KEYWORD ); } else { @@ -877,14 +776,15 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdInvalidKeyword - %d/%d fails", fails, cmds ); } /** - * @brief This function will test that an error is generated when a buffer - * that has an insufficient size is passed in to read a record/keyword. + * @brief This function will test that an error is generated when a + * buffer that has an insufficient size is passed in to read a + * record/keyword. */ void testMvpdInvalidBufferSize ( void ) { @@ -892,40 +792,16 @@ class MVPDTest: public CxxTest::TestSuite uint64_t cmds = 0x0; uint64_t fails = 0x0; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdInvalidBufferSize()" ); do { - TARGETING::Target * theTarget = NULL; - - // Get the processor targets - TargetHandleList procList; - getProcTargets( procList ); - - if( ( 0 == procList.size() ) || - ( NULL == procList[0] ) ) + TARGETING::Target * theTarget = getFunctionalProcTarget(); + if(theTarget == NULL) { - TRACFCOMP( g_trac_mvpd, - "testMvpdInvalidBufferSize() - No Proc Targets " - "found!" ); - - continue; - } - - // Use the first Proc in the list - theTarget = procList[0]; - - // check to see if the target is functional - if - (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) - { - - TRACFCOMP( g_trac_mvpd, - "testMvpdInvalidBufferSize() - Proc Target [0] " - "non functional!" ); - - continue; // add continue because target is non functional + TS_FAIL("testMvpdInvalidBufferSize() - No Functional Targets found!"); + break; } uint8_t * theData = new uint8_t[1]; @@ -935,8 +811,8 @@ class MVPDTest: public CxxTest::TestSuite err = deviceRead( theTarget, theData, theSize, - DEVICE_MVPD_ADDRESS( CRP0, - DD ) ); + DEVICE_MVPD_ADDRESS( MVPD::CRP0, + MVPD::DD ) ); if( NULL == err ) { @@ -957,7 +833,7 @@ class MVPDTest: public CxxTest::TestSuite } } while( 0 ); - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdInvalidBufferSize - %d/%d fails", fails, cmds ); } @@ -969,50 +845,51 @@ class MVPDTest: public CxxTest::TestSuite void testMvpdCheckStructOrder ( void ) { uint64_t fails = 0x0; - mvpdRecord prevRecord = MVPD_FIRST_RECORD; - mvpdKeyword prevKeyword = MVPD_FIRST_KEYWORD; + IpVpdFacade::ipVpdRecord prevRecord = MVPD::MVPD_FIRST_RECORD; + IpVpdFacade::ipVpdKeyword prevKeyword = MVPD::MVPD_FIRST_KEYWORD; - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, ENTER_MRK"testMvpdCheckStructOrder()" ); // Check the mvpdRecords structure for proper order uint32_t entry = 0x0; for( entry = 0; - entry < (sizeof(mvpdRecords)/sizeof(mvpdRecords[0])); + entry < (sizeof(MVPD::mvpdRecords)/ + sizeof(MVPD::mvpdRecords[0])); entry++ ) { - if( !(mvpdRecords[entry].record >= prevRecord) ) + if( !(MVPD::mvpdRecords[entry].record >= prevRecord) ) { fails++; TS_FAIL( "testMvpdCheckStructOrder() - Record table out of " "order! Cur Record: 0x%04x, Prev Record: 0x%04x", - mvpdRecords[entry].record, + MVPD::mvpdRecords[entry].record, prevRecord ); } - prevRecord = mvpdRecords[entry].record; + prevRecord = MVPD::mvpdRecords[entry].record; } // Check the mvpdKeywords structure for proper order for( entry = 0; - entry < (sizeof(mvpdKeywords)/sizeof(mvpdKeywords[0])); + entry < (sizeof(MVPD::mvpdKeywords)/\ + sizeof(MVPD::mvpdKeywords[0])); entry++ ) { - if( !(mvpdKeywords[entry].keyword >= prevKeyword) ) + if( !(MVPD::mvpdKeywords[entry].keyword >= prevKeyword) ) { fails++; - TS_FAIL( "testMvpdCheckStructOrder() - Keyword table out of " - "order! Cur Keyword: 0x%04x, Prev Keyword: 0x%04x", - mvpdKeywords[entry].keyword, - prevKeyword ); + TS_FAIL("testMvpdCheckStructOrder() - Keyword table out of " + "order! Cur Keyword: 0x%04x, Prev Keyword: 0x%04x", + MVPD::mvpdKeywords[entry].keyword, + prevKeyword ); } - prevKeyword = mvpdKeywords[entry].keyword; + prevKeyword = MVPD::mvpdKeywords[entry].keyword; } - TRACFCOMP( g_trac_mvpd, + TRACFCOMP( g_trac_vpd, "testMvpdCheckStructOrder - %d fails", fails ); } - }; #endif |