summaryrefslogtreecommitdiffstats
path: root/src/usr/example
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-05-18 15:52:46 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-06-01 14:07:35 -0500
commit8509613766f5b1074f89589e653bcb8a4cec2ac0 (patch)
treee5445f93b2bb1c1a9741b737f217b0385e0e5f96 /src/usr/example
parent329be941b1056a3b2e68fcfdf1bc4a9cd5335c84 (diff)
downloadtalos-hostboot-8509613766f5b1074f89589e653bcb8a4cec2ac0.tar.gz
talos-hostboot-8509613766f5b1074f89589e653bcb8a4cec2ac0.zip
CxxTest logs messages to trace buffer
- mark globals with g_ - thread safety - remove more tabs. - Add globals and accessors to track totaltests, failedtests, warnings, tracecalls. - Modify cxxtestgen.pl to add reportTotalTests() call - uncommented printk's in TestSuite.C - cxxtestgen.pl just prints out the test suite - exampletest.H has more descriptive test names, forces a FAIL, WARN, and TRACE - add a printk() to cxxtest module so that we know it ran. Change-Id: I3ff25b228f17371b6f84bdb16309015818867266 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/90 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/example')
-rw-r--r--src/usr/example/test/exampletest.H67
1 files changed, 48 insertions, 19 deletions
diff --git a/src/usr/example/test/exampletest.H b/src/usr/example/test/exampletest.H
index ec2e60dba..f6cad9863 100644
--- a/src/usr/example/test/exampletest.H
+++ b/src/usr/example/test/exampletest.H
@@ -5,56 +5,85 @@
* @file exampletest.H
*
* @brief Example for people to use when writing test cases for their module.
+ * @todo add more doxygen blocks
*/
#include <cxxtest/TestSuite.H>
#include <example/example.H>
+
class ExampleTest: public CxxTest::TestSuite
{
public:
+
/**
- * @test Test Description
- */
- void testExample1(void)
+ * @test TS_WARN will run if the example1_function FAILS
+ * */
+ void testExampleWarn(void)
{
uint64_t l_rc = 0;
l_rc = example1_function();
if(l_rc)
{
- TS_FAIL("Call to example1_function1 failed!");
+ TS_WARN("Warning, Call to example1_function1 returned bad value.\n");
}
}
+
/**
- * @test Test Description
- */
- void testExample2(void)
+ * @test TS_TRACE will run if the example1_function FAILS
+ * */
+ void testExampleTrace(void)
{
- // Call functions and validate results
- // TS_FAIL("Failed test call to example2 function");
+ uint64_t l_rc = 0;
+ l_rc = example1_function();
+ if(l_rc)
+ {
+ TS_TRACE("Tracing something in example1_function1\n");
+ }
}
/**
- * @test Test Description
+ * @test TS_FAIL will run if the example1_function FAILS
*/
- void testExample3(void)
+ void testExampleFail(void)
{
- // Call functions and validate results
- // TS_FAIL("Failed test call to example3 function");
+ uint64_t l_rc = 0;
+ l_rc = example1_function();
+ if(l_rc)
+ {
+ TS_FAIL("Call to example1_function1 failed!\n");
+ }
}
- void testExample4(void)
+ /**
+ * @test this will always run TS_FAIL
+ */
+ void testExampleForceFail(void)
+ {
+
+ TS_FAIL("Run TS_FAIL() as part of the example test.\n" );
+ }
+
+ /**
+ * @test this will always run TS_WARN
+ */
+ void testExampleForceWarn(void)
{
- // Call functions and validate results
- // TS_FAIL("Failed test call to example3 function");
+
+ TS_WARN("Run TS_WARN() as part of the example test\n" );
}
- void testExample5(void)
+ /**
+ * @test this will always run TS_WARN
+ */
+ void testExampleForceTrace(void)
{
- // Call functions and validate results
- // TS_FAIL("Failed test call to example3 function");
+
+ TS_TRACE("Run TS_TRACE() as part of the example test\n" );
}
+
+
};
#endif
OpenPOWER on IntegriCloud