diff options
| author | crgeddes <crgeddes@us.ibm.com> | 2016-03-30 20:59:51 -0500 |
|---|---|---|
| committer | Stephen Cprek <smcprek@us.ibm.com> | 2016-04-21 13:51:41 -0500 |
| commit | 75fc7001ace168ef7c687d3b938d58c9e5adf48f (patch) | |
| tree | 9ccb0814f8b30245523ffc108da66181f1add71d /src/usr/fapi2/test/fapi2ToStringTest.H | |
| parent | 43b31e59ca4f20d8172c8daff89eb0f648d14238 (diff) | |
| download | talos-hostboot-75fc7001ace168ef7c687d3b938d58c9e5adf48f.tar.gz talos-hostboot-75fc7001ace168ef7c687d3b938d58c9e5adf48f.zip | |
Fix format of fapi2 test cases
Refactoring some tests now so it follows what
the other cases are doing. Note: I am pulling in some code
from an abandoned commit in for toString test so it looks
like new code is being added but really things are just moving
around
Change-Id: I7706c304f3ef3369e56516ac81f88dc91d059bf2
RTC:150514
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22692
Tested-by: Jenkins Server
Tested-by: FSP CI Jenkins
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2/test/fapi2ToStringTest.H')
| -rw-r--r-- | src/usr/fapi2/test/fapi2ToStringTest.H | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/usr/fapi2/test/fapi2ToStringTest.H b/src/usr/fapi2/test/fapi2ToStringTest.H new file mode 100644 index 000000000..b6824a06d --- /dev/null +++ b/src/usr/fapi2/test/fapi2ToStringTest.H @@ -0,0 +1,83 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapi2/test/fapi2ToStringTest.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#include <fapi2.H> + + +using namespace fapi2; + + +class Fapi2ToStringTest : public CxxTest::TestSuite +{ +public: +//****************************************************************************** +// test_fapi2ToString +//****************************************************************************** +void test_fapi2ToString() +{ + int numTests = 0; + int numFails = 0; + do + { + TARGETING::Target* l_pMasterProcChip = NULL; + TARGETING::targetService().masterProcChipTargetHandle(l_pMasterProcChip); + + assert(l_pMasterProcChip != NULL); + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> + fapi2_procTarget(l_pMasterProcChip); + + TARGETING::ATTR_FAPI_NAME_type tmpScomStr = {0}; + fapi2::toString(fapi2_procTarget, tmpScomStr, sizeof(tmpScomStr)); + numTests++; + if (tmpScomStr[0] == '\0') + { + numFails++; + TS_FAIL("toString failed to return data for processor chip !!"); + } + else + { + numTests++; + if (strcmp(tmpScomStr, "pu:k0:n0:s0:p00")) + { + numFails++; + TS_FAIL("toString returned wrong processor chip string!!"); + } + + char smallName[5]; + fapi2::toString(fapi2_procTarget, smallName, sizeof(smallName)); + numTests++; + if (memcmp(smallName, tmpScomStr, sizeof(smallName)-1)) + { + numFails++; + TS_FAIL("toString failed to fill in 5 character processor chip!!"); + } + } + } while(0); + FAPI_INF("test_fapi2ToString Test Complete. %d/%d fails", numFails , numTests); +} + + +}; + |

