dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testcase


From: Jacob Bachmeyer
Subject: Re: Testcase
Date: Thu, 10 Jan 2019 19:12:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0

shruthi k wrote:
I'm trying to add a test case to an existing testsuite.

This is somewhat covered in section 5.6 "Writing a test case" in the manual. This can also be dependent on the testsuite itself: some testsuites search for certain input files and automatically run all files matching some criteria through a test while others require all tests be explicitly listed in Tcl code.

Off-list and in the wrong thread, you mentioned adding a "single test script", so I will assume that you already know that you will need to write some Expect code. First, choose a tool-and-test-group directory. Using current Git DejaGnu as an example (<URL:http://git.savannah.gnu.org/cgit/dejagnu.git/tree/testsuite?id=e70fd889a7ae2ae3689c3cd84136dd2ddbd25cc9> used in this writing), there are, within the testsuite directory, directories for four tools: launcher, libdejagnu, report-card, and runtest. The libdejagnu directory is ancient and is simply the name of its tool, but DejaGnu searches for any directories beginning with the tool name, and a null suffix is still accepted for backwards compatibility. Modern practice is to separate the tool name from a test group name with a single dot, as seen in the launcher.all, report-card.all, and runtest.* directories. The runtest tests are the most complex and are divided into two groups: main and libs, respectively found in the runtest.main and runtest.libs directories.

Your testsuite should have a similar layout, with directories inside "testsuite". Choose one of those that begins with an appropriate prefix (the name of the tool your test tests) and create an *.exp file for your test script, like "example.exp", but obviously change "example" to something meaningful for your test script. The test script itself should somehow automate running the tool and verifying a result, eventually calling "pass", "fail", or "unresolved" procedures to report a result. (see section 1.4 "A POSIX compliant test framework" in the manual for more information)

Also,could you please send links/info on how to run an individual test.

This is covered (briefly) near the end of the "Invoking runtest" section of the manual. In short, you can cause DejaGnu to run only tests from one or more specific scripts by simply naming them on the command line. There is also an option to pass arguments to a test script run in this way, but what exactly DejaGnu *does* with that argument and how it is passed in to the test script is not yet documented. (>-<) (added to local TODO list)


-- Jacob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]