summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorBill Hoffa <wghoffa@us.ibm.com>2019-08-27 08:32:06 -0500
committerNicholas E Bofferding <bofferdn@us.ibm.com>2019-12-06 14:24:04 -0600
commit7da5f591449ffddd9a4f680cb65a0faf73d0353e (patch)
tree9d0d1283c686b8548c5e06066bb26eafce8c064b /src/usr
parentc46f1ee5b8b9f7ea7e398f373f990b6e3440a257 (diff)
downloadtalos-hostboot-7da5f591449ffddd9a4f680cb65a0faf73d0353e.tar.gz
talos-hostboot-7da5f591449ffddd9a4f680cb65a0faf73d0353e.zip
Enable Serial Testcases
- Provide the ability for test modules to be defined as serial tests - Execute the serial test jobs prior to launching all of the other test modules in parallel Change-Id: Iff10ad049f6bb0e5f0f3c168a1bb30736b1b983d Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83110 Tested-by: Jenkins Server <pfd-jenkins+hostboot@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> Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/cxxtest/TestSuite.C41
-rw-r--r--src/usr/cxxtest/cxxtestexec.C70
-rw-r--r--src/usr/vfs/vfsrp.C4
3 files changed, 104 insertions, 11 deletions
diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C
index 6f7e3fb2a..3b1499889 100755
--- a/src/usr/cxxtest/TestSuite.C
+++ b/src/usr/cxxtest/TestSuite.C
@@ -32,7 +32,6 @@
#include <stdarg.h>
#include <arch/ppc.H>
#include <string.h>
-
#include <cxxtest/TestSuite.H>
trace_desc_t *g_trac_test = NULL;
@@ -43,6 +42,9 @@ namespace CxxTest
/******************************************************************************/
// Globals/Constants
/******************************************************************************/
+//This is a list of testcases that are expected to run in a serial manner
+// example: std::vector<const char *> CxxSerialTests{"libtestrtloader.so"};
+std::vector<const char *> CxxSerialTests{"libtesthwas.so"};
//
// TestSuite members
@@ -104,6 +106,43 @@ void doFailTest( )
}
+void sortTests(std::vector<const char *> & i_list,
+ std::vector<const char *> & o_serial_list,
+ std::vector<const char *> & o_parallel_list)
+{
+ o_serial_list.clear();
+ o_serial_list.reserve(32);
+ o_parallel_list.clear();
+ o_parallel_list.reserve(32);
+
+ //Loop through list of all tests
+ for(std::vector<const char *>::const_iterator i = i_list.begin();
+ i != i_list.end(); ++i)
+ {
+ bool is_serial = false;
+
+ for(std::vector<const char *>::const_iterator j = CxxSerialTests.begin();
+ j != CxxSerialTests.end(); ++j)
+ {
+ if (0 == strcmp(*i, *j))
+ {
+ is_serial = true;
+ }
+ }
+
+ if (is_serial)
+ {
+ TRACFCOMP( g_trac_test, "%s is a serial test",*i);
+ o_serial_list.push_back(*i);
+ }
+ else
+ {
+ TRACFCOMP( g_trac_test, "%s is a parallel test",*i);
+ o_parallel_list.push_back(*i);
+ }
+ }
+}
+
/**
* @brief Implement Fail action in unit tests
*
diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C
index 145537f66..b32c661f2 100644
--- a/src/usr/cxxtest/cxxtestexec.C
+++ b/src/usr/cxxtest/cxxtestexec.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2017 */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -32,7 +32,6 @@
#include <sys/sync.h>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#
#include <initservice/taskargs.H>
#include <cxxtest/TestSuite.H>
@@ -46,7 +45,6 @@ namespace CxxTest
// prototype
void cxxinit( errlHndl_t &io_taskRetErrl );
-
trace_desc_t *g_trac_cxxtest = NULL;
TRAC_INIT(&g_trac_cxxtest, CXXTEST_COMP_NAME, KILOBYTE );
@@ -75,6 +73,8 @@ void cxxinit( errlHndl_t &io_taskRetErrl )
} cxxtask;
errlHndl_t l_errl = NULL;
std::vector<const char *> module_list;
+ std::vector<const char *> parallel_module_list;
+ std::vector<const char *> serial_module_list;
std::vector<cxxtask_t> tasks;
tid_t tidrc = 0;
@@ -94,12 +94,16 @@ void cxxinit( errlHndl_t &io_taskRetErrl )
// count up the number of viable modules ahead of time
TRACDCOMP( g_trac_cxxtest, "Counting CxxTestExec modules:" );
+ //Get all modules, then sort into parallel and serial lists
VFS::find_test_modules(module_list);
- // start executing the CxxTest modules
+ CxxTest::sortTests(module_list, serial_module_list, parallel_module_list);
- TRACFCOMP( g_trac_cxxtest, ENTER_MRK "Execute CxxTestExec, totalmodules=%d.",
- module_list.size());
+ // start executing the CxxTest modules
+ TRACFCOMP( g_trac_cxxtest, ENTER_MRK "Execute CxxTestExec, totalparallelmodules=%d, totalserialmodules=%d (overall total:%d)",
+ parallel_module_list.size(),
+ serial_module_list.size(),
+ parallel_module_list.size()+serial_module_list.size());
printkd( "\n Begin CxxTest...\n");
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
@@ -111,8 +115,58 @@ void cxxinit( errlHndl_t &io_taskRetErrl )
TS_FAIL("Error logs committed previously during IPL.");
}
- for(std::vector<const char *>::const_iterator i = module_list.begin();
- i != module_list.end(); ++i)
+ for(std::vector<const char *>::const_iterator i = serial_module_list.begin();
+ i != serial_module_list.end(); ++i)
+ {
+ __sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
+
+ TRACFCOMP( g_trac_cxxtest,
+ "Now executing Serial Test Cases!");
+
+ // load module and call _init()
+ l_errl = VFS::module_load( *i );
+ if ( l_errl )
+ {
+ // vfs could not load a module and returned an errorlog.
+ // commit the errorlog, mark the test failed, and
+ // move on.
+ TS_FAIL( "ERROR: Task %s could not be loaded, committing errorlog",
+ *i );
+ errlCommit( l_errl, CXXTEST_COMP_ID );
+ continue;
+ }
+
+ //First run all serial testcases
+ tidrc = task_exec( *i, NULL );
+ TRACFCOMP( g_trac_cxxtest, "Launched serial task: %s tidrc=%d",
+ *i, tidrc );
+ int status = 0;
+ task_wait_tid(tidrc, &status, NULL);
+
+ if (status != TASK_STATUS_EXITED_CLEAN)
+ {
+ TRACFCOMP( g_trac_cxxtest, "Task %d crashed with status %d.",
+ tidrc, 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",
+ *i);
+ l_failedEntry->failTestData = tidrc;
+ }
+ __sync_add_and_fetch(&CxxTest::g_FailedTests, 1);
+ }
+ else
+ {
+ TRACFCOMP( g_trac_cxxtest, "Task %d finished.", tidrc );
+ }
+ }
+
+ //Then run all parallel testcases
+ for(std::vector<const char *>::const_iterator i = parallel_module_list.begin();
+ i != parallel_module_list.end(); ++i)
{
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
diff --git a/src/usr/vfs/vfsrp.C b/src/usr/vfs/vfsrp.C
index a103a09d0..aaf4aa57d 100644
--- a/src/usr/vfs/vfsrp.C
+++ b/src/usr/vfs/vfsrp.C
@@ -753,7 +753,7 @@ void VfsRp::get_test_modules(std::vector<const char *> & o_list) const
VfsSystemModule * vfsItr =
(VfsSystemModule *) (iv_pnor_vaddr + VFS_EXTENDED_MODULE_TABLE_OFFSET);
- //TRACDCOMP(g_trac_vfs,"finding test modules...");
+ TRACFCOMP(g_trac_vfs,"finding test modules...");
while(vfsItr->module[0] != '\0')
{
@@ -761,7 +761,7 @@ void VfsRp::get_test_modules(std::vector<const char *> & o_list) const
{
if (NULL != vfsItr->start)
{
- //TRACDCOMP( g_trac_vfs, "%s",vfsItr->module);
+ TRACDCOMP( g_trac_vfs, "%s",vfsItr->module);
o_list.push_back(vfsItr->module);
}
}
OpenPOWER on IntegriCloud