1

I've taken over a programming project from another programmer. This project uses a lot of unit tests to verify the code which I intend to continue using. I have no prior experience with unit testing (apart from some theoretical knowledge) so he wrote a very small guide for how to get it working before he left the company. That guide looks like this.

  1. Install cygwin with support for gcc/g++
  2. Download CppUTest
  3. Compile CppUTest in cygwin

I think I've completed the two first steps, but I have no idea how to compile CppUTest in cygwin (I 've never used cygwin before). I tried some quick googling on the Title of this question but I couldn't find something useful.

Jesper Evertsson
  • 613
  • 9
  • 28

2 Answers2

2

I made a mini guide for internal use at my company, have been working fine for us so far. It goes something like this:

Install cygwin, default and development packages.

Download and extract Cpputest to c:\cpputest-x.x

Configure and install cpputest: Start cygwin and input the following shell commands

cd c:\cpputest-x.x
./configure
make
make check

Install helper scripts (optional step)

cd scripts
./InstallScripts.sh

Add CPPUTEST_HOME as an environment variable: in c:\cygwin64\home\your_user_name.bash_profile add

< export CPPUTEST_HOME=/cygdrive/c/cpputest-x.x >

You should now be good to go. If not, write to the CppUTest google group, theres always friendly people willing to help.

aunsbjerg
  • 21
  • 3
1

You can use either CMake or autoconf.

CMake

Open a cygwin terminal and:

cd cpputest_build
cmake ..
make

(Or use the CMake GUI)

Btw. you can enable CppuTest C++11 by using this call: cmake -DC++11=ON ... Cmake will print this line then:

Using C++11 library:                ON

autoconf

With a cygwin terminal:

cd cpputest_build
autoreconf .. -i
../configure
make
ollo
  • 24,797
  • 14
  • 106
  • 155
  • Ok, I did it the CMake way. A lot of text were printed out in the terminal so I'm pretty sure it worked. The next problem is running the actuall tests. In the instructions the other programmer left it says "Go to C:/.../../../cpputests (the folder which has his tests) in the terminal and then write "make". When I do this I get an error "Makefile44: /build/MakefileWorker.mk: No such file or directory". The compiled files and the existing unit tests are currently in differant directiories so I guess this is the problem. But I'm not sure how the folder structure is supposed to look. – Jesper Evertsson Feb 27 '15 at 07:14
  • Do you have to build the complete project before? Eg. run `make` within the project's root. Can you also check your makefile for the exact error? It's possible the cpputest binaries and headers are not found (under windows it may help to add cpputest binaries path to `PATH`). – ollo Feb 27 '15 at 13:11
  • I don't know if I have ti build teh complete project. That's pretty much the entire problem, I have no clue what to do to make it work. I'm not at work anymore so I can't check the exact error until monday – Jesper Evertsson Feb 27 '15 at 19:06
  • Ok, if you are back there, can you check how your project (application eg.) is build usually? It's often the case you build the project (maybe running `make` in it's root dir, building and running test (like `make test` within the test dir). Or building the the test (you'll get some kind of test application) and running those. – ollo Mar 01 '15 at 14:21
  • Hi, sorry for not responding. We managed to get it to work by using a mirror of the old programmers computer and then copying the directories for cygwin and CppUTest. Anyway, thanks for your effort to help – Jesper Evertsson Mar 03 '15 at 08:33