diff options
Diffstat (limited to 'src/usr/cxxtest')
-rwxr-xr-x | src/usr/cxxtest/TestSuite.C | 47 | ||||
-rw-r--r-- | src/usr/cxxtest/cxxtestexec.C | 38 | ||||
-rwxr-xr-x | src/usr/cxxtest/cxxtestgen.pl | 27 |
3 files changed, 50 insertions, 62 deletions
diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C index 99055d0cf..79677b83b 100755 --- a/src/usr/cxxtest/TestSuite.C +++ b/src/usr/cxxtest/TestSuite.C @@ -114,53 +114,6 @@ void reportTotalTests( const char *suitename, uint64_t numtests ) return; } -/** - * @brief accessor to read global totaltests var - * @TODO make these readonly accessors - * - * @return number of total tests - */ -uint64_t getTotalTests(void) -{ - - return g_TotalTests; -} - -/** - * @brief accessor to read global failedtests var - * @TODO make these readonly accessors - * - * @return total number off failures executed - */ -uint64_t getFailedTests(void) -{ - - return g_FailedTests; -} - -/** - * @brief accessor to read global warnings var - * @TODO make these readonly accessors - * - * @return total number of warnings executed - */ -uint64_t getWarnings(void) -{ - - return g_Warnings; -} - -/** - * @brief accessor to read global tracecalls var - * @TODO make these readonly accessors - * - * @return total number of trace calls executed - */ -uint64_t getTraceCalls(void) -{ - - return g_TraceCalls; -} }; diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C index 5efb1827e..d79188e9e 100644 --- a/src/usr/cxxtest/cxxtestexec.C +++ b/src/usr/cxxtest/cxxtestexec.C @@ -3,22 +3,29 @@ #include <string.h> #include <kernel/console.H> #include <sys/time.h> +#include <sys/sync.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; } -/* Iterate through all modules in the VFS named "libtest*" and create children - * tasks to execute them. +/** + * @brief _start() + * Iterate through all modules in the VFS named "libtest*" and create children + * tasks to execute them. + * */ extern "C" -void _start(void*) +void _start(void*) { VfsSystemModule* vfsItr = &VFS_MODULES[0]; + tid_t tidrc = 0; - printk( "Executing CxxTestExec module.\n"); + printk( "Executing CxxTestExec.\n"); __sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1); while(vfsItr->module[0] != '\0') @@ -28,9 +35,15 @@ void _start(void*) if (NULL != vfsItr->start) { __sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1); - printk( "running %s, ModulesStarted=0x%ld\n", - vfsItr->module, CxxTest::g_ModulesStarted ); - task_exec(vfsItr->module, NULL); + + printk( "CxxTestExec %d : running %s, ModulesStarted=0x%ld\n", + __LINE__, + vfsItr->module, + CxxTest::g_ModulesStarted ); + tidrc = task_exec( vfsItr->module, NULL ); + printk( "CxxTestExec %d : tidrc=%d\n", + __LINE__, tidrc ); + } } vfsItr++; @@ -39,5 +52,12 @@ void _start(void*) __sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1); printk( " ModulesCompleted=0x%ld\n", CxxTest::g_ModulesCompleted ); + + 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 ); + + task_end(); } diff --git a/src/usr/cxxtest/cxxtestgen.pl b/src/usr/cxxtest/cxxtestgen.pl index 701c98633..d21305250 100755 --- a/src/usr/cxxtest/cxxtestgen.pl +++ b/src/usr/cxxtest/cxxtestgen.pl @@ -616,7 +616,9 @@ sub writeHostBootPreamble() { print "#include <sys/sync.h>\n"; print "#include <sys/vfs.h>\n"; print "#include <sys/task.h>\n"; + print "#include <sys/sync.h>\n"; print "#include <trace/interface.H>\n"; + ## $$TODO print "#include <taskargs/taskargs.H>\n"; print "#include <cxxtest/TestSuite.H>\n"; @@ -629,6 +631,8 @@ sub writeHostBootSuites() { $suitecount = 1; # initialize suite count $testcount = 0; # initialize test count + + ## $$TODO print "\tTaskArgs *pTaskArgs = (TaskArgs *)ptr;\n"; foreach (@suites) { $suite = $_; @@ -654,7 +658,7 @@ sub writeHostBootSuites() { ## declare and instantiate a new instance of the suite print "\t// Test Suite ", $suitecount, ": " , suiteName(), "\n"; - print "\tprintk(\"Executing test suite ", suiteName(), ".\\n\");\n"; + if ( $debug ) { print "\tprintk(\"Executing test suite ", suiteName(), ".\\n\");\n"; } print "\tTRACDCOMP( g_trac_test, \"Execute ", suiteName(), ".\");\n"; print "\t", suiteName(), "\t*", $suitevar, " = new ", suiteName(), ";\n"; @@ -669,7 +673,12 @@ sub writeHostBootSuites() { printf "\t$suitevar->%s();\n\n", testName(); $testcount++; } - + + ## $$TODO print "\n"; + ## $$TODO print "\tif ( pTaskArgs )\n"; + ## $$TODO print "\t{\n"; + ## $$TODO print "\t\tpTaskArgs->waitChildSync();\n"; + ## $$TODO print "\t}\n"; print "\n"; ## delete the suite instance @@ -689,6 +698,9 @@ sub writeHostBootSuites() { sub write_start() { print "\n"; + ## $$TODO print "\tusing namespace TASKARGS;\n"; + + print "\n"; print "trace_desc_t *g_trac_test = NULL;\n"; ## Use same trace buffer for all unit tests, i.e. "UNIT_TEST" ## print "TRAC_INIT(&g_trac_test, \"", suiteName(), "\", 4096);\n"; @@ -697,14 +709,17 @@ sub write_start() { print "\n\n"; print "extern \"C\"\n"; - print "void _start(void*) {\n"; - print "\n"; - - ## here's where the magic happens.... + print "void _start(void *ptr) "; + print "{\n"; + + + ## here's where the magic happens.... writeHostBootSuites(); print "\n"; print "\t__sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);\n"; + + print "\n"; print "\ttask_end();\n"; print "}\n"; |