[rfc][icedtea-web] C++ unit tests support for ITW :D

Adam Domurad adomurad at redhat.com
Tue Nov 20 13:05:34 PST 2012

To lay the groundwork for future C++ refactoring I have created a patch 
that integrates UnitTest++ into the source of icedtea-web. Some notes on 
design decisions:

- Two new folders in tests/, UnitTest++ and cpp-unit-tests.
     - UnitTest++ contains the source of UnitTest++ (minus test cases 
which I decided to not copy over for simplicity). The makefile provided 
is not used, instead a simple for loop over the source is used to 
compile it in the target for the library. Feel free to advise ways to 
improve this.
     - cpp-unit-tests contains the source of the unit tests. Each .cpp 
file contains test cases that are3 compiled and linked with 
libUnitTest++.a as well as the object files from the plugin. These as 
well are compiled using a simple for loop. If you can think of a way to 
correctly add dependencies for the makefile without too much cruft let 
me know.
- A new make target, make run-cpp-unit-tests runs the unit tests.

UnitTest++ was chosen because its lightweight, and only requires that 
you include a TEST (...) { } definition in .cpp files, no header files 

Two patches are included, one that adds the source from UnitTest++ and 
does nothing else, and the rest that does the infrastructure to compile 
and run the unit tests.

AddUnitTest++.patch and its ChangeLog attached.

ChangeLog for integration:

2012-11-20  Adam Domurad  <adomurad at redhat.com>

     Support for C++ unit testing with UnitTest++ for IcedTeaWeb.
     * tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc: New, contains tests
     for utility functions.
     * tests/cpp-unit-tests/main.cc: New, contains unit test runner.
     * plugin/icedteanp/IcedTeaPluginUtils.h: Remove incorrect circular
     include dependency
     * plugin/icedteanp/IcedTeaRunnable.h: Add includes necessary for
     self-sustaining header.
     * Makefile.am: Add targets for unit test compilation and running,
     eg 'make run-cpp-unit-tests'.

(I toyed around with setting up my Eclipse project for the icedtea-web 
C++ code to run the unit tests via External Tool, its quite nice like 
that :)

-------------- next part --------------
2012-11-20  Adam Domurad  <adomurad at redhat.com>
	Add the source code to UnitTest++ into the project.
	* tests/UnitTest++/COPYING: Part of UnitTest++
	* tests/UnitTest++/Makefile: Part of UnitTest++
	* tests/UnitTest++/README: Part of UnitTest++
	* tests/UnitTest++/src/AssertException.cpp: Part of UnitTest++
	* tests/UnitTest++/src/AssertException.h: Part of UnitTest++
	* tests/UnitTest++/src/CheckMacros.h: Part of UnitTest++
	* tests/UnitTest++/src/Checks.cpp: Part of UnitTest++
	* tests/UnitTest++/src/Checks.h: Part of UnitTest++
	* tests/UnitTest++/src/Config.h: Part of UnitTest++
	* tests/UnitTest++/src/CurrentTest.cpp: Part of UnitTest++
	* tests/UnitTest++/src/CurrentTest.h: Part of UnitTest++
	* tests/UnitTest++/src/DeferredTestReporter.cpp: Part of UnitTest++
	* tests/UnitTest++/src/DeferredTestReporter.h: Part of UnitTest++
	* tests/UnitTest++/src/DeferredTestResult.cpp: Part of UnitTest++
	* tests/UnitTest++/src/DeferredTestResult.h: Part of UnitTest++
	* tests/UnitTest++/src/ExecuteTest.h: Part of UnitTest++
	* tests/UnitTest++/src/MemoryOutStream.cpp: Part of UnitTest++
	* tests/UnitTest++/src/MemoryOutStream.h: Part of UnitTest++
	* tests/UnitTest++/src/Posix/SignalTranslator.cpp: Part of UnitTest++
	* tests/UnitTest++/src/Posix/SignalTranslator.h: Part of UnitTest++
	* tests/UnitTest++/src/Posix/TimeHelpers.cpp: Part of UnitTest++
	* tests/UnitTest++/src/Posix/TimeHelpers.h: Part of UnitTest++
	* tests/UnitTest++/src/ReportAssert.cpp: Part of UnitTest++
	* tests/UnitTest++/src/ReportAssert.h: Part of UnitTest++
	* tests/UnitTest++/src/Test.cpp: Part of UnitTest++
	* tests/UnitTest++/src/Test.h: Part of UnitTest++
	* tests/UnitTest++/src/TestDetails.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestDetails.h: Part of UnitTest++
	* tests/UnitTest++/src/TestList.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestList.h: Part of UnitTest++
	* tests/UnitTest++/src/TestMacros.h: Part of UnitTest++
	* tests/UnitTest++/src/TestReporter.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestReporter.h: Part of UnitTest++
	* tests/UnitTest++/src/TestReporterStdout.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestReporterStdout.h: Part of UnitTest++
	* tests/UnitTest++/src/TestResults.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestResults.h: Part of UnitTest++
	* tests/UnitTest++/src/TestRunner.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TestRunner.h: Part of UnitTest++
	* tests/UnitTest++/src/TestSuite.h: Part of UnitTest++
	* tests/UnitTest++/src/TimeConstraint.cpp: Part of UnitTest++
	* tests/UnitTest++/src/TimeConstraint.h: Part of UnitTest++
	* tests/UnitTest++/src/TimeHelpers.h: Part of UnitTest++
	* tests/UnitTest++/src/UnitTest++.h: Part of UnitTest++
	* tests/UnitTest++/src/XmlTestReporter.cpp: Part of UnitTest++
	* tests/UnitTest++/src/XmlTestReporter.h: Part of UnitTest++
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AddUnitTest++Source.patch
Type: text/x-patch
Size: 63191 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121120/d38a78b6/AddUnitTestSource.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnitTest++integration.patch
Type: text/x-patch
Size: 11519 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121120/d38a78b6/UnitTestintegration.patch 

More information about the distro-pkg-dev mailing list