]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(AT_INIT): Process multiple --keywords correctly.
authorStepan Kasal <kasal@ucw.cz>
Tue, 23 Aug 2005 08:57:24 +0000 (08:57 +0000)
committerStepan Kasal <kasal@ucw.cz>
Tue, 23 Aug 2005 08:57:24 +0000 (08:57 +0000)
ChangeLog
lib/autotest/general.m4
tests/autotest.at

index ac38f439b68881c067196e92d6bd81d8f6c53913..45a31cb10db51f23b9d33c7a5602385173ec7c02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        that AC_CONFIG_COMMANDS_PRE and AC_CONFIG_COMMANDS_POST are not
        ``Configuration Actions''; fix their index entries.
 
+        * lib/autotest/general.m4 (AT_INIT): Process multiple keywords
+       options correctly.  Process N-M as M-N if M is smaller than N.
+        Process ranges correctly so that N-N will run only N.
+       Sort and uniquify the tests that will be run.  If there is more
+       than one test, reinsert the banners for the tests.
+        * tests/autotest.at (Keywords): Unmark XFAIL.
+
 2005-08-23  Stepan Kasal  <kasal@ucw.cz>
 
        * Makefile.maint: Revert the change from 2005-08-12.
index 31f393df1e9098424fc6d61045ad0dfbb1d637fa..aa1a628d217e4234a9001a49ab2c67795f7997a6 100644 (file)
@@ -249,7 +249,6 @@ at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [.])'
 at_help_all='AT_help_all'])])dnl
 m4_divert_push([PARSE_ARGS])dnl
 
-at_keywords=
 at_prev=
 for at_option
 do
@@ -306,14 +305,14 @@ do
     [[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-])
        at_range_start=`echo $at_option |tr -d '-'`
        at_range=`echo " $at_groups_all " | \
-         sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'`
+         sed -e 's,^.* \('$at_range_start' \),\1,'`
        at_groups="$at_groups$at_range "
        ;;
 
     [-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]])
        at_range_end=`echo $at_option |tr -d '-'`
        at_range=`echo " $at_groups_all " | \
-         sed -e 's, '$at_range_end' .*$, '$at_range_end','`
+         sed -e 's,\( '$at_range_end'\) .*$,\1,'`
        at_groups="$at_groups$at_range "
        ;;
 
@@ -323,12 +322,16 @@ do
     [[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][0-9]] )
-       at_range_start=`expr $at_option : '\([^-]*\)'`
-       at_range_end=`expr $at_option : '[^-]*-\(.*\)'`
-       # FIXME: Maybe test to make sure start <= end?
+       at_range_start=`expr $at_option : '\(.*\)-'`
+       at_range_end=`expr $at_option : '.*-\(.*\)'`
+       if test $at_range_start -gt $at_range_end; then
+         at_tmp=$at_range_end
+         at_range_end=$at_range_start
+         at_range_start=$at_tmp
+       fi
        at_range=`echo " $at_groups_all " | \
-         sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \
-             -e 's, '$at_range_end' .*$, '$at_range_end','`
+         sed -e 's,^.*\( '$at_range_start' \),\1,' \
+             -e 's,\( '$at_range_end'\) .*$,\1,'`
        at_groups="$at_groups$at_range "
        ;;
 
@@ -337,7 +340,16 @@ do
        at_prev=--keywords
        ;;
     --keywords=* )
-       at_keywords="$at_keywords,$at_optarg"
+       at_groups_selected=$at_help_all
+       for at_keyword in `IFS=,; set X $at_optarg; shift; echo ${1+$[@]}`
+       do
+               # Do not match the test group titles.
+               at_groups_selected=`echo "$at_groups_selected" |
+                       grep -i ["^[1-9][^;]*;.*[; ]$at_keyword[ ;]"]`
+       done
+       at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'`
+       # Smash the newlines.
+       at_groups="$at_groups`echo $at_groups_selected` "
        ;;
 m4_divert_pop([PARSE_ARGS])dnl
 dnl Process *=* last to allow for user specified --option=* type arguments.
@@ -362,23 +374,36 @@ m4_divert_push([PARSE_ARGS_END])dnl
   esac
 done
 
-# Process the --keywords
-if test -n "$at_keywords"; then
-  at_groups_selected=$at_help_all
-  for at_keyword in `IFS=,; set X $at_keywords; shift; echo ${1+$[@]}`
-  do
-    # It is on purpose that we match the test group titles too.
-    at_groups_selected=`echo "$at_groups_selected" |
-                       grep -i "^[[^;]]*;[[^;]]*.*[[; ]]$at_keyword[[ ;]]"`
-  done
-  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 "
-fi
-
 # Selected test groups.
-test -z "$at_groups" && at_groups=$at_groups_all
+if test -z "$at_groups"; then
+  at_groups=$at_groups_all
+else
+  # Sort the tests, removing duplicates:
+  at_groups=`echo $at_groups | tr ' ' "$as_nl" | sort -nu`
+  # and add banners.  (Passing at_groups_all is tricky--see the comment
+  # starting with "Passing at_groups is tricky.")
+  at_groups=`echo "$at_groups$as_nl $at_groups_all" |
+    awk ['BEGIN { FS = "@" } # Effectively switch off field splitting.
+       /^$/ { next }  # Ignore the empty line.
+       !/ / { groups++; selected[$ 0] = 1; next }
+       # The last line, containing at_groups_all.
+       {
+               n = split($ 0, a, " ")
+               # If there are several tests, select their banners:
+               if (groups > 1) {
+                       for (i = 1; i <= n; i++) {
+                               if (a[i] ~ /^banner-/)
+                                       banner = a[i]
+                               else if (banner != "" && selected[a[i]] == 1)
+                                       selected[banner] = 1
+                       }
+               }
+               for (i = 1; i <= n; i++)
+                       if (selected[a[i]] == 1)
+                               list = list " " a[i]
+               print list
+       }']`
+fi
 m4_divert_pop([PARSE_ARGS_END])dnl
 m4_divert_push([HELP])dnl
 
index b0f0735158287a8ba02758097049b0094d91d58b..d9efffde00dc518fde00f1d7c8eabd64a4e88c66 100644 (file)
@@ -248,7 +248,6 @@ AT_CHECK_AT_TITLE_CHAR([Backslash],    [\])
 ## --------- ##
 AT_SETUP([Keywords])
 AT_KEYWORDS([autotest])
-AT_XFAIL_IF(:)
 
 AT_DATA([k.at],
 [[m4_define([AT_PACKAGE_STRING],[k])