diff options
author | Marty Gloff <mgloff@us.ibm.com> | 2017-02-07 11:09:44 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-02-11 21:37:17 -0500 |
commit | 9fb6c6be5a35e14bb06f285282db6f2ed4220f7d (patch) | |
tree | d67c9b53b94d2ec0954b4034e02ee1341606e771 /src | |
parent | ea1efc2a4755f9c0882933cc0dd4a3f19220b062 (diff) | |
download | talos-hostboot-9fb6c6be5a35e14bb06f285282db6f2ed4220f7d.tar.gz talos-hostboot-9fb6c6be5a35e14bb06f285282db6f2ed4220f7d.zip |
Output list of cxxtest failures
Include a list of the first 10 cxxtest failures with the summary
of the cxxtest results.
Change-Id: I932b63d29b26f6d5afff7c3f5a67679e2a66fd5f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36168
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/include/usr/cxxtest/TestSuite.H | 18 | ||||
-rw-r--r-- | src/include/usr/cxxtest/cxxtest_data.H | 52 | ||||
-rw-r--r-- | src/lib/cxxtest_data.C | 12 | ||||
-rwxr-xr-x | src/usr/cxxtest/TestSuite.C | 20 | ||||
-rw-r--r-- | src/usr/cxxtest/cxxtestexec.C | 51 |
5 files changed, 132 insertions, 21 deletions
diff --git a/src/include/usr/cxxtest/TestSuite.H b/src/include/usr/cxxtest/TestSuite.H index dcc3bbfee..cc27ec321 100755 --- a/src/include/usr/cxxtest/TestSuite.H +++ b/src/include/usr/cxxtest/TestSuite.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,6 +39,7 @@ #include <trace/interface.H> #include <sys/sync.h> +#include <usr/cxxtest/cxxtest_data.H> extern trace_desc_t *g_trac_test; @@ -48,13 +49,14 @@ namespace CxxTest /** * @note extern declarations - see lib/cxxtest_data.C * - * @see g_TotalTests, g_TraceCalls, g_Warnings, g_FailedTests + * @see g_TotalTests, g_TraceCalls, g_Warnings, g_FailedTests, g_FailedTestList */ extern uint64_t g_TotalTests; extern uint64_t g_TraceCalls; extern uint64_t g_Warnings; extern uint64_t g_FailedTests; extern barrier_t g_CxxTestBarrier; +extern CxxTestFailedEntry g_FailedTestList[CXXTEST_FAIL_LIST_SIZE]; /** * @class TestSuite @@ -87,6 +89,7 @@ void doFailAssert( const char *file, void reportTotalTests( const char *suitename, uint64_t numtests ); +extern uint64_t g_ModulesStarted; extern uint64_t g_ModulesCompleted; #define _TS_TRY @@ -117,15 +120,6 @@ extern uint64_t g_ModulesCompleted; #define TS_FAIL(...) TRACFCOMP( g_trac_test, "!!!TS_FAIL> " __VA_ARGS__); \ CxxTest::doFailTest( __FILE__, __LINE__ ) -// These are all implemented in the cxxtest_data.C that gets put into the base -// image. -extern uint64_t g_TotalTests; -extern uint64_t g_TraceCalls; -extern uint64_t g_Warnings; -extern uint64_t g_FailedTests; -extern uint64_t g_ModulesStarted; -extern uint64_t g_ModulesCompleted; - // Statistics structure for passing original pointers to the runtime test suite. struct CxxTestStats { @@ -137,6 +131,6 @@ struct CxxTestStats uint64_t* modulesCompleted; }; -} +} // namespace CxxTest #endif // __cxxtest__TestSuite_h__ diff --git a/src/include/usr/cxxtest/cxxtest_data.H b/src/include/usr/cxxtest/cxxtest_data.H new file mode 100644 index 000000000..86831c56d --- /dev/null +++ b/src/include/usr/cxxtest/cxxtest_data.H @@ -0,0 +1,52 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/cxxtest/cxxtest_data.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* [+] 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 */ + +/** @file cxxtest_data.H + * + */ + + +#ifndef __cxxtest__cxxtest_data_h__ +#define __cxxtest__cxxtest_data_h__ + + +namespace CxxTest +{ + +enum +{ + CXXTEST_FILENAME_SIZE = 50, + CXXTEST_FAIL_LIST_SIZE = 10 +}; + +struct CxxTestFailedEntry +{ + char failTestFile[CXXTEST_FILENAME_SIZE]; + uint64_t failTestData; +}; + +} // namespace CxxTest + +#endif // __cxxtest__cxxtest_data_h__
\ No newline at end of file diff --git a/src/lib/cxxtest_data.C b/src/lib/cxxtest_data.C index f2d26cd32..7190aa341 100644 --- a/src/lib/cxxtest_data.C +++ b/src/lib/cxxtest_data.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] 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. */ @@ -22,6 +24,7 @@ /* IBM_PROLOG_END_TAG */ #include <stdint.h> +#include <usr/cxxtest/cxxtest_data.H> /** * @brief global vars to keep track of unit tests, * @@ -47,6 +50,10 @@ * This variable is also used to allow a code in a binary image * not containing the testcase modules to query the number of failed tests * + * @var g_FailedTestList - updated by TS_FAIL macro in the unit test image. + * This variable is also used to allow code in a binary image not containing + * the testcase modules to query a list of failed tests + * */ namespace CxxTest @@ -59,5 +66,8 @@ uint64_t g_FailedTests = 0; uint64_t g_ModulesStarted = 0; uint64_t g_ModulesCompleted= 0; +struct CxxTestFailedEntry g_FailedTestList[CXXTEST_FAIL_LIST_SIZE]; + + } diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C index 3e7e92634..92feb4886 100755 --- a/src/usr/cxxtest/TestSuite.C +++ b/src/usr/cxxtest/TestSuite.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] 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. */ @@ -29,6 +31,7 @@ #include <limits.h> #include <stdarg.h> #include <arch/ppc.H> +#include <string.h> #include <cxxtest/TestSuite.H> @@ -89,6 +92,14 @@ void doWarn( ) void doFailTest( ) { + TRACDCOMP( g_trac_test, + "!!! > Test Failed " ); + if(g_FailedTests < CXXTEST_FAIL_LIST_SIZE) + { + memcpy(g_FailedTestList[g_FailedTests].failTestFile, + "---", + 3); + } __sync_add_and_fetch( &g_FailedTests, 1 ); } @@ -108,6 +119,13 @@ void doFailTest( const char *filename, uint32_t linenum ) "!!! > Test %s Failed at line %d ", filename, linenum ); + if(g_FailedTests < CXXTEST_FAIL_LIST_SIZE) + { + memcpy(g_FailedTestList[g_FailedTests].failTestFile, + filename, + CXXTEST_FILENAME_SIZE); + g_FailedTestList[g_FailedTests].failTestData = linenum; + } __sync_add_and_fetch( &g_FailedTests, 1 ); } diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C index 3bced8299..145537f66 100644 --- a/src/usr/cxxtest/cxxtestexec.C +++ b/src/usr/cxxtest/cxxtestexec.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] 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. */ @@ -24,6 +26,7 @@ #include <vfs/vfs.H> #include <sys/task.h> #include <string.h> +#include <stdio.h> #include <kernel/console.H> #include <sys/time.h> #include <sys/sync.h> @@ -65,11 +68,24 @@ TASK_ENTRY_MACRO( cxxinit ); void cxxinit( errlHndl_t &io_taskRetErrl ) { + struct cxxtask_t + { + tid_t tid; + const char * module; + } cxxtask; errlHndl_t l_errl = NULL; std::vector<const char *> module_list; - std::vector<tid_t> tasks; + std::vector<cxxtask_t> tasks; tid_t tidrc = 0; + for (uint64_t i = 0; i < CxxTest::CXXTEST_FAIL_LIST_SIZE; i++) + { + memset(CxxTest::g_FailedTestList[i].failTestFile, + 0x00, + CxxTest::CXXTEST_FILENAME_SIZE); + CxxTest::g_FailedTestList[i].failTestData = 0; + }; + // output a blank line so that it's easier to find the beginning of // CxxTest TRACDCOMP( g_trac_cxxtest, " "); @@ -120,28 +136,40 @@ void cxxinit( errlHndl_t &io_taskRetErrl ) tidrc = task_exec( *i, NULL ); TRACFCOMP( g_trac_cxxtest, "Launched task: %s tidrc=%d", *i, tidrc ); - tasks.push_back(tidrc); + cxxtask.tid = tidrc; + cxxtask.module = *i; + tasks.push_back(cxxtask); } TRACFCOMP( g_trac_cxxtest, "Waiting for all (%d) tasks to finish....", CxxTest::g_ModulesStarted ); // wait for all the launched tasks to finish - for (std::vector<tid_t>::iterator t = tasks.begin(); + for (std::vector<cxxtask_t>::iterator t = tasks.begin(); t != tasks.end(); ++t) { int status = 0; - task_wait_tid(*t, &status, NULL); + task_wait_tid(t->tid, &status, NULL); if (status != TASK_STATUS_EXITED_CLEAN) { - TRACFCOMP( g_trac_cxxtest, "Task %d crashed.", *t ); + TRACFCOMP( g_trac_cxxtest, "Task %d crashed with status %d.", + t->tid, status ); + if(CxxTest::g_FailedTests < CxxTest::CXXTEST_FAIL_LIST_SIZE) + { + CxxTest::CxxTestFailedEntry *l_failedEntry = + &CxxTest::g_FailedTestList[CxxTest::g_FailedTests]; + sprintf(l_failedEntry->failTestFile, + "%s crashed", + t->module); + l_failedEntry->failTestData = t->tid; + } __sync_add_and_fetch(&CxxTest::g_FailedTests, 1); } else { - TRACFCOMP( g_trac_cxxtest, "Task %d finished.", *t ); + TRACFCOMP( g_trac_cxxtest, "Task %d finished.", t->tid ); } } @@ -158,6 +186,15 @@ void cxxinit( errlHndl_t &io_taskRetErrl ) CxxTest::g_Warnings ); TRACFCOMP( g_trac_cxxtest, " trace calls: %d", CxxTest::g_TraceCalls ); + for (uint64_t i = 0; + (i < CxxTest::g_FailedTests) && (i < CxxTest::CXXTEST_FAIL_LIST_SIZE); + i++ ) + { + TRACFCOMP( g_trac_cxxtest, " failed test[%d]: %s (%d)", + i, + CxxTest::g_FailedTestList[i].failTestFile, + CxxTest::g_FailedTestList[i].failTestData); + } // @todo dump out an informational errorlog?? |