* lib/autotest/general.m4 (AT_INIT) <at_optarg>: Optimize

`expr' away if there is nothing to do.
< --keywords >: Simplify and robustify argument handling.
Revert erroneous comment from 2005-08-23.  Extend to allow
keyword negation with `!'.
Update help message.  Remove broken code to prevent running
tests multiple times.
* doc/autoconf.texi (testsuite Invocation) < --keywords >:
Update and fix the documentation accordingly.
* tests/autotest.at (Keywords): Renamed to..
(Keywords and ranges): .. this.  Extended to make sure negated
keywords, keywords taken from AT_SETUP arguments, and numeric
test ranges work, and that matching is case-insensitive.
This commit is contained in:
Ralf Wildenhues 2006-03-12 19:58:31 +00:00
parent 17bb2b9ac8
commit e1d5a93433
4 changed files with 93 additions and 25 deletions

View File

@ -1,3 +1,19 @@
2006-03-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4 (AT_INIT) <at_optarg>: Optimize
`expr' away if there is nothing to do.
< --keywords >: Simplify and robustify argument handling.
Revert erroneous comment from 2005-08-23. Extend to allow
keyword negation with `!'.
Update help message. Remove broken code to prevent running
tests multiple times.
* doc/autoconf.texi (testsuite Invocation) < --keywords >:
Update and fix the documentation accordingly.
* tests/autotest.at (Keywords): Renamed to..
(Keywords and ranges): .. this. Extended to make sure negated
keywords, keywords taken from AT_SETUP arguments, and numeric
test ranges work, and that matching is case-insensitive.
2006-03-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW): Use a typedef to

View File

@ -16725,13 +16725,29 @@ selection.
@itemx -k @var{keywords}
Add to the selection the test groups with title or keywords (arguments
to @code{AT_SETUP} or @code{AT_KEYWORDS}) that match @emph{all} keywords
of the comma separated list @var{keywords}.
of the comma separated list @var{keywords}, case-insensitively. Use
@samp{!} immediately before the keyword to invert the selection for this
keyword. By default, the keywords match whole words; enclose them in
@samp{.*} to also match parts of words.
Running @samp{./testsuite -k autoupdate,FUNC} will select all the tests
tagged with @samp{autoupdate} @emph{and} @samp{FUNC} (as in
@samp{AC_CHECK_FUNC}, @samp{AC_FUNC_FNMATCH}, etc.)@: while
@samp{./testsuite -k autoupdate -k FUNC} will select all tests tagged with
@samp{autoupdate} @emph{or} @samp{FUNC}.
For example, running
@example
@kbd{./testsuite -k 'autoupdate,.*FUNC.*'}
@end example
@noindent
will select all tests tagged @samp{autoupdate} @emph{and} with tags
containing @samp{FUNC} (as in @samp{AC_CHECK_FUNC}, @samp{AC_FUNC_FNMATCH},
etc.), while
@example
@kbd{./testsuite -k '!autoupdate' -k '.*FUNC.*'}
@end example
@noindent
will select all tests not tagged @samp{autoupdate} @emph{or} with tags
containing @samp{FUNC}.
@item --errexit
@itemx -e

View File

@ -83,7 +83,7 @@
# Modes help text. Additional modes can be appended as self-contained
# cat'd here-docs as generated by AS_HELP_STRING.
# - HELP_TUNING
# TUning help text. Additional tuning options can be appended as
# Tuning help text. Additional tuning options can be appended as
# self-contained cat'd here-docs as generated by AS_HELP_STRING.
# - HELP_OTHER
# User help can be appended to this as self-contained cat'd here-docs.
@ -273,7 +273,10 @@ do
at_prev=
fi
at_optarg=`expr "x$at_option" : 'x[[^=]]*=\(.*\)'`
case $at_option in
*=*) at_optarg=`expr "x$at_option" : 'x[[^=]]*=\(.*\)'` ;;
*) at_optarg= ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@ -358,11 +361,23 @@ do
;;
--keywords=* )
at_groups_selected=$at_help_all
for at_keyword in `IFS=,; set X $at_optarg; shift; echo ${1+$[@]}`
at_save_IFS=$IFS
IFS=,
set X $at_optarg
shift
IFS=$at_save_IFS
for at_keyword
do
# Do not match the test group titles.
at_groups_selected=`echo "$at_groups_selected" |
grep -i ["^[1-9][^;]*;.*[; ]$at_keyword[ ;]"]`
at_invert=
case $at_keyword in
'!'*)
at_invert="-v"
at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
;;
esac
# It is on purpose that we match the test group titles too.
at_groups_selected=`echo "$at_groups_selected" |
grep -i $at_invert ["^[1-9][^;]*;.*[; ]$at_keyword[ ;]"]`
done
at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'`
# Smash the newlines.
@ -429,8 +444,8 @@ if $at_help_p; then
cat <<_ATEOF
Usage: $[0] [[OPTION]... [VARIABLE=VALUE]... [TESTS]]
Run all the tests, or the selected TESTS, and save a detailed log file.
Upon failure, create debugging scripts.
Run all the tests, or the selected TESTS, given by numeric ranges, and
save a detailed log file. Upon failure, create debugging scripts.
You should not change environment variables unless explicitly passed
as command line arguments. Set \`AUTOTEST_PATH' to select the executables
@ -459,8 +474,8 @@ cat <<_ATEOF
Execution tuning:
-k, --keywords=KEYWORDS
select the tests matching all the comma separated KEYWORDS
accumulates
select the tests matching all the comma-separated KEYWORDS
multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
-e, --errexit abort as soon as a test fails; implies --debug
-v, --verbose force more detailed output
default for debugging scripts
@ -674,12 +689,6 @@ do
;;
*)
# Skip tests we already run (using --keywords makes it easy to get
# duplication).
case " $at_pass_test $at_skip_test $at_fail_test " in
*" $at_group "* ) continue;;
esac
at_group_normalized=$at_group
_AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized)
@ -1159,7 +1168,7 @@ m4_divert_push([TEST_SCRIPT])dnl
# AT_XFAIL_IF(SHELL-EXPRESSION)
# -----------------------------------
# -----------------------------
# Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to
# true (exitcode = 0).
m4_define([AT_XFAIL_IF],

View File

@ -2,7 +2,7 @@
AT_BANNER([Autotest.])
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -246,7 +246,7 @@ AT_CHECK_AT_TITLE_CHAR([Backslash], [\])
## --------- ##
## Keywords. ##
## --------- ##
AT_SETUP([Keywords])
AT_SETUP([Keywords and ranges])
AT_KEYWORDS([autotest])
AT_DATA([k.at],
@ -289,4 +289,31 @@ AT_CHECK_KEYS([-k key1], [first|both], [2], [none|second], [0])
AT_CHECK_KEYS([-k key2], [second|both], [2], [none|first], [0])
AT_CHECK_KEYS([-k key1,key2], [both], [1], [none|first|second], [0])
AT_CHECK_KEYS([-k key1 -k key2], [first|second|both], [3], [none], [0])
AT_CHECK_KEYS([-k '!key1'], [none|second], [2], [first|both], [0])
AT_CHECK_KEYS([-k '!key2'], [none|first], [2], [second|both], [0])
AT_CHECK_KEYS([-k '!key1,key2'], [second], [1], [none|first|both], [0])
AT_CHECK_KEYS([-k 'key1,!key2'], [first], [1], [none|second|both], [0])
AT_CHECK_KEYS([-k '!key1,!key2'], [none], [1], [first|second|both], [0])
AT_CHECK_KEYS([-k '!key1' -k KEY2], [none|second|both], [3], [first], [0])
AT_CHECK_KEYS([-k key1 -k '!key2'], [none|first|both], [3], [second], [0])
AT_CHECK_KEYS([-k '!KEY1' -k '!key2'], [none|first|second], [3], [both], [0])
AT_CHECK_KEYS([-k none], [none], [1], [first|second|both], [0])
AT_CHECK_KEYS([-k key1,both], [both], [1], [none|first|second], [0])
AT_CHECK_KEYS([-k key1 -k both], [first|both], [2], [none|second], [0])
AT_CHECK_KEYS([-k none,first], [successful], [1], [none|first|second|both], [0])
AT_CHECK_KEYS([-k none,first,second,both], [successful], [1], [none|first|second|both], [0])
AT_CHECK_KEYS([-k !none,first], [first], [1], [none|second|both], [0])
AT_CHECK_KEYS([-k '.*eco.*'], [second], [1], [none|first|both], [0])
AT_CHECK_KEYS([-k 'ECO'], [successful], [1], [none|first|second|both], [0])
AT_CHECK_KEYS([-k '.*eco'], [successful], [1], [none|first|second|both], [0])
AT_CHECK_KEYS([-k 'eco.*'], [successful], [1], [none|first|second|both], [0])
AT_CHECK_KEYS([-k 'fir.*'], [first], [1], [none|second|both], [0])
AT_CHECK_KEYS([1-2], [none|first], [2], [second|both], [0])
AT_CHECK_KEYS([1-3 2-1], [none|first|second], [3], [both], [0])
AT_CHECK_KEYS([-3], [none|first|second], [3], [both], [0])
AT_CHECK_KEYS([4-], [both], [1], [none|first|second], [0])
AT_CHECK_KEYS([-k second 4-], [second|both], [2], [none|first], [0])
AT_CLEANUP