interface index 0 is invalid (starting with 1), check if it's rejected correctly

svn path=/trunk/; revision=16946
This commit is contained in:
Ulf Lamping 2006-01-05 00:29:32 +00:00
parent e897f0a805
commit 8fcb1323e7
1 changed files with 20 additions and 1 deletions

View File

@ -110,7 +110,7 @@ clopts_step_invalid_capfilter() {
fi
}
# check exit status and grep output string of an invalid capture filter
# check exit status and grep output string of an invalid interface
clopts_step_invalid_interface() {
$TETHEREAL -i invalid_interface -w './testout.pcap' > ./testout.txt 2>&1
RETURNVALUE=$?
@ -127,6 +127,24 @@ clopts_step_invalid_interface() {
fi
}
# check exit status and grep output string of an invalid interface index
# (valid interface indexes start with 1)
clopts_step_invalid_interface_index() {
$TETHEREAL -i 0 -w './testout.pcap' > ./testout.txt 2>&1
RETURNVALUE=$?
if [ ! $RETURNVALUE -eq $EXIT_COMMAND_LINE ]; then
test_step_failed "exit status: $RETURNVALUE"
else
grep -i 'there is no interface with that adapter index' ./testout.txt > /dev/null
if [ $? -eq 0 ]; then
test_step_ok
else
cat ./testout.txt
test_step_failed "Infos"
fi
fi
}
# check exit status and grep output string of an invalid capture filter
# XXX - how to efficiently test the *invalid* flags?
clopts_step_valid_name_resolving() {
@ -157,6 +175,7 @@ clopt_suite() {
test_suite_add "Valid Tethereal single char options" clopts_suite_valid_chars
test_step_add "Invalid capture filter -f" clopts_step_invalid_capfilter
test_step_add "Invalid capture interface -i" clopts_step_invalid_interface
test_step_add "Invalid capture interface index 0" clopts_step_invalid_interface_index
test_step_add "Valid name resolution options -N (1s)" clopts_step_valid_name_resolving
#test_remark_add "Undocumented command line option: G"
#test_remark_add "Options currently unchecked: S, V, l, n, p, q and x"