DejaGnu
Encyclopedia
DejaGnu is a framework for testing other programs. It has a main script called runtest that goes through a directory looking at configuration files and then runs some tests with given criteria. The purpose of the DejaGnu package is to provide a single front end for all tests. It is a part of the GNU Project
and is licensed under the GPL
. It is based on Expect
, which is in turn based on Tcl
. The current maintainers are Rob Savoye
and Ben Elliston.
and Sybase
to test their products. DejaGnu allows this work to be much more structured.
The tests can be grouped according to the tool they are testing. The test is run by merely calling runtest in the root project directory.
runtest --tool program_to_test
This will look in the testsuite directory for any folders starting with program_to_test and will run all .exp files in that folder.
. It allows for testing to be done remotely on development boards; separate initialization files can be created for each operating system
and board. This mainly focuses on embedded targets and remote hosts. DejaGnu is thus popular with many GNU projects, at universities, and for private companies.
Other Files
set tool Apache #run tests on Apache
set srcdir ./testsuite #look here for test files
set outdir ./logs #save the logs in a separate directory
set all 1 #show results from all tests (rather than just ones with errors)
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27, 1983, by Richard Stallman at MIT. It initiated GNU operating system development in January, 1984...
and is licensed under the GPL
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
. It is based on Expect
Expect
Expect is a Unix automation and testing tool, written by Don Libes as an extension to the Tcl scripting language, for interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, ssh, and others. It uses Unix pseudo terminals to wrap up subprocesses transparently, allowing the...
, which is in turn based on Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...
. The current maintainers are Rob Savoye
Rob Savoye
Rob Savoye is the primary developer of Gnash. He is a developer for the GNU Project, having worked on Debian, Red Hat and dozens of other free/open source software projects. He was among the first employees of Cygnus Support, which was sold to Red Hat in 2001....
and Ben Elliston.
Testing
DejaGnu has a very strong history in testing due to its Tcl base. Tcl is used extensively by companies such as OracleOracle Corporation
Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...
and Sybase
Sybase
Sybase, an SAP company, is an enterprise software and services company offering software to manage, analyze, and mobilize information, using relational databases, analytics and data warehousing solutions and mobile applications development platforms....
to test their products. DejaGnu allows this work to be much more structured.
The tests can be grouped according to the tool they are testing. The test is run by merely calling runtest in the root project directory.
runtest --tool program_to_test
This will look in the testsuite directory for any folders starting with program_to_test and will run all .exp files in that folder.
Embedded design
One field for which DejaGnu is particularly well suited is that of embedded system designEmbedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...
. It allows for testing to be done remotely on development boards; separate initialization files can be created for each operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
and board. This mainly focuses on embedded targets and remote hosts. DejaGnu is thus popular with many GNU projects, at universities, and for private companies.
Files
Essential Files- testsuite
- Apache Each directory in testsuite should contain tests for a specific tool. In this example, the tool being tested is the Apache webserver.
- Apache.test1.exp This will be the file containing tests, which in this fictional case might change configuration options, and then connect to the network and check to make sure the changes have taken effect.
- config
- unix.exp
- lib
- whois.exp This file will be run as a tool init file.
- Apache Each directory in testsuite should contain tests for a specific tool. In this example, the tool being tested is the Apache webserver.
Other Files
- site.exp This file is a directory specific configuration file for runtest. Options can be placed in this file rather than retyped on each invocation; these options can include any variable passed as a command line argument.
set tool Apache #run tests on Apache
set srcdir ./testsuite #look here for test files
set outdir ./logs #save the logs in a separate directory
set all 1 #show results from all tests (rather than just ones with errors)
- .dejagnurc This is a personal configuration file, which should be located in the user's home directoryHome directoryA Home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory is defined by the operating system involved; for example, Windows systems between 2000 and 2003 keep home directories in a folder...
(~/.dejagnurc) - global_config.exp This is the first configuration file loaded. It can be named anything but must be pointed to by the $DEJAGNU environment variableEnvironment variableEnvironment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...
(set when your terminal loads).