Next: qac
Up: TUTTI Reference
Previous: The TUTTI test framework
  Contents
  Index
Subsections
In this tutorial we will test a small library that is used to maintain
addresses of a PDA. The source code of the tutorial is stored in a tar ball
and can be unpacked as follows:
$ mkdir tutorial
$ gzip -dc /usr/local/tutti/etc/tutorial.tgz | tar xvf -
A test driver which calls the functions of this library has already been
developed. This is the file test_address.c.
By invoking ``make'' we can build the test application and run it:
$ make
$ ./test_address
After execution, we see that the program issues some addresses to the screen.
First we analyse the code with
QAC:
$ make clean
$ make CC=qac_compiler
$ qac_scan
address.c,85:++ WARNING ++: <=8=(0179) Argument type does not match conversion specifier number TEXT
address.c,170:++ WARNING ++: <=8=(0748) [U] 'TEXT()' has a result type of 'int' but no 'return' statement specifies an expression - the returned value is undefined.
address.c,195:++ WARNING ++: <=3=(3321) The variable 'TEXT' may be unset at this point.
address.c,203:++ WARNING ++: <=3=(3321) The variable 'TEXT' may be unset at this point.
address.c,219:++ WARNING ++: <=8=(0179) Argument type does not match conversion specifier number TEXT
Verdict : fail
From the output we conclude that the code has some serious problems (although
the code seems to behave correct!). In a `real-life'' software project it would be recommended to first solve these problems before continuing.
We can analyse the dynamic behavior using insure as
follows:
$ make clean
$ make CC=insure_compiler
$ ./test_address
$ insure_scan
address.c:28: LEAK_ASSIGN
address.c:195: COPY_WILD
address.c:195: READ_UNINIT_MEM(copy)
address.c:12: LEAK_FREE
VERDICT: Fail
The results indicate a few errors.
With gcov we analyse the quality of the test design based upon code coverage:
$ make clean
$ make CC=gcov_compiler
$ ./test_address
$ gcov_scan
In file : address.c
63% (statement) coverage
Verdict : fail
It can be conluded that only 63% statement coverage is achived by the current
test.
Try to improve the test design by investigation the coverage results (recorded
in address.c.gcov) and by modifying the file test_address.c. The steps are
outlined by figure 6.3 at page
.
Hereafter, check the dynamic behavior of the code using insure . The aim of
this excersise is to obtain an effective test. It is not necessary to solve
all defect you might encounter. Only solve a defect when it is a blocking error.
Next: qac
Up: TUTTI Reference
Previous: The TUTTI test framework
  Contents
  Index
2004-05-28