diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2011-05-10 17:20:10 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-05-16 16:51:41 -0500 |
commit | e604f02230c3decedbdd56a3cfef66b0709b74dc (patch) | |
tree | 85ebf5ba3dd090bd80d8651fdf4b4855a2022a30 /src/usr/example | |
parent | f25d156f4a222923d70563ba960858f4e42a80c8 (diff) | |
download | talos-hostboot-e604f02230c3decedbdd56a3cfef66b0709b74dc.tar.gz talos-hostboot-e604f02230c3decedbdd56a3cfef66b0709b74dc.zip |
Base cxxtest class and some examples.
Change-Id: I8ff2fdffe8be34f5ece9a5e4b2f5d07a4bc73d73
Reviewed-on: http://gfwr801.rchland.ibm.com:8080/gerrit/71
Tested-by: Jenkins Server
Reviewed-by: Mark W. Wenning <wenning@us.ibm.com>
Diffstat (limited to 'src/usr/example')
-rw-r--r-- | src/usr/example/example.C | 10 | ||||
-rw-r--r-- | src/usr/example/makefile | 2 | ||||
-rw-r--r-- | src/usr/example/test/exampletest.C | 31 | ||||
-rw-r--r-- | src/usr/example/test/exampletest.H | 28 | ||||
-rw-r--r-- | src/usr/example/test/makefile | 6 |
5 files changed, 77 insertions, 0 deletions
diff --git a/src/usr/example/example.C b/src/usr/example/example.C index 193bbb9d3..69291325b 100644 --- a/src/usr/example/example.C +++ b/src/usr/example/example.C @@ -11,6 +11,7 @@ #include <sys/vfs.h> #include <sys/task.h> #include <trace/interface.H> +#include <example/example.H> //static mutex_t value = mutex_create(); trace_desc_t *g_trac_test = NULL; @@ -42,3 +43,12 @@ void _start(void*) task_end(); } + +uint64_t example1_function() +{ + uint64_t l_rc = 0; + + TRACFCOMP(g_trac_test, "Someone Called example1_function!"); + + return l_rc; +} diff --git a/src/usr/example/makefile b/src/usr/example/makefile index 10a249ff9..f3a58399f 100644 --- a/src/usr/example/makefile +++ b/src/usr/example/makefile @@ -3,4 +3,6 @@ MODULE = example OBJS = example.o +SUBDIRS = test.d + include ${ROOTPATH}/config.mk diff --git a/src/usr/example/test/exampletest.C b/src/usr/example/test/exampletest.C new file mode 100644 index 000000000..a1cd84d51 --- /dev/null +++ b/src/usr/example/test/exampletest.C @@ -0,0 +1,31 @@ +// Note that this file will eventually be generated by the cxxtest perl +// script. This is here just as reference right now. + +#include <kernel/console.H> +#include <sys/mutex.h> +#include <sys/vfs.h> +#include <sys/task.h> +#include <trace/interface.H> +#include <example/example.H> +#include "exampletest.H" + +//static mutex_t value = mutex_create(); + + +trace_desc_t *g_trac_test = NULL; +TRAC_INIT(&g_trac_test, "EXAMPLE", 4096); + +extern "C" +void _start(void*) +{ + printk("Executing example test module.\n"); + + ExampleTest *l_ex = new ExampleTest(); + + l_ex->testExample1(); + + delete l_ex; + + task_end(); +} + diff --git a/src/usr/example/test/exampletest.H b/src/usr/example/test/exampletest.H new file mode 100644 index 000000000..aba750c08 --- /dev/null +++ b/src/usr/example/test/exampletest.H @@ -0,0 +1,28 @@ +#include <cxxtest/TestSuite.H> +#include <example/example.H> + +class ExampleTest: public CxxTest::TestSuite +{ +public: + void testExample1(void) + { + uint64_t l_rc = 0; + l_rc = example1_function(); + if(l_rc) + { + TS_FAIL("Call to example1_function1 failed!"); + } + } + void testExample2(void) + { + // Call functions and validate results + // TS_FAIL("Failed test call to example2 function"); + } + void testExample3(void) + { + // Call functions and validate results + // TS_FAIL("Failed test call to example3 function"); + } + +}; + diff --git a/src/usr/example/test/makefile b/src/usr/example/test/makefile new file mode 100644 index 000000000..690c64045 --- /dev/null +++ b/src/usr/example/test/makefile @@ -0,0 +1,6 @@ +ROOTPATH = ../../../.. +MODULE = testexample + +OBJS = exampletest.o + +include ${ROOTPATH}/config.mk |