summaryrefslogtreecommitdiffstats
path: root/src/usr/cxxtest
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-07-11 15:43:13 -0500
committerMark W. Wenning <wenning@us.ibm.com>2011-07-25 16:50:09 -0500
commit9c0e69b8cdf3aabcd77c119c3b3425fda66706da (patch)
tree77a5b7f1c4f58da3a74048e54575a5b9a7785f34 /src/usr/cxxtest
parentb679a1729d7aea0870544e886ddb4b03e1ecf4c4 (diff)
downloadtalos-hostboot-9c0e69b8cdf3aabcd77c119c3b3425fda66706da.tar.gz
talos-hostboot-9c0e69b8cdf3aabcd77c119c3b3425fda66706da.zip
Cleanup from previous reviews, add barrier for CxxTest
- add IStep1 for demo - cleanup: remove inheritance, add errlog tags, etc. - inadvertently ran copyright script, this is OK. - more cleanup: indentation, etc. - add barrier for CxxTests - rename cxxtest_stub.C to cxxtest_data.C - merge problems on gerrit - fix review comments Change-Id: Iee988b8595d8c6dd521fd94d4d58cb403898d948 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/207 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/cxxtest')
-rwxr-xr-xsrc/usr/cxxtest/TestSuite.C43
-rw-r--r--src/usr/cxxtest/cxxtestexec.C125
-rwxr-xr-xsrc/usr/cxxtest/cxxtestgen.pl20
3 files changed, 149 insertions, 39 deletions
diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C
index 79677b83b..2af815346 100755
--- a/src/usr/cxxtest/TestSuite.C
+++ b/src/usr/cxxtest/TestSuite.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ * $
+****************************************************************************/
+
// Imported from FSP tree - /src/test/cxxtest/cxxtest/
#ifndef __cxxtest__TestSuite_cpp__
@@ -15,26 +32,6 @@ namespace CxxTest
// Globals/Constants
/******************************************************************************/
-/**
- * @brief global vars to keep track of unit tests.
- *
- * totaltests - initialized to 0, updated by reporttotaltests() below.
- * each test suite will call reporttotaltests after all tests have
- * run with the total number of tests for that suite.
- * Once all the testsuites have run, the global totaltests will hold
- * the total of number of unit test for that run.
- *
- * Each unit test macro (TS_TRACE, TS_WARN, and TS_FAIL) will update
- * the proper variable. At the end the unit tester will print out
- * the totals.
- * // Global cxxtest values - Keep global so it can be found in syms file
- */
-uint64_t g_TotalTests = 0;
-uint64_t g_TraceCalls = 0;
-uint64_t g_Warnings = 0;
-uint64_t g_FailedTests = 0;
-
-
//
// TestSuite members
//
@@ -109,7 +106,11 @@ void reportTotalTests( const char *suitename, uint64_t numtests )
// $$TODO do nothing with the suite name for now, later it may be useful
__sync_add_and_fetch( &g_TotalTests, numtests );
- printk( "%s completed %ld tests\n", suitename, numtests);
+ TRACDBIN( g_trac_test,
+ "Suite Completed: ",
+ suitename,
+ strlen(suitename) );
+ // printk( "%s completed %ld tests\n", suitename, numtests);
return;
}
diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C
index d79188e9e..5470b718a 100644
--- a/src/usr/cxxtest/cxxtestexec.C
+++ b/src/usr/cxxtest/cxxtestexec.C
@@ -1,3 +1,20 @@
+/****************************************************************************
+ * $IBMCopyrightBlock:
+ *
+ * IBM Confidential
+ *
+ * Licensed Internal Code Source Materials
+ *
+ * IBM HostBoot Licensed Internal Code
+ *
+ * (C) Copyright IBM Corp. 2011
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ * $
+****************************************************************************/
+
#include <sys/vfs.h>
#include <sys/task.h>
#include <string.h>
@@ -5,27 +22,76 @@
#include <sys/time.h>
#include <sys/sync.h>
+#include <initservice/taskargs.H>
#include <cxxtest/TestSuite.H>
namespace CxxTest
{
- uint64_t g_ModulesStarted = 0;
- uint64_t g_ModulesCompleted = 0;
-}
+ uint64_t g_ModulesStarted = 0;
+ uint64_t g_ModulesCompleted = 0;
+
+ /**
+ * @var g_CxxTestBarrier - barrier for CxxTest modules.
+ * all test modules will wait on this barrier before returning to the caller
+ * in cxxtest/cxxtestexec.C .
+ */
+ barrier_t g_CxxTestBarrier;
+
+} // namespace
+
+using namespace INITSERVICE;
+
+trace_desc_t *g_trac_cxxtest = NULL;
+TRAC_INIT(&g_trac_cxxtest, "CXXTEST", 1024 );
+
/**
- * @brief _start()
- * Iterate through all modules in the VFS named "libtest*" and create children
- * tasks to execute them.
+ * @brief _start() for CxxTest
+ * Iterate through all modules in the VFS named "libtest*" and create
+ * children tasks to execute them.
+ *
+ * * @parms[in,out] - pointer to TaskArgs struct
*
*/
extern "C"
-void _start(void*)
+void _start(void *io_pArgs)
{
- VfsSystemModule* vfsItr = &VFS_MODULES[0];
- tid_t tidrc = 0;
+ VfsSystemModule* vfsItr = &VFS_MODULES[0];
+ tid_t tidrc = 0;
+ uint64_t totalmodules = 0;
+ TaskArgs::TaskArgs *pTaskArgs =
+ reinterpret_cast<TaskArgs::TaskArgs *>(io_pArgs);
+
+
+ // count up the number of viable modules ahead of time
+ TRACDCOMP( g_trac_cxxtest, "Counting CxxTextExec modules:" );
+
+ while(vfsItr->module[0] != '\0')
+ {
+ if (0 == memcmp(vfsItr->module, "libtest", 7))
+ {
+ if (NULL != vfsItr->start)
+ {
+ TRACDBIN( g_trac_cxxtest,
+ "",
+ &(vfsItr->module[0]),
+ strlen( &(vfsItr->module[0]) )
+ );
+
+ totalmodules++;
+ }
+ }
+ vfsItr++;
+ }
+
+ // start executing the CxxTest modules
+ TRACDCOMP( g_trac_cxxtest, ENTER_MRK "Execute CxxTestExec, totalmodules=%d.",
+ totalmodules);
+ vfsItr = &VFS_MODULES[0]; // re-init
+
+ // set barrier for all the modules being started, plus this module
+ barrier_init( &CxxTest::g_CxxTestBarrier, totalmodules+1 );
- printk( "Executing CxxTestExec.\n");
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
while(vfsItr->module[0] != '\0')
@@ -36,28 +102,51 @@ void _start(void*)
{
__sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
- printk( "CxxTestExec %d : running %s, ModulesStarted=0x%ld\n",
+#if 0
+ // arrgh, no %s in trace
+ TRACDCOMP( g_trac_cxxtest,
+ "Running %s, ModulesStarted=%d",
__LINE__,
vfsItr->module,
CxxTest::g_ModulesStarted );
+#else
+ TRACDCOMP( g_trac_cxxtest,
+ "ModulesStarted=%d",
+ CxxTest::g_ModulesStarted );
+#endif
tidrc = task_exec( vfsItr->module, NULL );
- printk( "CxxTestExec %d : tidrc=%d\n",
- __LINE__, tidrc );
+ TRACDCOMP( g_trac_cxxtest, "Launched task: tidrc=%d",
+ tidrc );
}
}
vfsItr++;
}
+ TRACDCOMP( g_trac_cxxtest, "Waiting for all tasks to finish....");
+ // wait for all the launched tasks to finish
+ barrier_wait( &CxxTest::g_CxxTestBarrier );
+
__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);
- printk( " ModulesCompleted=0x%ld\n", CxxTest::g_ModulesCompleted );
+ TRACDCOMP( g_trac_cxxtest, " ModulesCompleted=%d",
+ CxxTest::g_ModulesCompleted );
+ TRACDCOMP( g_trac_cxxtest, EXIT_MRK "Finished CxxTestExec: ");
+ TRACDCOMP( g_trac_cxxtest, " total tests: %d",
+ CxxTest::g_TotalTests );
+ TRACDCOMP( g_trac_cxxtest, " failed tests: %d",
+ CxxTest::g_FailedTests );
+ TRACDCOMP( g_trac_cxxtest, " warnings: %d",
+ CxxTest::g_Warnings );
+ TRACDCOMP( g_trac_cxxtest, " trace calls: %d",
+ CxxTest::g_TraceCalls );
- printk( "total tests: %ld\n", CxxTest::g_TotalTests );
- printk( "failed tests: %ld\n", CxxTest::g_FailedTests );
- printk( "warnings: %ld\n", CxxTest::g_Warnings );
- printk( "trace calls: %ld\n", CxxTest::g_TraceCalls );
+ // wait for TaskArgs barrier
+ if ( pTaskArgs )
+ {
+ pTaskArgs->waitChildSync();
+ }
task_end();
}
diff --git a/src/usr/cxxtest/cxxtestgen.pl b/src/usr/cxxtest/cxxtestgen.pl
index d21305250..1bce4ae0d 100755
--- a/src/usr/cxxtest/cxxtestgen.pl
+++ b/src/usr/cxxtest/cxxtestgen.pl
@@ -1,4 +1,21 @@
#!/usr/bin/perl -w
+#############################################################################
+# $IBMCopyrightBlock:
+#
+# IBM Confidential
+#
+# Licensed Internal Code Source Materials
+#
+# IBM HostBoot Licensed Internal Code
+#
+# (C) Copyright IBM Corp. 2011
+#
+# The source code for this program is not published or other-
+# wise divested of its trade secrets, irrespective of what has
+# been deposited with the U.S. Copyright Office.
+#$
+#############################################################################
+
#
# Change History:
# mww 2011-05-10 simplify for sprint1 - stuff for later is commented out with "##"
@@ -39,6 +56,7 @@ sub main {
parseCommandline();
scanInputFiles();
writeOutput();
+
}
#
@@ -718,6 +736,8 @@ sub write_start() {
print "\n";
print "\t__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);\n";
+ print "\n";
+ print "\tbarrier_wait( &CxxTest::g_CxxTestBarrier );\n";
print "\n";
print "\ttask_end();\n";
OpenPOWER on IntegriCloud