Skip to content

Commit 965b4db

Browse files
committed
Added build instructions for those wanting MakefileWorker.
Including links TDD-EC Book, cpputest-starter-project, legacy recipe and install using git add submodule. Fixed bug: Embedded link to cpputest-2.7dev
1 parent 48018c1 commit 965b4db

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

index.markdown

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ CppUTest's core design principles are:
1111

1212
* Simple in design and simple in use.
1313
* Portable to old and new platforms.
14-
* Build with Test-driven Development in mind
14+
* Build with Test-driven Development for Test-driven Developers.
1515

16-
## Where to get CppUTest
16+
## Setting up CppUTest
1717

18-
### James Grenning's cpputest-starter-project
18+
There are several ways to setup CppUTest. One is to install via package management and the other is from source. The big difference is that from source you can use `MakefileWorker.mk`. MakefileWorker is not supported pre-packaged. MakefileWorker does not require you to know a lot about `make` and makefiles to get started.
1919

20-
An easy way to get started adding tests to your code is by using James' [cpputest-starter-project](https://github.com/jwgrenning/cpputest-starter-project). You'll find CppUTest installation instructions along with your first test case, and some other example code. DO NOT INSTALL CppUTest using the "Pre-packaged" options described here. The starter kit uses `MakefileWorker.mk` (not supported pre-packeged) helping you get started without having to first learn `make`.
20+
An easy way to get your first test case running is to use James Grenning's [cpputest-starter-project](https://github.com/jwgrenning/cpputest-starter-project). James is the author of [Test-Driven Development for Embedded C](https://wingman-sw.com/tddec). You'll find instructions, your first test case, and some other example code. James' training resources use MakefileWorker, so you need to install from source.
2121

22-
James' example is set up to have you put CppUTest into your own git repo (as a submodule) so in the years to come, you can recreate your exact unit test environment.
22+
Adding tests to untested C and C++ can be a big challenge. You might find [Get your Legacy C into a Test Harness](https://wingman-sw.com/articles/tdd-legacy-c) a useful recipe and resource. The page includes links to numerous articles of real legacy C challenges.
2323

24-
Adding tests to untested C and C++ can be a big challenge. You might find [TDD HOW-TO: Get your Legacy C into a Test Harness](https://wingman-sw.com/articles/tdd-legacy-c) a useful recipe and resource. The page includes links to numerous articles of real legacy C challenges.
25-
26-
### Pre-packaged
24+
### Pre-packaged install
2725

2826
*Linux*
2927

@@ -41,11 +39,11 @@ For Mac, a Homebrew package is available too. You can install via:
4139
$ brew install cpputest
4240
{% endhighlight %}
4341

44-
### From source
42+
### From source install
4543

4644
You can download the latest 'automatically released' version:
4745

48-
* [Latest version passing the build](https://github.com/cpputest/cpputest.github.io/blob/master/releases/cpputest-3.7dev.tar.gz?raw=true)
46+
* [Latest version passing the build](https://github.com/cpputest/cpputest.github.io/blob/master/releases/cpputest-3.8dev.tar.gz?raw=true)
4947
This version is automatically packages after a build has passed.
5048

5149
Alternatively, you can clone the github repository, read-only:
@@ -60,7 +58,13 @@ Or clone it via ssh (which requires a github account)
6058
$ git clone git@github.com:cpputest/cpputest.git
6159
{% endhighlight %}
6260

63-
After you have cloned CppUTest, you can build it with your favorite build tool (CMake or autoconf).
61+
CppUTest can also be added to your git repor as a git submodule
62+
63+
{% highlight bash %}
64+
$ git submodule add https://github.com/cpputest/cpputest.git
65+
{% endhighlight %}
66+
67+
Now that you have CppUTest sources, you can build it with your favorite build tool (CMake or autoconf).
6468

6569
Building with autoconf requires you to (this requires you to have installed GNU autotools, apt-get/brew install automake autoconf libtool):
6670

@@ -71,6 +75,24 @@ $ ../configure
7175
$ make
7276
{% endhighlight %}
7377

78+
**NOTE**: Building from `cpputest_build` means you will not be able to use `MakefileWorker.mk`. To use MakefileWorker you need to build from the cpputest home directory.
79+
80+
### Using CppUTest with `MakefileWorker.mk` and gcc
81+
82+
If you want to use CppUTest's `MakefileWorker.mk`, you cannot currently get CppUTest using the "Pre-packaged" options described above. Instead you can get CppUTest from source using the options already described.
83+
84+
Change to the top level directory of CppUTest (the directory containing `include/` and `src/` among other files)
85+
86+
{% highlight bash %}
87+
$ cd cpputest \
88+
$ autoreconf . -i
89+
$ ./configure
90+
$ make tdd
91+
$ export CPPUTEST_HOME=$(pwd).
92+
{% endhighlight %}
93+
94+
You will want to add `export CPPUTEST_HOME=<path>` somewhere like `.bashrc` or in your build script as a relative path.
95+
7496
## How to create a coverage report
7597

7698
You can use autoconf to create a coverage report for CppUTests own tests. If you have lcov installed, a browsable html report will be generated as well. After the steps outlined in the previous paragraph, do the following:

0 commit comments

Comments
 (0)