Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CppUnit RemoteTestRunner now working under Windows using MinGW

I've been playing around the last two days with the CppUnit Tests, since I'd
like to try 
to use them for my diploma thesis work. 
I'm using MinGW since I don't like another wrapper like the cygwin.dll for
my project.
So I already tested the cppunit-1.8.0 and it works. I did the following:
I'm using Eclipse 2.1.1 with CDT 1.2 GA.

*** CppUnit Library Tasks

Take the sources of cppunit-1.8.0 and unpack i.e. in D:\cppunit-1.8.0.
Have MinGW (gcc-3.2.3) installed in D:\MinGW and MSYS in D:\msys\1.0. The
shell 
(bash) in msys will make Unix-like mount  /mingw for MinGW.

Go into MSYS, type at the shell prompt:
$ cd /d/cppunit-1.8.0
$ ./configure --prefix=/mingw
... a lot of configure output ...
$ make
... a lot of make output ...
$ make install
... a lot of make install output ...
$
The cppunit stuff will be now in MinGW's lib- & include-path.


*** Eclipse CppUnit Plugin Tasks

Install the Eclipse CppUnit Plugin using the Update Manager.

The next thing is your RemoteTestRunner, which took a little more work in
order 
to get the socket stuff right. The sources are attached. Exchange the
original 
RemoteTestRunner.cpp from the org.eclipse.cdt.cppunit_1.1.0/lib with the
attached 
one. 

What is still needed is an additional switch for linking against winsock2,
so if you 
can adapt the makefile creator to add -lws2_32 to the CppUnit-Plugin library
section. 
The __MSVCRT__ symbol is btw. set by the compiler per default, since MinGW
links 
against msvcrt. I've just seen changes made to RemoteTestRunner.cpp in CVS,
they
seem to have some problems I think. 
* SOCKET is defined as an unsigned int under Windows, you sometimes use them

   as signed int
* As I see in the actual docs of the Platform SDK, winsock1 is routed
through 
   ws2_32.dll anyway and it sounds like, winsock1 is almost "deprectated".
* The currentMilliseconds can be obtained without using ASM directly. 
* There is also an sleep counterpart in Windows called Sleep(millisec).

Create TestSuite and TestCases but be aware that you have to change to path
to 
include-path and the path to cppunit.a in the dialogs. Then you have to
manually 
add -lws2_32 in the cppunit-test specific makefiles to the CPPUNIT_LIBS.
Adjust your tests, run the tests. It should work.

Add the possibility to Managed Make Projects to add additional Makefile to
be included.
There seems to be no way to do unit tests with Managed Make Projects, or I
didn't see yet.

And there are hardcoded defaults in the Code. Why not use compiler paths or
such alike.

H. Riedel

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

Attachment: RemoteTestRunner.cpp
Description: Binary data


Back to the top