Where is CppUTest located?

2,364 views
Skip to first unread message

Russell Merrick

unread,
Jun 20, 2017, 1:49:41 PM6/20/17
to cpputest
I'm running Ubuntu just so that I can make things as easy as possible and I'm still running into problems.  I did the following:

apt-get install cpputest

The install seemed to be fine.  The next line of the manual says, "If you have a system installed version (e.g. via apt-get) then you probably don’t need to change the path. "

 It doens't look like this variable is getting set and I don't know where to point this variable.  Where does CPPUTEST live when doing apt-get?  Is there some diagram of the install directory and folders?

Thanks.

Hank Barta

unread,
Jun 23, 2017, 11:18:51 AM6/23/17
to cpputest
I had the package installed for a bit and was confused how to use it. I don't recall what the last problem was.

On Debian and related distros, you can see where the files will be installed by typing the command 'dpkg -L <packagename>' and in this case, 'dpkg -L cppunit'. 

HTH

Bas Vodde

unread,
Jul 2, 2017, 11:56:44 PM7/2/17
to cppu...@googlegroups.com

Hi,

Usually it is under /usr/local/include and /usr/local/lib.

Bas

--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Damien Urruty

unread,
Jul 17, 2017, 5:36:18 AM7/17/17
to cpputest
Hi,

I followed the same procedure (install with apt-get), but the CPPUTEST_HOME variable is not set automatically, and I don't know where to point from my Makefile.

I can't find cpputest in the 2 locations you mentionned above. After listing the contents of the package with dpkg, I can't find any include folder or the build/MakefileWorker.mk, which seems mandatory to execute the tests.

I am running Ubuntu 17.04, and the package being installed is the 3.8-5.

Am I doing something wrong ?

Hank Barta

unread,
Jul 18, 2017, 3:55:10 PM7/18/17
to cppu...@googlegroups.com
On Mon, Jul 17, 2017 at 4:36 AM, Damien Urruty <damien...@gmail.com> wrote:
Hi,

I followed the same procedure (install with apt-get), but the CPPUTEST_HOME variable is not set automatically, and I don't know where to point from my Makefile.

I can't find cpputest in the 2 locations you mentionned above. After listing the contents of the package with dpkg, I can't find any include folder or the build/MakefileWorker.mk, which seems mandatory to execute the tests.

I am running Ubuntu 17.04, and the package being installed is the 3.8-5.
-- 
You received this message because you are subscribed to a topic in the Google Groups "cpputest" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cpputest/0wL-PReKc0o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cpputest+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I've done a little bit of detective work on this and here is what I've found. I installed libcppunit-dev which puts headers under /usr/include/cppunit. That's not compatible with my Makefile. Nor are the include file names found in the package installed files.

1) From https://en.wikipedia.org/wiki/CppUnit  "The project has been forked several times.[4][5] The freedesktop.org version, maintained by Markus Mohrhard of the LibreOffice project (which uses CppUnit heavily), is actively maintained, and is used in Linux distributions such as DebianUbuntuGentoo and Arch.[6]" In other words, the package that is installed is most likely the Freedesktop fork. (I really wish they would have renamed it.)

2) From https://packages.debian.org/stretch/libcppunit-dev the home page for the package is listed as ww.freedesktop.org. (Seems to confirm #1 above.) I suspect that Ubuntu uses the same package as Debian.

I have worked with the package from Github (https://github.com/cpputest/cpputest) and it appears that header names and probably other things have been changed so what works with the Freedesktop fork will not work with the original (Github) project. I suspect that the instructions you are following are relevant to the original because it does use CPPUTEST_HOME. I think you either need to follow instructions for the Freedesktop fork or install (from Github) the original project.

If I'm mistaken on any of this, hopefully someone will chime in. I find the whole situation confusing and it led to a rocky start using CppUnit.

I don't even know if the topic for this group includes all CppUnit forks.

HTH,
hank

--
'03 BMW F650CS - hers
'98 Dakar K12RS - "BABY K" grew up.
'93 R100R w/ Velorex 700 (MBD starts...)
'95 Miata - "OUR LC"
polish visor: apply squashed bugs, rinse, repeat
Beautiful Sunny Winfield, Illinois

Bas Vodde

unread,
Jul 18, 2017, 8:57:18 PM7/18/17
to cppu...@googlegroups.com

Hi Hank,

CppUTest isn’t really a CppUnit fork :)

It is a continuation of the lighter version of CppUnit, written by the same original author.

Bas

You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.

Hank Barta

unread,
Jul 18, 2017, 9:51:18 PM7/18/17
to cppu...@googlegroups.com
On Tue, Jul 18, 2017 at 7:57 PM, Bas Vodde <ba...@odd-e.com> wrote:

Hi Hank,

CppUTest isn’t really a CppUnit fork :)


Thanks for pointing out my error. I guess that explains why they didn't look at all alike. ;)

My confusion an deeper than I had thought. <sigh>

Bas Vodde

unread,
Jul 19, 2017, 11:30:23 PM7/19/17
to cppu...@googlegroups.com

Hi Damien,

You do not need the build/MakefileWorker.mk though in order to use CppUTest.

Are you attempting to compile James’s examples, or why you are looking for that makefile?

Thanks,

Bas

James Grenning

unread,
Aug 9, 2017, 10:15:32 AM8/9/17
to cppu...@googlegroups.com

Hey Bas

This question "Where is CppUTest located?" is really relevant.

cpputest/examples use MakefileWorker.mk. The examples cannot be used with the apt-get/homebrew approach or the current instructions on cpputest.github.io (a.k.a cpputes.org)

Given that the cpputest.org suggests two ways to build

1) apt-get/home-brew
2) download, clone/unzip, configure...

cpputest/examples do not build with either!

I'd like to see an example of a makefile that works with 'apt-get install cpputest' that does not use MakefileWorker.mk

I'd also like to see the 'download, unzip, configure..." approach work with MakefileWorker.mk. It is broken and has been since the documentation tells people to configure and make from the cpputest_build subdirectory.

Can we change the post-git-clone instructions from:

$ cd cpputest_build
$ autoreconf .. -i
$ ../configure
$ make

to:

$ cd full_path_to/cpputest
$ autoreconf . -i
$ ./configure
$ make tdd

If you do that, cpputest/example works as is (an apt-get version is still needed) and all my book code examples keep working.

The only problem I know for building in cpputest/ is that some users have several builds. It seems to me that cpputest/cpputest_build is only really helpful for multiple builds. (Does that directory solve some other problem?)

What I used to do was run a script after make tdd to add symlinks so that MakefileWorker.mk has what it needs.

cd cpputest/cpputest_build/clang
ln -s $../../include include
ln -s $../../build build

or

cd cpputest/cpputest_build/gcc
ln -s $../../include include
ln -s $../../build build

Then someone can export CPPUTEST_HOME= full_path_to/cpputest_build/gcc and MakefileWorks.mk stuff still works.

Regarding and example without MakefileWorker.mk, I'd love to see your recommend way of using apt-get install cpputest

thanks, James

Bas Vodde

unread,
Aug 11, 2017, 10:58:36 PM8/11/17
to cppu...@googlegroups.com

Hi James,

Uhm, interesting.

You are right. One of the problems is that the automake scripts do not actually install the Makefile.mk script.

So, in order to get it to work (speculating now), we’ll need to do the following:

* install the MakefileWorker.mk in the automake scripts directory
* include that, probably using pkg-config
* change MakefileWorker.mk so that it wouldn’t assume all CppUTest files are in one directory.

For Ubuntu/Mac, you can find where CppuTest is installed via:

Install directory:

[basvodde@Bass-MacBook-Pro cpputest]$ pkg-config --variable=prefix cpputest
/usr/local

Include files:

[basvodde@Bass-MacBook-Pro cpputest]$ pkg-config --cflags  cpputest
-I/usr/local/include

Library:

[basvodde@Bass-MacBook-Pro cpputest]$ pkg-config --libs  cpputest
-L/usr/local/lib -lstdc++ -lCppUTest -lCppUTestExt

There is no scriptsdir set yet.

I don’t think (or don’t know!) that installing a package can set an environment variable as that will depend on the login config files.

Right now, I’m not able to make these changes, especially as there have been a lot of PRs still waiting for my actions (sorry community!)

Bas

John Whitmore

unread,
Nov 6, 2017, 9:50:45 AM11/6/17
to cpputest
Can I ask has there been any progress on this issue? I got the book "Test-Driven development for Embedded C" and was starting to work through the examples but the install of cpputest is a bit important. I'm running on Ubuntu so the install instructions are to install from the package manager as it's the easiest method but that simply does not work.

I guess I'll try and install if from source and see if that makes any diffence

Koertis

unread,
Nov 7, 2017, 1:14:38 PM11/7/17
to cpputest
Hi! I try the same as you John to get started in CppUtesting on Ubuntu. Did you get any further?

James W Grenning

unread,
Nov 7, 2017, 2:52:57 PM11/7/17
to cpputest

Hi John

I have the book code on GitHub now and it has its instructions. To deal with compiler evolution, my instructions have you building cpputest and the book code in a Docker container.

https://github.com/jwgrenning/tddec-code

I think having CppUTest and you test code in Docker is the way to go for a controlled test environment.

This is brand new so if you discover and things that could improve it, please let me know.

HTH, James

John Whitmore

unread,
Nov 8, 2017, 5:53:17 PM11/8/17
to cppu...@googlegroups.com
Thanks  a million for the comments and thanks for the github link didn't realise that was there. I'm was hoping to go back to the start of the book again and try again today but time has slipped by and It's going to have to wait till later in the week.

I have to say that it's going to take some convincing but I would love if this worked out. I use Test-Driven in other fields, Web Apps, but embedded, not sure about it. I'll get back to it, possibly at the weekend and try and sort out using the github repo.

To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "cpputest" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cpputest/0wL-PReKc0o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cpputest+unsubscribe@googlegroups.com.

James W Grenning

unread,
Nov 8, 2017, 6:02:21 PM11/8/17
to cppu...@googlegroups.com

You are welcome. I just created the Docker instructions.

TDD for embedded... not impossible and well worth it :-)

It's all just code.

Reply all
Reply to author
Forward
0 new messages