Back to the main page

All-Paths test generation for C programs with aliases

Description of the program:

This program is a toy implementation of the Nikolai Kosmatov's late-aliases algorithm for generation of all-paths tests for C programs with internal aliases. A complete test generation tool called PathCrawler was developed at CEA LIST. It generates test cases for all feasible paths of the given program in a depth-first search.

This toy implementation requires that the program under test be first translated into intermediate format (IF) manually, like it is done in the examples. The main object of this study being C-like programs with aliases, it focuses on aliases and treats only the most basic data types and operations: integers, arrays, conditionals and loops. It uses symbolic execution to obtain executed path. The addition is supported, other arithmetic operations may be added in a similar way. Function calls are not supported and may be added (in PathCrawler, they are easily modeled using assignments of arguments and return value).

To run the program on one of the given examples (say, max3.pl), copy the example file to input.pl and run the generation. On Linux you may type the following command:
cp max8.pl input.pl; eclipse -e "[toypcr],toypcr:strTest."

To redirect the output into the file output.txt, you may type:
cp max8.pl input.pl; eclipse -e "[toypcr],toypcr:strTest." > output.txt

To increase the print depth for long lists and to see the statistics, you may type:
cp max8.pl input.pl; eclipse -e "[toypcr],set_flag(print_depth,1000),toypcr:strTest,statistics."

If the path to the ECLiPSe executable eclipse is not added to the PATH environment variable, or another program called eclipse is installed, you may need to provide the path explicitly, e.g.
cp max8.pl input.pl; ~/ECLiPSe/bin/i386_linux/eclipse -e "[toypcr],set_flag(print_depth,1000),toypcr:strTest,statistics."

Downloads: Toy implementation of the late-aliases algorithm (for ECLiPSe Prolog) and some examples.

Installation of the program:

This program is written in Prolog language for ECLiPSe Prolog, but can be adapted for any other version of Prolog language containing an FD constraint solver. To install the program, just download the main file (toypcr.pl) and example files to the same directory.

To install the ECLiPSe Constraint Programming System, visit the ECLiPSe homepage. We will describe in more detail the installation of ECLiPSe for Ubuntu linux. (Superuser's password or rights may be necessary.)

To install ECLiPSe for Ubuntu linux, you will need to visit the ECLiPSe Distribution website and to download a recent distribution (choose the subdirectory of the recent version, then the subdirectory corresponding to your system platform, e.g. 5.10_118/i386_linux/). The fastest way is to install ECLiPSe from a binary package. An installation from source code may be necessary if the binary one does not work. We describe a binary installation on a i386_linux platform (for a different platform or a source code installation see the readme file):

Examples:

For each example, we also give the number of test cases and execution time of complete all-paths test generation by our toy implementation on a laptop Intel Core 2 Duo with 1Gb RAM.

Some Links:

The ECLiPSe homepage

PathCrawler

CEA LIST

Back to the main page