The CGAL test suite is a way to test the compilation and execution of CGAL programs automatically (i.e., without user interaction) on a number of different platforms. Developers should, of course, thoroughly test their code on their own development platform(s) before submitting it. The test suite serves as a way to test on additional platforms not available to the developer.
The test suite helps the developer(s) of a package to
That does not mean that the test suite is a platform for initial testing of code. New code should be tested on different platforms by the developer before submission.
It is strongly recommended for a test suite of a package to
The tool gcov can be used together with the GNU C++ compiler to test
for code coverage in your programs and may be helpful when you create your
CGAL test suite programs. You can find a complete guide to this tool
in the GNU on-line documentation at
http://gcc.gnu.org/onlinedocs/gcc-2.95.2/gcc_6.html.
If you want to use the code coverage tool gcov, you have to compile
your programs with the options -fprofile-arcs and
-ftest-coverage.
Here is a simple example:
#include<iostream>
using namespace std;
void fu(int val)
{
int w,v=0;
if (val==0) {
cout << "val == 0!\n";
for(w=0;w<100;w++) v=v+w;
}
else {
cout << "val != 0!\n";
for(w=0;w<10;w++) v=v+w;
}
cout << "v:" << v << "\n";
}
int main()
{
fu(0);
return 0;
}
First you have to compile the example program test.C with the special
options. Then you have to execute it, and, after this, gcov can be
used.
g++ -fprofile-arcs -ftest-coverage -o test test.C test gcov test.Cgcov will create a file test.C.gcov containing output from gcov:
#include<iostream>
using namespace std;
void fu(int val)
1 {
1 int w,v=0;
1 if (val==0) {
1 cout << "val == 0!\n";
1 for(w=0;w<100;w++) v=v+w;
}
###### else {
###### cout << "val != 0!\n";
###### for(w=0;w<10;w++) v=v+w;
}
1 cout << "v:" << v << "\n";
}
int main()
1 {
1 fu(0);
1 return 0;
}
The lines that were not executed will be marked with ######,
so you will see what should be added in the (CGAL) test suite programs.
The test suite is located in the directory test of the internal releases of CGAL. This directory is not part of external releases. The directory test contains:
The test suite will attempt to compile all the programs in the subdirectories of test and to run all except the demo programs (which usually require user interaction) by using the cgal_test scripts (Sections 4.1 and 5.5) and will save the results in files in the package subdirectories (Section 17.6). Even if a program fails to compile or run, the test suite will continue.
Input to programs in the test suite can be supplied in three different ways:
./program < program.cin
However, if a test program program.C absolutely requires command-line parameters, you should do the following. Use create_cgal_test to create the script cgal_test. This file contains an entry of the form
compile_and_run program
Just put the command-line
parameters for program at the end of this line:
compile_and_run program arg1 arg2 ..
The test suite will then execute the program using the command
./program <arg1> <arg2> ...
The test suite is run using the run_testsuite script that is distributed with every internal release in the test directory. There are several ways you can customize this script to meet you needs:
After this, the programs from the test suite will be run using the LD_LIBRARY_PATH that was specified in step 1.
run_testsuite <include makefile>
for every platform that you wish to test. Just substitute for
<include makefile> the appropriate include makefiles that
were generated during installation. (Don't forgot to use the
full path name for the makefile!) By default, the last line in the
file is
run_testsuite $CGAL_MAKEFILE
so you need not make any changes if you run the testsuite on only one
platform and have set the CGAL_MAKEFILE environment variable
properly.
After these steps you are ready to run the test suite. It can be run in two different ways:
./run_testsuite
The test suite will run the tests from all test directories. This may take a considerable amount of time.
./run_testsuite <dir1> <dir2> ...
The test suite will run only the test programs in the test directories
<dir1> <dir2> ...
To run an entire CGAL test suite automatically, including downloading of an internal release, configuration, and installation of the library, you can use the autotest_cgal script described in Section 5.6.
The testsuite will generate the following output files:
This file contains two lines for every program that was tested on platform <platform> in the test directory <testdir>. The first line tells if the compilation was successful and the second line tells if the execution was successful (i.e., the program returned the value 0). (See Section 4.1 for more details.)
This file contains the console output from the test program <program.C> run on platform <platform>.
This file contains the compiler output from platform <platform> for all programs.
This is just a concatenation of all the ErrorOutput files that were generated during the last run of the test suite.
Requirements:
Recommendations: