summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-07-22 16:08:28 -0500
committerMark W. Wenning <wenning@us.ibm.com>2011-07-28 19:01:14 -0500
commitf5b3b1b3de680ef354419b74b50afe8b93012a4e (patch)
tree90374aade4a6a72dc38ae5a49b4b128e22fffafb /src/usr
parentd7e9478f1de907b1b3d4923b507964222cb224fe (diff)
downloadtalos-hostboot-f5b3b1b3de680ef354419b74b50afe8b93012a4e.tar.gz
talos-hostboot-f5b3b1b3de680ef354419b74b50afe8b93012a4e.zip
RTC 3367, 3321 TS_FAIL and TS_WARN should send to trace buffer instead of printk
- first commit - add cxxtesttest.H unit test - comment out warn and fail from unit tests, leave for sandbox builds - make citest finishes OK - merge problems with gerrit Change-Id: Id9157837e1511eb1aebb13aeadd2286a8dce5eb3 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/210 Tested-by: Jenkins Server Reviewed-by: Mark W. Wenning <wenning@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/cxxtest/TestSuite.C43
-rw-r--r--src/usr/cxxtest/makefile19
-rw-r--r--src/usr/cxxtest/test/cxxtesttest.H120
-rw-r--r--src/usr/cxxtest/test/makefile23
4 files changed, 193 insertions, 12 deletions
diff --git a/src/usr/cxxtest/TestSuite.C b/src/usr/cxxtest/TestSuite.C
index 2af815346..071c322d2 100755
--- a/src/usr/cxxtest/TestSuite.C
+++ b/src/usr/cxxtest/TestSuite.C
@@ -46,12 +46,11 @@ void TestSuite::tearDown() {}
* @return void
*
*/
-void doTrace( void )
+void doTrace( )
{
__sync_add_and_fetch( &g_TraceCalls, 1 );
- return;
}
/**
@@ -65,11 +64,24 @@ void doTrace( void )
* @return void
*
*/
-void doWarn( const char *file, unsigned line, const char *message )
+void doWarn( )
{
- printk("WARN: %s %u %s\n", file, line, message);
__sync_add_and_fetch( &g_Warnings, 1 );
+
+}
+
+/**
+ * @brief Implement Fail action in unit tests
+ *
+ * @return none
+ */
+
+void doFailTest( )
+{
+
+ __sync_add_and_fetch( &g_FailedTests, 1 );
+
}
/**
@@ -77,18 +89,22 @@ void doWarn( const char *file, unsigned line, const char *message )
*
* @param [in] pointer to filename (not used right now )
* @param [in] line number
- * @param [in] failure message
*
- * @return void
+ * @return none
*/
-void doFailTest( const char *file, unsigned line, const char *message )
+void doFailTest( const char *filename, uint32_t linenum )
{
-
- printk("FAIL: %s %u %s\n", file, line, message);
+ TRACDBIN( g_trac_test,
+ "!!! > Test Failed: ",
+ filename,
+ strlen( filename) );
+ TRACDCOMP( g_trac_test,
+ "!!! >at line %d ",
+ linenum );
__sync_add_and_fetch( &g_FailedTests, 1 );
-}
+}
/**
* @brief Report total number of unit tests in a test suite
*
@@ -100,11 +116,14 @@ void doFailTest( const char *file, unsigned line, const char *message )
* @param [in] trace message
*
* @return void
+ *
+ * @TODO do nothing with the suite name for now, later it may be useful
+ *
*/
-void reportTotalTests( const char *suitename, uint64_t numtests )
+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 );
TRACDBIN( g_trac_test,
"Suite Completed: ",
diff --git a/src/usr/cxxtest/makefile b/src/usr/cxxtest/makefile
index f28902c76..37ae0e43f 100644
--- a/src/usr/cxxtest/makefile
+++ b/src/usr/cxxtest/makefile
@@ -1,6 +1,25 @@
+#############################################################################
+# $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.
+#$
+#############################################################################
+
ROOTPATH = ../../..
MODULE = cxxtest
+SUBDIRS=test.d
+
OBJS = TestSuite.o cxxtestexec.o
include ${ROOTPATH}/config.mk
diff --git a/src/usr/cxxtest/test/cxxtesttest.H b/src/usr/cxxtest/test/cxxtesttest.H
new file mode 100644
index 000000000..89a67401a
--- /dev/null
+++ b/src/usr/cxxtest/test/cxxtesttest.H
@@ -0,0 +1,120 @@
+/****************************************************************************
+ * $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.
+ * $
+****************************************************************************/
+
+#ifndef __TEST_CXXTESTTEST_H
+#define __TEST_CXXTESTTEST_H
+
+/**
+ * @file cxxtesttest.H
+ *
+ * unit tests for TS_TRACE, TS_WARN, and TS_FAIL macros
+ *
+ */
+
+/**
+ * @class cxxtest
+ *
+ * - test TS_TRACE, TS_WARN and TS_FAIL macros
+ *
+ */
+
+#include <cxxtest/TestSuite.H>
+
+class CxxTestTest: public CxxTest::TestSuite
+{
+public:
+
+
+ /**
+ * @test TS_TRACE macro
+ *
+ */
+ void testCxxTestTrace(void)
+ {
+ int32_t l_dec = 1234567890;
+ uint32_t l_hex = 0x12345678;
+ uint64_t l_bighex = 0x1234567890abcdef;
+
+ TS_TRACE( "CxxTest Trace dec=%d", l_dec );
+ TS_TRACE( "CxxTest Trace hex=0x%x", l_hex );
+ TS_TRACE( "CxxTest Trace bighex=0x%llx", l_bighex );
+ TS_TRACE( "CxxTest Trace pointer=%p", &l_bighex );
+ TS_TRACE( "CxxTest Trace string=%s", "testing...\n" );
+
+ // all-in one.
+ TS_TRACE( "CxxTest Trace dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
+ l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
+ }
+
+
+ /**
+ * @test TS_WARN will run if the testExampleWarn_function FAILS
+ *
+ * @note: please leave this here, but disabled. It is useful for
+ * sandbox testing.
+ */
+// void testCxxTestWarn(void)
+// {
+// int32_t l_dec = 1234567890;
+// uint32_t l_hex = 0x12345678;
+// uint64_t l_bighex = 0x1234567890abcdef;
+//
+// TS_WARN( "CxxTest Warning dec=%d", l_dec );
+// TS_WARN( "CxxTest Warning hex=0x%x", l_hex );
+// TS_WARN( "CxxTest Warning bighex=0x%llx", l_bighex );
+// TS_WARN( "CxxTest Warning pointer=%p", &l_bighex );
+// TS_WARN( "CxxTest Warning string=%s", "testing...\n" );
+//
+// // all-in one.
+// TS_WARN( "CxxTest Warn dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
+// l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
+//
+// }
+
+
+
+ /**
+ * @test TS_FAIL will run if the testExampleFail function FAILS
+ *
+ * @note: please leave this here, but disabled. It is useful for
+ * sandbox testing.
+ */
+// void testCxxTestFail(void)
+// {
+// int32_t l_dec = 1234567890;
+// uint32_t l_hex = 0x12345678;
+// uint64_t l_bighex = 0x1234567890abcdef;
+//
+// TS_FAIL( "CxxTest Fail dec=%d", l_dec );
+// TS_FAIL( "CxxTest Fail hex=0x%x", l_hex );
+// TS_FAIL( "CxxTest Fail bighex=0x%llx", l_bighex );
+// TS_FAIL( "CxxTest Fail pointer=%p", &l_bighex );
+// TS_FAIL( "CxxTest Fail string=%s", "testing...\n" );
+//
+// // all-in one.
+// TS_FAIL( "CxxTest FAIL dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
+// l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
+//
+// }
+
+
+
+
+}; // end class
+
+#endif
+
diff --git a/src/usr/cxxtest/test/makefile b/src/usr/cxxtest/test/makefile
new file mode 100644
index 000000000..1b57a7db3
--- /dev/null
+++ b/src/usr/cxxtest/test/makefile
@@ -0,0 +1,23 @@
+#############################################################################
+# $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.
+#$
+#############################################################################
+
+ROOTPATH = ../../../..
+
+MODULE = testcxxtest
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud