]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Validate testsuite range arguments.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 21 Oct 2007 10:42:09 +0000 (12:42 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 21 Oct 2007 15:34:44 +0000 (17:34 +0200)
* lib/autotest/general.m4 (Defaults): Validate input ranges ...
<at_func_validate_ranges>: ... using this new function.
* tests/autotest.at (Keywords and ranges): Test invalid ranges.
Test --list with ranges and keywords.
(Banners): Remove one now-failing test.

ChangeLog
lib/autotest/general.m4
tests/autotest.at

index af1c06e67832621c018b15e6efe427552121a44b..0d6349e6f52ab3521f40d1be01f98ac6207798e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-10-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de> 
+
+       * lib/autotest/general.m4 (Defaults): Validate input ranges ...
+       <at_func_validate_ranges>: ... using this new function.
+       * tests/autotest.at (Keywords and ranges): Test invalid ranges.
+       Test --list with ranges and keywords.
+       (Banners): Remove one now-failing test.
+
 2007-10-20  Eric Blake  <ebb9@byu.net>
 
        Fix testsuite --list subset.
index aa2920203213dde935c33d2375f8968b87e9228f..29834f19143cb743cb730ddc9c91086fa00a9f77 100644 (file)
@@ -430,7 +430,21 @@ at_groups_all='AT_groups_all'
 # numerical order.
 at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
 # Description of all the test groups.
-at_help_all="AS_ESCAPE(m4_dquote(m4_defn([AT_help_all])))"])])dnl
+at_help_all="AS_ESCAPE(m4_dquote(m4_defn([AT_help_all])))"
+
+# at_func_validate_ranges [N...]
+# ------------------------------
+# validate test group ranges
+at_func_validate_ranges ()
+{
+  for at_grp
+  do
+    if test $at_grp -lt 1 || test $at_grp -gt AT_ordinal; then
+      AS_ECHO(["invalid test group: $at_grp"]) >&2
+      exit 1
+    fi
+  done
+}])])dnl
 m4_divert_push([PARSE_ARGS])dnl
 
 at_prev=
@@ -487,12 +501,14 @@ do
        ;;
 
     [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
+       at_func_validate_ranges $at_option
        at_groups="$at_groups$at_option "
        ;;
 
     # Ranges
     [[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 X-`
+       at_func_validate_ranges $at_range_start
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/^.* \('$at_range_start' \)/\1/'`
        at_groups="$at_groups$at_range "
@@ -500,6 +516,7 @@ do
 
     [-[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 X-`
+       at_func_validate_ranges $at_range_end
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/\( '$at_range_end'\) .*$/\1/'`
        at_groups="$at_groups$at_range "
@@ -518,6 +535,7 @@ do
          at_range_end=$at_range_start
          at_range_start=$at_tmp
        fi
+       at_func_validate_ranges $at_range_start $at_range_end
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/^.*\( '$at_range_start' \)/\1/' \
              -e 's/\( '$at_range_end'\) .*$/\1/'`
index 75a6015d0fc6ed3ab23870a8ed07470c74791794..ea84c184a1ec0258588804f90e159b6aa838fc5a 100644 (file)
@@ -439,7 +439,6 @@ AT_CHECK_BANNERS([-k a],    [first], [1], [second], [1])
 AT_CHECK_BANNERS([4],          [first], [0], [second], [0])
 AT_CHECK_BANNERS([4-],         [first], [0], [second], [1])
 AT_CHECK_BANNERS([-k two],     [first], [0], [second], [0])
-AT_CHECK_BANNERS([0 3],                [first], [0], [second], [0])
 AT_CHECK_BANNERS([-k three],   [first], [0], [second], [1])
 AT_CHECK_BANNERS([5],          [first], [0], [second], [0])
 AT_CHECK_BANNERS([5-],         [first], [0], [second], [1])
@@ -515,6 +514,18 @@ 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_CHECK([./k 0], [1], [ignore], [ignore])
+AT_CHECK([./k 0-], [1], [ignore], [ignore])
+AT_CHECK([./k -0], [1], [ignore], [ignore])
+AT_CHECK([./k 5], [1], [ignore], [ignore])
+AT_CHECK([./k 5-], [1], [ignore], [ignore])
+AT_CHECK([./k 1-5], [1], [ignore], [ignore])
+AT_CHECK([./k -k nonexistent], [0], [ignore])
+
+AT_CHECK_KEYS([--list -k nonexistent], [KEYWORDS], [1], [first|second|both], [0])
+AT_CHECK_KEYS([--list 1], [none], [1], [first|second|both], [0])
+AT_CHECK_KEYS([--list -k none -k first], [none|first], [2], [second|both], [0])
 AT_CLEANUP