summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/common/test
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2016-03-08 08:33:57 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-03-23 11:19:36 -0400
commitefb976fc64fc447d93015d3bb950431f341b6c19 (patch)
treeb55c264b2ac3d7c68da42adc4d59465976ceb07d /src/usr/targeting/common/test
parent8acb41d0016e2e85dd464dfb383bedf63a53e4de (diff)
downloadblackbird-hostboot-efb976fc64fc447d93015d3bb950431f341b6c19.tar.gz
blackbird-hostboot-efb976fc64fc447d93015d3bb950431f341b6c19.zip
Support association between pervasive targets and other unit targets
- Updated attribute compiler to link targets based on pervasive association - Updated attribute compiler to support virtual attributes - Added virtual attribute describing a unit's pervasive association - Updated Nimbus system XML with pervasive/unit associations - Fixed various errors compiling with debug trace enabled - Updated FSP attribute generator to create perv/unit links - Fixed FSP bad path character in attribute generator - Fixed PHB chip unit numbering in attribute generator - Replaced some NVBUS references with NV RTC: 148577 CMVC-Prereq: 988338 Change-Id: I6f3c4aa806e465dd9f09859c4911ff70db782a4f Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21943 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/test')
-rw-r--r--src/usr/targeting/common/test/testcommontargeting.H103
1 files changed, 103 insertions, 0 deletions
diff --git a/src/usr/targeting/common/test/testcommontargeting.H b/src/usr/targeting/common/test/testcommontargeting.H
index d62c9d51b..56a6e3961 100644
--- a/src/usr/targeting/common/test/testcommontargeting.H
+++ b/src/usr/targeting/common/test/testcommontargeting.H
@@ -1960,7 +1960,110 @@ class CommonTargetingTestSuite: public CxxTest::TestSuite
TARG_TS_TRACE(EXIT_MRK "testL4s" );
}
+ /**
+ * @brief Tests pervasive associations
+ *
+ * @par Detailed Description:
+ * An applicable pervasive target has a "PERVASIVE_CHILD"
+ * association that links it to a child unit target. For
+ * example, a pervasive target may have said link to a child
+ * core target. That child core target, in turn, will have
+ * a "PARENT_PERVASIVE" association back to it's parent,
+ * forming a bidirectional relationship, which can be navigated
+ * with target service getAssociated() calls. This test
+ * verifies that pervasive target A links to child target B,
+ * and that in turn, B links back to A.
+ */
+ void testPervasiveRelationship()
+ {
+ TARG_TS_TRACE(ENTER_MRK "testPervasiveRelationship" );
+
+ using namespace TARGETING;
+
+ // Get all pervasive targets in the model and loop through
+ // each one
+ PredicateCTM pervasiveUnit(CLASS_UNIT,TYPE_PERV);
+ TargetRangeFilter pervasiveUnitFilter(
+ targetService().begin(),
+ targetService().end(),
+ &pervasiveUnit);
+
+ size_t pervasives = 0;
+
+ for(;pervasiveUnitFilter;++pervasiveUnitFilter)
+ {
+ ++pervasives;
+
+ // For each pervasive target, find all its children
+ // using the special PERVASIVE_CHILD association type
+ TargetHandleList pervasiveChildren;
+ (void)targetService().getAssociated(
+ pervasiveChildren,
+ *pervasiveUnitFilter,
+ TARGETING::TargetService::PERVASIVE_CHILD,
+ TARGETING::TargetService::ALL);
+ ATTR_PHYS_PATH_type pervasivePath = (*pervasiveUnitFilter)->
+ getAttr<TARGETING::ATTR_PHYS_PATH>();
+
+ TARG_TS_TRACE("Found %d children for pervasive w/ "
+ "path %s",pervasiveChildren.size(),
+ pervasivePath.toString());
+
+ // Then for each child, navigate back to what should be the original
+ // pervasive target
+ for(TARGETING::TargetHandleList::const_iterator child
+ = pervasiveChildren.begin();
+ child != pervasiveChildren.end();
+ ++child)
+ {
+ ATTR_PHYS_PATH_type childPath = (*child)->
+ getAttr<TARGETING::ATTR_PHYS_PATH>();
+
+ TARG_TS_TRACE("Child path is %s",
+ childPath.toString());
+
+ TargetHandleList parentPervasive;
+ (void)targetService().getAssociated(
+ parentPervasive,
+ *child,
+ TARGETING::TargetService::PARENT_PERVASIVE,
+ TARGETING::TargetService::ALL);
+
+ // Make sure every child has exactly one parent pervasive
+ if(parentPervasive.size() != 1)
+ {
+ TARG_TS_FAIL("child of pervasive did not have exactly 1 "
+ "parent pervasive (had %d)",parentPervasive.size());
+ }
+
+ // Make sure that the parent of 'the child of the parent' is the
+ // parent
+ if(*parentPervasive.begin() != *pervasiveUnitFilter)
+ {
+ TARG_TS_FAIL("parent of child of pervasive was not the "
+ "original pervasive");
+ }
+
+ // Make sure that the parent is not accidentally the child
+ if(*parentPervasive.begin() == *child)
+ {
+ TARG_TS_FAIL("parent is equal to child");
+ }
+ }
+ }
+
+ if(!pervasives)
+ {
+ TARG_TS_FAIL("no pervasive units found in the model");
+ }
+ else
+ {
+ TARG_TS_TRACE("Found total of %d pervasive targets",pervasives);
+ }
+
+ TARG_TS_TRACE(EXIT_MRK "testPervasiveRelationship" );
+ }
};
#endif // __TARGETING_COMMON_TESTCOMMONTARGETING_H
OpenPOWER on IntegriCloud