DejaGnu: The GNU Testing Framework | ||
---|---|---|
<<< Previous | Next >>> |
This chapter was originally written by Niklaus Giger (ngiger@mus.ch) because he lost a week to figure out how DejaGnu works and how to write a first test.
Follow these instructions as closely a possible in order get a good insight into how DejaGnu works, else you might run into a lot of subtle problems. You have been warned.
It should be no big problems installing DejaGnu using your package manager or from the source code. Under a Debian/GNU/Linux systems just type (as root)
apt-get dejagnu |
The tests for Windows were run under Windows NT using the actual cygwin version (1.3.x as of October 2001). It's target system was a PPC embedded system running vxWorks.
Create a new user called "dgt" (DejaGnuTest), which uses bash as it login shell. PS1 must be set to '\u:\w\$ ' in its ~/.bashrc. Login as this user, create an empty directory and change the working directory to it. e.g
dgt:~$ mkdir ~/dejagnu.test dgt:~$ cd ~/dejagnu.test |
Now you are ready to test DejaGnu's main program called ruuntest. The expecteted output is shown
Example 1. Runtest output in a empty directory
dgt:~/dejagnu.test$ runtest WARNING: Couldn't find the global config file. WARNING: No tool specified Test Run By dgt on Sun Nov 25 17:07:03 2001 Native configuration is i586-pc-linux-gnu === tests === Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. ERROR: Couldn't find tool config file for unix. === Summary === |
We will show you later how to get rid of all the WARNING- and ERROR-messages. The files testrun.sum and testrun.log have been created, which do not interest us at this point. Let's remove them.
:~/dejagnu.test$ rm testrun.sum testrun.log |
On Windows systems DejaGnu is part of a port of a lot of Unix tools to the Windows OS, called cygwin. Cygwin may be downloaded and installed from a mirror of http://sources.redhat.com/cygwin/. All examples were also run on Windows NT. If nothing is said, you can assume that you should get the same output as on a Unix system.
You will need a telnet daemon if you want to use a WindowsNT box as a remote target. There seems to be a freeware telnet daemon at http://www.fictional.net/.
If you are running a Debian distribution you can find the examples under /usr/share/doc/dejagnu/examples. These examples seem to be missing in RedHat's RPM. In this case download the sources of DejaGnu and adjust the pathes to the DejaGnu examples accordingly.
<<< Previous | Home | Next >>> |
A POSIX conforming test framework | Create a minimal project, e.g. calc |