check that delv -q -m works

(cherry picked from commit 77128c867c)
This commit is contained in:
Mark Andrews 2018-11-14 11:30:50 +11:00
parent c0d92d4190
commit 57d0ad450a
2 changed files with 34 additions and 1 deletions

View file

@ -1179,6 +1179,8 @@ plus_option(char *option) {
* options: "46a:b:c:d:himp:q:t:vx:";
*/
static const char *single_dash_opts = "46himv";
static const char *dash_opts = "46abcdhimpqtvx";
static bool
dash_option(char *option, char *next, bool *open_type_class) {
char opt, *value;
@ -1404,6 +1406,20 @@ preparse_args(int argc, char **argv) {
}
option = &option[1];
}
if (strlen(option) == 0U) {
continue;
}
/* Look for dash value option. */
if (strpbrk(option, dash_opts) != &option[0] ||
strlen(option) > 1U) {
/* Error or value in option. */
continue;
}
/* Dash value is next argument so we need to skip it. */
argc--, argv++;
/* Handle missing argument */
if (argc == 0)
break;
}
}

View file

@ -454,7 +454,6 @@ ret=0
grep "Dump of all outstanding memory allocations" dig.out.test$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
else
echo_i "$DIG is needed, so skipping these dig tests"
fi
@ -654,6 +653,24 @@ if [ -x ${DELV} ] ; then
grep "a.example." < delv.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking delv H is ignored, and treated like IN ($n)"
ret=0
$DELV $DELVOPTS @10.53.0.3 -c CH -t a a.example > delv.out.test$n || ret=1
grep "a.example." < delv.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that delv -q -m works ($n)"
ret=0
$DELV $DELVOPTS @10.53.0.3 -q -m > delv.out.test$n 2>&1
grep '^; -m\..*[0-9]*.*IN.*ANY.*;' delv.out.test$n > /dev/null || ret=1
grep "^add " delv.out.test$n > /dev/null && ret=1
grep "^del " delv.out.test$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
else
echo_i "$DELV is needed, so skipping these delv tests"
fi