From a166a390e16f229f1eb77406a1bfcc841bc1b781 Mon Sep 17 00:00:00 2001 From: Andrew Geissler Date: Fri, 18 May 2018 14:30:46 -0500 Subject: 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 Reviewed-by: Christian R. Geddes Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Martin Gloff Reviewed-by: Daniel M. Crowell --- src/usr/fapi2/test/fapi2GetChildrenTest.H | 83 ++++++++----------------------- 1 file changed, 21 insertions(+), 62 deletions(-) (limited to 'src/usr') diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.H b/src/usr/fapi2/test/fapi2GetChildrenTest.H index 5d2fac45f..12af3432f 100644 --- a/src/usr/fapi2/test/fapi2GetChildrenTest.H +++ b/src/usr/fapi2/test/fapi2GetChildrenTest.H @@ -131,29 +131,16 @@ void test_fapi2GetChildren() TARGETING::Target * l_proc = nullptr; do { - // Create a vector of TARGETING::Target pointers - TARGETING::TargetHandleList l_chipList; - - // Get a list of all of the proc chips - TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false); - - //Take the first proc and use it - for(uint32_t i = 0; i < l_chipList.size(); i++) + numTests++; + l_err = getProc(l_nimbusProc, l_cumulusProc); + if(l_err) { - if(TARGETING::MODEL_NIMBUS == - l_chipList[i]->getAttr()) - { - l_nimbusProc = l_chipList[i]; - break; - } - if(TARGETING::MODEL_CUMULUS == - l_chipList[i]->getAttr()) - { - l_cumulusProc = l_chipList[i]; - break; - } + errlCommit(l_err,HWPF_COMP_ID); + numFails++; + TS_FAIL("test_fapi2GetChildren Fail: could not find any proc, skipping tests"); + break; } - numTests++; + if (l_nimbusProc != nullptr) { l_proc = l_nimbusProc; @@ -164,24 +151,10 @@ void test_fapi2GetChildren() } else //both are nullptr { - // Send an errorlog because we cannot find any NIMBUS procs. - FAPI_ERR("FAPI2_GETCHILDREN:: could not find any procs, skipping tests"); + // Should never get here since error should have been returned + // above + FAPI_ERR("test_fapi2GetChildren: Never Should Happen"); numFails++; - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST - * @reasoncode fapi2::RC_NO_PROCS_FOUND - * @userdata1 Model Type we looked for - * @userdata2 Other Model Type we looked for - * @devdesc Could not find any procs in system model - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST, - fapi2::RC_NO_PROCS_FOUND, - TARGETING::MODEL_NIMBUS, - TARGETING::MODEL_CUMULUS, - true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); break; } @@ -739,29 +712,15 @@ void test_fapi2GetChildrenFilter() { FAPI_DBG("start of test_fapi2GetChildrenFilter()"); - // Create a vector of TARGETING::Target pointers - TARGETING::TargetHandleList l_chipList; - - // Get a list of all of the proc chips - TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false); - - //Take the first NIMBUS proc and use it - for(uint32_t i = 0; i < l_chipList.size(); i++) + numTests++; + l_err = getProc(l_nimbusProc, l_cumulusProc); + if(l_err) { - if(TARGETING::MODEL_NIMBUS == - l_chipList[i]->getAttr()) - { - l_nimbusProc = l_chipList[i]; - break; - } - if(TARGETING::MODEL_CUMULUS == - l_chipList[i]->getAttr()) - { - l_cumulusProc = l_chipList[i]; - break; - } + errlCommit(l_err,HWPF_COMP_ID); + numFails++; + TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests"); + break; } - numTests++; if (l_nimbusProc != nullptr) { @@ -773,10 +732,10 @@ void test_fapi2GetChildrenFilter() } else //both are nullptr { - // Send an errorlog because we cannot find any procs. - FAPI_ERR("FAPI2_GETCHILDREN:: could not find any proc, skipping tests"); + // Should never get here since error should have been returned + // above + FAPI_ERR("test_fapi2GetChildrenFilter: Never Should Happen"); numFails++; - TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests"); break; } -- cgit v1.2.1