summaryrefslogtreecommitdiff
path: root/src/msvc6
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-15 14:33:11 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-15 14:33:11 +0000
commit1b4bcf6f703248cb397587fe08635a1491d460ec (patch)
treee0ae81d803807027d7b4a6f14d9c39da2321dd47 /src/msvc6
parent5f5af41d52c01c8320baffea21cd60ebbb16380b (diff)
downloadcppunit-1b4bcf6f703248cb397587fe08635a1491d460ec.tar.gz
NEWS: updated.
NEWS: updated. * configure.in: added include/cppunit/config/Makefile and include/cppunit/plugin/Makefile to the list of target. * doc/CppUnit-win.dox: enabled generation of HTML Help documentation. * include/cppunit/config/Makefile.am: * include/cppunit/plugin/Makefile.am: added. * include/cppunit/config-bcb5.h: * include/cppunit/config-msvc6.h: * include/cppunit/config-mac.h: moved to include/cppunit/config/. * include/cppunit/Portability.h: updated config files location. Added macros CPPUNIT_STRINGIZE and CPPUNIT_JOIN (implementation adapted from boost.org). Added macro CPPUNIT_MAKE_UNIQUE_NAME. * include/cppunit/Test.h: modified methods order. * include/cppunit/extensions/HelperMacros.h: renamed macro __CPPUNIT_MAKE_UNIQUE_NAME to CPPUNIT_MAKE_UNIQUE_NAME and moved its definition to include/cppunit/Portability.h. * include/cppunit/extensions/TestDecorator.h: Inherits Test instead of TestLeaf. * include/cppunit/plugin/DynamicLibraryManager.h: * src/cppunit/DynamicLibraryManager.cpp: added. DLL manager (load & lookup symbol). * src/cppunit/BeOsDynamicLibraryManager.cpp: * src/cppunit/UnixDynamicLibraryManager.cpp: * src/cppunit/Win32DynamicLibraryManager.cpp: added. Implementation of platform dependent methods of DynamicLibraryManager. * include/cppunit/plugin/DynamicLibraryManagerException.h: * src/cppunit/DynamicLibraryManagerException.cpp: added. Exception thrown by DynamicLibraryManager. * include/cppunit/plugin/TestPlugIn.h: added. CppUnitTestPlugIn interface definition. Helper macros to implements plug-in. * include/cppunit/plugin/TestPlugInSuite.h: * src/cppunit/plugin/TestPlugInSuite.cpp: added. A suite to wrap a test plug-in. * include/cppunit/plugin/TestPlugInDefaultImpl.h: * src/cppunit/TestPlugInDefaultImpl.cpp: added. A default implementation of the test plug-in interface. * src/msvc6/DllPlugInTester/DllPlugInTester.cpp: updated to use the new TestPlugIn. * examples/cppunittest/TestResultCollectorTest.cpp: fixed typo.
Diffstat (limited to 'src/msvc6')
-rw-r--r--src/msvc6/DllPlugInTester/DllPlugInTester.cpp63
-rw-r--r--src/msvc6/DllPlugInTester/DllPlugInTester.dsp4
2 files changed, 25 insertions, 42 deletions
diff --git a/src/msvc6/DllPlugInTester/DllPlugInTester.cpp b/src/msvc6/DllPlugInTester/DllPlugInTester.cpp
index c94adf7..7292704 100644
--- a/src/msvc6/DllPlugInTester/DllPlugInTester.cpp
+++ b/src/msvc6/DllPlugInTester/DllPlugInTester.cpp
@@ -5,22 +5,29 @@
#include <cppunit/TextTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <tchar.h>
-#include <msvc6/testrunner/TestPlugInInterface.h>
-#include <stdexcept>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/plugin/TestPlugInSuite.h>
+#include <cppunit/plugin/DynamicLibraryManagerException.h>
+#include <cppunit/extensions/TestDecorator.h>
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
#ifndef _UNICODE
#define TCERR std::cerr
#else
#define TCERR std::wcerr
#endif
+class NotOwningTestRunner : public CppUnit::TestRunner
+{
+public:
+ typedef CppUnit::TestRunner SuperClass; // work around VC++ bug
+
+ void addTest( CppUnit::Test *test )
+ {
+ SuperClass::addTest( new CppUnit::TestDecorator( test ) );
+ }
+};
+
/*! Converts a ansi string to a TCHAR string.
*/
@@ -90,7 +97,7 @@ runDllTest( CppUnit::Test *root,
CppUnit::TextTestProgressListener progress;
controller.addListener( &progress );
- CppUnit::TestRunner runner;
+ NotOwningTestRunner runner;
if ( numberOfPath == 0 )
runner.addTest( root );
else
@@ -100,7 +107,7 @@ runDllTest( CppUnit::Test *root,
const TCHAR *testPath = testPaths[index];
try
{
- runner.addTest( root->resolveTestPath( toAnsiString( testPath ) ).getChildTest() );
+ runner.addTest( root->resolveTestPath( testPath).getChildTest() );
}
catch ( std::invalid_argument & )
{
@@ -115,7 +122,7 @@ runDllTest( CppUnit::Test *root,
std::cerr << std::endl;
CppUnit::CompilerOutputter outputter( &result, std::cerr );
- outputter.write();
+ outputter.write();
return result.wasSuccessful();
}
@@ -169,43 +176,19 @@ _tmain( int argc,
// open the dll
const TCHAR *dllFileName = argv[1];
- HINSTANCE dllHandle = ::LoadLibrary( dllFileName );
- if ( dllHandle == NULL )
- {
- TCERR << "Failed to load dll: " << dllFileName << std::endl;
- return failureReturnCode;
- }
- // get the plug in function in the dll
- const TCHAR *plugFunctionName = _T("GetTestPlugInInterface");
- GetTestPlugInInterfaceFunction plug = (GetTestPlugInInterfaceFunction)
- ::GetProcAddress( dllHandle, plugFunctionName );
bool wasSuccessful = false;
try
{
- if ( plug != NULL )
- {
- TestPlugInInterface *theInterface = (*plug)();
- wasSuccessful = runDllTest( theInterface->makeTest(), argv+2, argc-2 );
- }
- else
- {
- TCERR << _T("Failed to find exported function named '")
- << plugFunctionName << _T("'")
- << std::endl;
- }
+ CppUnit::TestPlugInSuite suite( dllFileName );
+ wasSuccessful = runDllTest( &suite, argv+2, argc-2 );
}
- catch ( std::exception &e )
+ catch ( CppUnit::DynamicLibraryManagerException &e )
{
- TCERR << _T( "Unexpected exception when running test. You should report this"
- " and the context which produced the exception:" )
- << std::endl
- << toVariableString( e.what() )
- << std::endl;
+ TCERR << "Failed to load test plug-in:" << std::endl
+ << toVariableString( e.what() ) << std::endl;
}
- ::FreeLibrary( dllHandle );
-
return wasSuccessful ? successReturnCode : failureReturnCode;
}
diff --git a/src/msvc6/DllPlugInTester/DllPlugInTester.dsp b/src/msvc6/DllPlugInTester/DllPlugInTester.dsp
index 7461c95..c21f022 100644
--- a/src/msvc6/DllPlugInTester/DllPlugInTester.dsp
+++ b/src/msvc6/DllPlugInTester/DllPlugInTester.dsp
@@ -105,7 +105,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunit.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../lib"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunit.lib /nologo /entry:"" /subsystem:console /machine:I386 /out:"..\..\..\lib\DllPlugInTesteru.exe" /libpath:"../../../lib"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunit.lib /nologo /subsystem:console /machine:I386 /out:"..\..\..\lib\DllPlugInTesteru.exe" /libpath:"../../../lib"
!ELSEIF "$(CFG)" == "DllPlugInTester - Win32 Debug Unicode"
@@ -132,7 +132,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/DllPlugInTesterd.exe" /pdbtype:sept /libpath:"../../../lib"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd.lib /nologo /entry:"" /subsystem:console /incremental:no /debug /machine:I386 /out:"..\..\..\lib\DllPlugInTesterud.exe" /pdbtype:sept /libpath:"../../../lib"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"..\..\..\lib\DllPlugInTesterud.exe" /pdbtype:sept /libpath:"../../../lib"
!ENDIF