66 |
# Defined below: |
# Defined below: |
67 |
# - DEFAULTS |
# - DEFAULTS |
68 |
# Overall initialization, value of $at_groups_all. |
# Overall initialization, value of $at_groups_all. |
69 |
# - OPTIONS |
# - PARSE_ARGS |
70 |
# Option processing |
# Option processing. After AT_INIT, user options can be entered here as |
71 |
# Be ready to run the tests. |
# cases of a case statement. |
72 |
|
# - PARSE_ARGS_END |
73 |
|
# Finish up the option processing. |
74 |
|
# - HELP |
75 |
|
# Start printing the help message. User help can be appended to this as |
76 |
|
# self-contained cat'd here-docs. |
77 |
|
# - HELP_END |
78 |
|
# Finish up the help texts. |
79 |
|
# - PREPARE_TESTS |
80 |
|
# Like DEFAULTS but run after argument processing for purposes of |
81 |
|
# optimization. Do anything else that needs to be done to prepare for |
82 |
|
# tests. Sets up verbose and log file descriptors. Sets and logs PATH. |
83 |
# - TESTS |
# - TESTS |
84 |
# The core of the test suite, the ``normal'' diversion. |
# The core of the test suite, the ``normal'' diversion. |
85 |
# - TAIL |
# - TESTS_END |
86 |
# tail of the core for;case, overall wrap up, generation of debugging |
# tail of the core for;case, overall wrap up, generation of debugging |
87 |
# scripts and statistics. |
# scripts and statistics. |
88 |
|
|
89 |
m4_define([_m4_divert(DEFAULTS)], 5) |
m4_define([_m4_divert(DEFAULTS)], 100) |
90 |
m4_define([_m4_divert(OPTIONS)], 10) |
m4_define([_m4_divert(PARSE_ARGS)], 200) |
91 |
m4_define([_m4_divert(TESTS)], 50) |
m4_define([_m4_divert(PARSE_ARGS_END)], 201) |
92 |
m4_define([_m4_divert(TAIL)], 60) |
m4_define([_m4_divert(HELP)], 300) |
93 |
|
m4_define([_m4_divert(HELP_MODES)], 301) |
94 |
|
m4_define([_m4_divert(HELP_TUNING)], 302) |
95 |
|
m4_define([_m4_divert(HELP_OTHER)], 303) |
96 |
|
m4_define([_m4_divert(HELP_END)], 304) |
97 |
|
m4_define([_m4_divert(PREPARE_TESTS)], 400) |
98 |
|
m4_define([_m4_divert(TESTS)], 401) |
99 |
|
m4_define([_m4_divert(TESTS_END)], 402) |
100 |
|
|
101 |
|
|
102 |
# AT_LINE |
# AT_LINE |
192 |
at_stderr=$at_suite_dir/at-stderr |
at_stderr=$at_suite_dir/at-stderr |
193 |
# The file containing dates. |
# The file containing dates. |
194 |
at_times_file=$at_suite_dir/at-times |
at_times_file=$at_suite_dir/at-times |
195 |
|
m4_divert_pop([DEFAULTS])dnl |
196 |
m4_wrap([m4_divert_text([DEFAULTS], |
m4_wrap([m4_divert_text([DEFAULTS], |
197 |
[# List of the tested programs. |
[ |
198 |
|
# List of the tested programs. |
199 |
at_tested='m4_ifdef([AT_tested], [AT_tested])' |
at_tested='m4_ifdef([AT_tested], [AT_tested])' |
200 |
# List of the all the test groups. |
# List of the all the test groups. |
201 |
at_groups_all='AT_groups_all' |
at_groups_all='AT_groups_all' |
206 |
# Description of all the test groups. |
# Description of all the test groups. |
207 |
at_help_all= |
at_help_all= |
208 |
AT_help])])dnl |
AT_help])])dnl |
209 |
m4_divert([OPTIONS]) |
m4_divert_push([PARSE_ARGS])dnl |
210 |
|
|
211 |
|
at_keywords= |
212 |
|
at_prev= |
213 |
|
for at_option |
214 |
|
do |
215 |
|
# If the previous option needs an argument, assign it. |
216 |
|
if test -n "$at_prev"; then |
217 |
|
eval "$at_prev=\$at_option" |
218 |
|
at_prev= |
219 |
|
continue |
220 |
|
fi |
221 |
|
|
222 |
|
at_optarg=`expr "x$at_option" : 'x[[^=]]*=\(.*\)'` |
223 |
|
|
224 |
while test $[@%:@] -gt 0; do |
# Accept the important Cygnus configure options, so we can diagnose typos. |
225 |
case $[1] in |
|
226 |
|
case $at_option in |
227 |
--help | -h ) |
--help | -h ) |
228 |
at_help_p=: |
at_help_p=: |
229 |
;; |
;; |
260 |
;; |
;; |
261 |
|
|
262 |
[[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) |
[[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) |
263 |
at_groups="$at_groups$[1] " |
at_groups="$at_groups$at_option " |
264 |
;; |
;; |
265 |
|
|
266 |
# Ranges |
# Ranges |
267 |
[[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-]) |
[[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-]) |
268 |
at_range_start=`echo $[1] |tr -d '-'` |
at_range_start=`echo $at_option |tr -d '-'` |
269 |
at_range=`echo " $at_groups_all " | \ |
at_range=`echo " $at_groups_all " | \ |
270 |
sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'` |
sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'` |
271 |
at_groups="$at_groups$at_range " |
at_groups="$at_groups$at_range " |
272 |
;; |
;; |
273 |
|
|
274 |
[-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]]) |
[-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]]) |
275 |
at_range_end=`echo $[1] |tr -d '-'` |
at_range_end=`echo $at_option |tr -d '-'` |
276 |
at_range=`echo " $at_groups_all " | \ |
at_range=`echo " $at_groups_all " | \ |
277 |
sed -e 's, '$at_range_end' .*$, '$at_range_end','` |
sed -e 's, '$at_range_end' .*$, '$at_range_end','` |
278 |
at_groups="$at_groups$at_range " |
at_groups="$at_groups$at_range " |
284 |
[[0-9][0-9][0-9]-[0-9][0-9][0-9]] | \ |
[[0-9][0-9][0-9]-[0-9][0-9][0-9]] | \ |
285 |
[[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] | \ |
[[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] | \ |
286 |
[[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] ) |
[[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] ) |
287 |
at_range_start=`echo $[1] |sed 's,-.*,,'` |
at_range_start=`echo $at_option |sed 's,-.*,,'` |
288 |
at_range_end=`echo $[1] |sed 's,.*-,,'` |
at_range_end=`echo $at_option |sed 's,.*-,,'` |
289 |
# FIXME: Maybe test to make sure start <= end? |
# FIXME: Maybe test to make sure start <= end? |
290 |
at_range=`echo " $at_groups_all " | \ |
at_range=`echo " $at_groups_all " | \ |
291 |
sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \ |
sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \ |
295 |
|
|
296 |
# Keywords. |
# Keywords. |
297 |
--keywords | -k ) |
--keywords | -k ) |
298 |
shift |
at_prev=at_keywords |
299 |
at_groups_selected=$at_help_all |
;; |
300 |
for at_keyword in `IFS=,; set X $[1]; shift; echo ${1+$[@]}` |
--keywords=* ) |
301 |
do |
at_keywords=$at_optarg |
302 |
# It is on purpose that we match the test group titles too. |
;; |
303 |
at_groups_selected=`echo "$at_groups_selected" | |
m4_divert_pop([PARSE_ARGS])dnl |
304 |
grep -i "^[[^;]]*;[[^;]]*;.*$at_keyword"` |
dnl Process *=* last to allow for user specified --option=* type arguments. |
305 |
done |
m4_divert_push([PARSE_ARGS_END])dnl |
|
at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'` |
|
|
# Smash the end of lines. |
|
|
at_groups_selected=`echo $at_groups_selected` |
|
|
at_groups="$at_groups$at_groups_selected " |
|
|
;; |
|
306 |
|
|
307 |
*=*) |
*=*) |
308 |
at_envvar=`expr "x$[1]" : 'x\([[^=]]*\)='` |
at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='` |
309 |
# Reject names that are not valid shell variable names. |
# Reject names that are not valid shell variable names. |
310 |
expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && |
expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && |
311 |
AS_ERROR([invalid variable name: $at_envvar]) |
AS_ERROR([invalid variable name: $at_envvar]) |
312 |
at_value=`expr "x$[1]" : 'x[[^=]]*=\(.*\)'` |
at_value=`echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` |
|
at_value=`echo "$at_value" | sed "s/'/'\\\\\\\\''/g"` |
|
313 |
eval "$at_envvar='$at_value'" |
eval "$at_envvar='$at_value'" |
314 |
export $at_envvar |
export $at_envvar |
315 |
# Propagate to debug scripts. |
# Propagate to debug scripts. |
316 |
at_debug_args="$at_debug_args $[1]" |
at_debug_args="$at_debug_args $at_option" |
317 |
;; |
;; |
318 |
|
|
319 |
*) echo "$as_me: invalid option: $[1]" >&2 |
*) echo "$as_me: invalid option: $at_option" >&2 |
320 |
echo "Try \`$[0] --help' for more information." >&2 |
echo "Try \`$[0] --help' for more information." >&2 |
321 |
exit 1 |
exit 1 |
322 |
;; |
;; |
323 |
esac |
esac |
|
shift |
|
324 |
done |
done |
325 |
|
|
326 |
|
# Process the --keywords |
327 |
|
if test -n "$at_keywords"; then |
328 |
|
at_groups_selected=$at_help_all |
329 |
|
for at_keyword in `IFS=,; set X $at_keywords; shift; echo ${1+$[@]}` |
330 |
|
do |
331 |
|
# It is on purpose that we match the test group titles too. |
332 |
|
at_groups_selected=`echo "$at_groups_selected" | |
333 |
|
grep -i "^[[^;]]*;[[^;]]*;.*$at_keyword"` |
334 |
|
done |
335 |
|
at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'` |
336 |
|
# Smash the end of lines. |
337 |
|
at_groups_selected=`echo $at_groups_selected` |
338 |
|
at_groups="$at_groups$at_groups_selected " |
339 |
|
fi |
340 |
|
|
341 |
# Selected test groups. |
# Selected test groups. |
342 |
test -z "$at_groups" && at_groups=$at_groups_all |
test -z "$at_groups" && at_groups=$at_groups_all |
343 |
|
m4_divert_pop([PARSE_ARGS_END])dnl |
344 |
|
m4_divert_push([HELP])dnl |
345 |
|
|
346 |
# Help message. |
# Help message. |
347 |
if $at_help_p; then |
if $at_help_p; then |
361 |
possibly amounts into |
possibly amounts into |
362 |
|
|
363 |
PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH |
PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH |
364 |
|
_ATEOF |
365 |
|
m4_divert_pop([HELP])dnl |
366 |
|
m4_divert_push([HELP_MODES])dnl |
367 |
|
cat <<_ATEOF |
368 |
|
|
369 |
Operation modes: |
Operation modes: |
370 |
-h, --help print the help message, then exit |
-h, --help print the help message, then exit |
371 |
-V, --version print version number, then exit |
-V, --version print version number, then exit |
372 |
-c, --clean remove all the files this test suite might create and exit |
-c, --clean remove all the files this test suite might create and exit |
373 |
-l, --list describes all the tests, or the selected TESTS |
-l, --list describes all the tests, or the selected TESTS |
374 |
|
_ATEOF |
375 |
|
m4_divert_pop([HELP_MODES])dnl |
376 |
|
m4_divert_push([HELP_TUNING])dnl |
377 |
|
cat <<_ATEOF |
378 |
|
|
379 |
Execution tuning: |
Execution tuning: |
380 |
-k, --keywords=KEYWORDS |
-k, --keywords=KEYWORDS |
386 |
-d, --debug inhibit clean up and debug script creation |
-d, --debug inhibit clean up and debug script creation |
387 |
default for debugging scripts |
default for debugging scripts |
388 |
-x, --trace enable tests shell tracing |
-x, --trace enable tests shell tracing |
389 |
|
_ATEOF |
390 |
|
m4_divert_pop([HELP_TUNING])dnl |
391 |
|
m4_divert_push([HELP_END])dnl |
392 |
|
cat <<_ATEOF |
393 |
|
|
394 |
Report bugs to <AT_PACKAGE_BUGREPORT>. |
Report bugs to <AT_PACKAGE_BUGREPORT>. |
395 |
_ATEOF |
_ATEOF |
414 |
if ($[4]) printf " %s\n", $[4] } ' |
if ($[4]) printf " %s\n", $[4] } ' |
415 |
exit 0 |
exit 0 |
416 |
fi |
fi |
417 |
|
m4_divert_pop([HELP_END])dnl |
418 |
|
m4_divert_push([PREPARE_TESTS])dnl |
419 |
|
|
420 |
# Don't take risks: use only absolute directories in PATH. |
# Don't take risks: use only absolute directories in PATH. |
421 |
# |
# |
546 |
at_fail_list= |
at_fail_list= |
547 |
at_skip_list= |
at_skip_list= |
548 |
at_group_count=0 |
at_group_count=0 |
549 |
m4_divert([TESTS])dnl |
m4_divert_pop([PREPARE_TESTS])dnl |
550 |
|
m4_divert_push([TESTS])dnl |
551 |
|
|
552 |
# Create the master directory if it doesn't already exist. |
# Create the master directory if it doesn't already exist. |
553 |
test -d $at_suite_dir || |
test -d $at_suite_dir || |
601 |
test $at_group_count != 0 && $at_verbose |
test $at_group_count != 0 && $at_verbose |
602 |
case $at_group in |
case $at_group in |
603 |
dnl Test groups inserted here (TESTS). |
dnl Test groups inserted here (TESTS). |
604 |
m4_divert([TAIL])[]dnl |
m4_divert_pop([TESTS])[]dnl |
605 |
|
m4_divert_push([TESTS_END])[]dnl |
606 |
|
|
607 |
* ) |
* ) |
608 |
echo "$as_me: no such test group: $at_group" >&2 |
echo "$as_me: no such test group: $at_group" >&2 |
758 |
fi |
fi |
759 |
|
|
760 |
exit 0 |
exit 0 |
761 |
m4_divert_pop([TAIL])dnl |
m4_divert_pop([TESTS_END])dnl |
762 |
dnl End of AT_INIT: divert to KILL, only test groups are to be |
dnl End of AT_INIT: divert to KILL, only test groups are to be |
763 |
dnl output, the rest is ignored. Current diversion is BODY, inherited |
dnl output, the rest is ignored. Current diversion is BODY, inherited |
764 |
dnl from M4sh. |
dnl from M4sh. |