]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autotest/general.m4 (AT_INIT) <at_optarg>: Optimize
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 12 Mar 2006 19:58:31 +0000 (19:58 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 12 Mar 2006 19:58:31 +0000 (19:58 +0000)
`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.

ChangeLog
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at

index 264b634098ca194fb7572238eeea7e438bd55db4..17e9da4e3468ad9d48449fb249f73c32a71cc7e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index d0e47d4a49f23eea59e2fd82458f359aa5b685de..aeb7c3a77c23bb32f158b4ce813171b819fcae10 100644 (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
index 338cefd4ead972e834a2200bc3901ebe9f274a8f..d71b1882927e7fff0b9f1767e1b8d889170638a5 100644 (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],
index d9efffde00dc518fde00f1d7c8eabd64a4e88c66..95594a3e849737c5f4f42d477975290b1a8bb042 100644 (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