25 |
going on with the runtest script. Fortunately tcl is a pretty simply |
going on with the runtest script. Fortunately tcl is a pretty simply |
26 |
language and a quick scan of Ousterhout's text on tcl has been more than |
language and a quick scan of Ousterhout's text on tcl has been more than |
27 |
sufficient for me to conduct these experiments. Again, this document |
sufficient for me to conduct these experiments. Again, this document |
28 |
only records my observations. |
only records my observations. |
29 |
|
|
30 |
SECOND: I am not interested in or concerned with testing |
SECOND: I am not interested in or concerned with testing |
31 |
cross-compilation systems or anything exotic like remote execution. I |
cross-compilation systems or anything exotic like remote execution. I |
36 |
various tcl/expect files and procedures are executed. |
various tcl/expect files and procedures are executed. |
37 |
|
|
38 |
THIRD: There are really two parts to my studies, specifically: (i) the |
THIRD: There are really two parts to my studies, specifically: (i) the |
39 |
study of runtest, and (ii) the use of the auto- tools to realize a |
study of runtest, and (ii) the use of the auto- tools to realize a |
40 |
"make check" target that will invoke the runtest script for you. As a |
"make check" target that will invoke the runtest script for you. As a |
41 |
result, this document is organized into three parts: |
result, this document is organized into three parts: |
42 |
|
|
45 |
Part III: Running the example |
Part III: Running the example |
46 |
|
|
47 |
For small projects, you may not be interested in the autoconf/automake |
For small projects, you may not be interested in the autoconf/automake |
48 |
tools and can safely skip Part II of this document. |
tools and can safely skip Part II of this document. |
49 |
|
|
50 |
FOURTH: This example is setup only for recording the files and |
FOURTH: This example is setup only for recording the files and |
51 |
procedures that runtest uses. Technically it will compile a simple c++ |
procedures that runtest uses. Technically it will compile a simple c++ |
85 |
the testsuite subdirectory of this example: |
the testsuite subdirectory of this example: |
86 |
|
|
87 |
peabody>ls -R testsuite/helloworld.test* |
peabody>ls -R testsuite/helloworld.test* |
88 |
~/test/dejagnu/helloDemo |
~/test/dejagnu/helloDemo |
89 |
testsuite/helloworld.test1: |
testsuite/helloworld.test1: |
90 |
total 8 |
total 8 |
91 |
4 helloworld.test1-1/ 4 test1.exp |
4 helloworld.test1-1/ 4 test1.exp |
92 |
|
|
93 |
testsuite/helloworld.test1/helloworld.test1-1: |
testsuite/helloworld.test1/helloworld.test1-1: |
94 |
total 4 |
total 4 |
95 |
4 test1-1.exp |
4 test1-1.exp |
96 |
|
|
97 |
testsuite/helloworld.test2: |
testsuite/helloworld.test2: |
98 |
total 8 |
total 8 |
99 |
4 test2.exp 4 test3.exp |
4 test2.exp 4 test3.exp |
100 |
|
|
101 |
testsuite/helloworld.test3: |
testsuite/helloworld.test3: |
102 |
total 12 |
total 12 |
103 |
4 config/ 4 lib/ 4 non_compliant_dir_name/ |
4 config/ 4 lib/ 4 non_compliant_dir_name/ |
104 |
|
|
105 |
testsuite/helloworld.test3/config: |
testsuite/helloworld.test3/config: |
106 |
total 4 |
total 4 |
107 |
4 config.exp |
4 config.exp |
108 |
|
|
109 |
testsuite/helloworld.test3/lib: |
testsuite/helloworld.test3/lib: |
110 |
total 4 |
total 4 |
111 |
4 lib.exp |
4 lib.exp |
112 |
|
|
113 |
testsuite/helloworld.test3/non_compliant_dir_name: |
testsuite/helloworld.test3/non_compliant_dir_name: |
114 |
total 4 |
total 4 |
115 |
4 non_compliant.exp |
4 non_compliant.exp |
173 |
this file will be automagically created for you). Technically this |
this file will be automagically created for you). Technically this |
174 |
file is organized into two parts, one that is set when the .configure |
file is organized into two parts, one that is set when the .configure |
175 |
script is executed; the second part can be edited and changed by the |
script is executed; the second part can be edited and changed by the |
176 |
user. |
user. |
177 |
3. It will try to load the file ./lib/TOOL.exp (this is probably a good |
3. It will try to load the file ./lib/TOOL.exp (this is probably a good |
178 |
place to locate definitions for the TOOL_init/TOOL_exit/TOOL_version |
place to locate definitions for the TOOL_init/TOOL_exit/TOOL_version |
179 |
procedures. |
procedures. |
180 |
4. It will try to load some configuration files. Specifically |
4. It will try to load some configuration files. Specifically |
181 |
4a. It will try to load a base-config.exp file. On my system it |
4a. It will try to load a base-config.exp file. On my system it |
182 |
searches, in order, the following subdirectories: |
searches, in order, the following subdirectories: |
234 |
|
|
235 |
3a. Look into srcdir (where the runtest command was issued) for |
3a. Look into srcdir (where the runtest command was issued) for |
236 |
lib/tool.exp; I guess the principle concept is to put tool specific |
lib/tool.exp; I guess the principle concept is to put tool specific |
237 |
and platform independent expect scripts here. |
and platform independent expect scripts here. |
238 |
|
|
239 |
3b. Next look for for platform scripts in --srcdir/config (on my linux |
3b. Next look for for platform scripts in --srcdir/config (on my linux |
240 |
system it looks for one of unix.exp, gnu.exp, and default.exp (in |
system it looks for one of unix.exp, gnu.exp, and default.exp (in |
247 |
4. Executing expect scripts. |
4. Executing expect scripts. |
248 |
|
|
249 |
4a. If an expect script is named on the command line it (and only it) is |
4a. If an expect script is named on the command line it (and only it) is |
250 |
run. otherwise.... |
run. otherwise.... |
251 |
|
|
252 |
4b. runtest looks in the testsuite directory and does a glob on |
4b. runtest looks in the testsuite directory and does a glob on |
253 |
TOOL.*/*.exp (ok, it's a recursive glob TOOL.*/.../*.exp) and |
TOOL.*/*.exp (ok, it's a recursive glob TOOL.*/.../*.exp) and |
263 |
particular, on my machine, the search path is: |
particular, on my machine, the search path is: |
264 |
|
|
265 |
5a. the dejagnu install directory (/usr/share/dejagnu) and its |
5a. the dejagnu install directory (/usr/share/dejagnu) and its |
266 |
accompanying library directory (/usr/share/dejagnu/lib) |
accompanying library directory (/usr/share/dejagnu/lib) |
267 |
5b. in a dejagnu/lib directory one above the current directory (where |
5b. in a dejagnu/lib directory one above the current directory (where |
268 |
runtest was run). that is in ../dejagnu/lib |
runtest was run). that is in ../dejagnu/lib |
269 |
5c. in the --srcdir lib |
5c. in the --srcdir lib |
275 |
investigate this. |
investigate this. |
276 |
|
|
277 |
7. COOL: I can name an expect script in the --ignore command line option |
7. COOL: I can name an expect script in the --ignore command line option |
278 |
to prune it from the set of scripts that are executed. |
to prune it from the set of scripts that are executed. |
279 |
|
|
280 |
|
|
281 |
I.4 Some gotchas |
I.4 Some gotchas |
282 |
---------------- |
---------------- |
283 |
|
|
284 |
1. As far as I can tell the "testsuite" name is completely artificial |
1. As far as I can tell the "testsuite" name is completely artificial |
285 |
and you can store your tests in whatever subdirectory name you like. |
and you can store your tests in whatever subdirectory name you like. |
286 |
|
|
287 |
2. Don't try to issue the runtest command from outside the testsuite |
2. Don't try to issue the runtest command from outside the testsuite |
288 |
subdirectory using the "--srcdir target" command line argument. |
subdirectory using the "--srcdir target" command line argument. |
311 |
directory containing the testsuite you must have a Makefile.am to |
directory containing the testsuite you must have a Makefile.am to |
312 |
build the "make check" target. You only need to define the dejagnu |
build the "make check" target. You only need to define the dejagnu |
313 |
option for AUTOMAKE_OPTIONS. If you want you can also add runtest |
option for AUTOMAKE_OPTIONS. If you want you can also add runtest |
314 |
command line arguments to the RUNTESTDEFAULTFLAGS variable. |
command line arguments to the RUNTESTDEFAULTFLAGS variable. |
315 |
|
|
316 |
The only problem I had with this was realizing that the Makefile.am |
The only problem I had with this was realizing that the Makefile.am |
317 |
to locate these definitions in is the one located *in* the testsuite |
to locate these definitions in is the one located *in* the testsuite |
318 |
subdirectory. DO NOT make these definitions in the root Makefile.am |
subdirectory. DO NOT make these definitions in the root Makefile.am |
319 |
file (unless you intend to place you TOOL.* subdirectories there). |
file (unless you intend to place you TOOL.* subdirectories there). |
320 |
|
|
321 |
2. I cannot figure out a good way to add alternate check targets (e.g., |
2. I cannot figure out a good way to add alternate check targets (e.g., |
322 |
make check-test1) to run alternate tests on the command line. Since |
make check-test1) to run alternate tests on the command line. Since |
355 |
make check |
make check |
356 |
make check-demo |
make check-demo |
357 |
|
|
|
Good Luck. |
|
358 |
|
Good Luck. |