Skip to content

Commit a166a39

Browse files
geissonatordcrowell77
authored andcommitted
Move existing tests to use new helper function
There was some common code in this test file that was being repeated in each test case. Move those functions over to the new helper interface. Change-Id: I4fe5a44ed50633116ed11258ae453b23b26abfbc Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59074 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent f1186fd commit a166a39

File tree

1 file changed

+21
-62
lines changed

1 file changed

+21
-62
lines changed

src/usr/fapi2/test/fapi2GetChildrenTest.H

Lines changed: 21 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,16 @@ void test_fapi2GetChildren()
131131
TARGETING::Target * l_proc = nullptr;
132132
do
133133
{
134-
// Create a vector of TARGETING::Target pointers
135-
TARGETING::TargetHandleList l_chipList;
136-
137-
// Get a list of all of the proc chips
138-
TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
139-
140-
//Take the first proc and use it
141-
for(uint32_t i = 0; i < l_chipList.size(); i++)
134+
numTests++;
135+
l_err = getProc(l_nimbusProc, l_cumulusProc);
136+
if(l_err)
142137
{
143-
if(TARGETING::MODEL_NIMBUS ==
144-
l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
145-
{
146-
l_nimbusProc = l_chipList[i];
147-
break;
148-
}
149-
if(TARGETING::MODEL_CUMULUS ==
150-
l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
151-
{
152-
l_cumulusProc = l_chipList[i];
153-
break;
154-
}
138+
errlCommit(l_err,HWPF_COMP_ID);
139+
numFails++;
140+
TS_FAIL("test_fapi2GetChildren Fail: could not find any proc, skipping tests");
141+
break;
155142
}
156-
numTests++;
143+
157144
if (l_nimbusProc != nullptr)
158145
{
159146
l_proc = l_nimbusProc;
@@ -164,24 +151,10 @@ void test_fapi2GetChildren()
164151
}
165152
else //both are nullptr
166153
{
167-
// Send an errorlog because we cannot find any NIMBUS procs.
168-
FAPI_ERR("FAPI2_GETCHILDREN:: could not find any procs, skipping tests");
154+
// Should never get here since error should have been returned
155+
// above
156+
FAPI_ERR("test_fapi2GetChildren: Never Should Happen");
169157
numFails++;
170-
/*@
171-
* @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
172-
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST
173-
* @reasoncode fapi2::RC_NO_PROCS_FOUND
174-
* @userdata1 Model Type we looked for
175-
* @userdata2 Other Model Type we looked for
176-
* @devdesc Could not find any procs in system model
177-
*/
178-
l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
179-
fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST,
180-
fapi2::RC_NO_PROCS_FOUND,
181-
TARGETING::MODEL_NIMBUS,
182-
TARGETING::MODEL_CUMULUS,
183-
true/*SW Error*/);
184-
errlCommit(l_err,HWPF_COMP_ID);
185158
break;
186159
}
187160

@@ -739,29 +712,15 @@ void test_fapi2GetChildrenFilter()
739712
{
740713
FAPI_DBG("start of test_fapi2GetChildrenFilter()");
741714

742-
// Create a vector of TARGETING::Target pointers
743-
TARGETING::TargetHandleList l_chipList;
744-
745-
// Get a list of all of the proc chips
746-
TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
747-
748-
//Take the first NIMBUS proc and use it
749-
for(uint32_t i = 0; i < l_chipList.size(); i++)
715+
numTests++;
716+
l_err = getProc(l_nimbusProc, l_cumulusProc);
717+
if(l_err)
750718
{
751-
if(TARGETING::MODEL_NIMBUS ==
752-
l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
753-
{
754-
l_nimbusProc = l_chipList[i];
755-
break;
756-
}
757-
if(TARGETING::MODEL_CUMULUS ==
758-
l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
759-
{
760-
l_cumulusProc = l_chipList[i];
761-
break;
762-
}
719+
errlCommit(l_err,HWPF_COMP_ID);
720+
numFails++;
721+
TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests");
722+
break;
763723
}
764-
numTests++;
765724

766725
if (l_nimbusProc != nullptr)
767726
{
@@ -773,10 +732,10 @@ void test_fapi2GetChildrenFilter()
773732
}
774733
else //both are nullptr
775734
{
776-
// Send an errorlog because we cannot find any procs.
777-
FAPI_ERR("FAPI2_GETCHILDREN:: could not find any proc, skipping tests");
735+
// Should never get here since error should have been returned
736+
// above
737+
FAPI_ERR("test_fapi2GetChildrenFilter: Never Should Happen");
778738
numFails++;
779-
TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests");
780739
break;
781740
}
782741

0 commit comments

Comments
 (0)