diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-03-30 16:55:08 -0400 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2014-03-30 21:03:15 +0000 |
commit | 550e3153bf0f37a9297057c3c5024aa8809fd428 (patch) | |
tree | 21518c30159a6e3052d5e3d5153d62adc20ed856 /tools/randpkt-test.sh | |
parent | b63b5034569f861d6cca0354aaa5c25eda18558e (diff) |
Fix fuzz-test.sh '-b' option so it works again; Do some other tools/*test*.sh changes
- Add -b option to randpkt-test.sh and test-captures.sh;
- Create/ue a common function to do '-x' tests on files/dirs;
- Rename exit_error function to ws_exit_error
Change-Id: I032c9d784bec1fb6b0717aaad08a061e4d935476
Reviewed-on: https://code.wireshark.org/review/872
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'tools/randpkt-test.sh')
-rwxr-xr-x | tools/randpkt-test.sh | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/tools/randpkt-test.sh b/tools/randpkt-test.sh index 4d00c307a3..c1b3016153 100755 --- a/tools/randpkt-test.sh +++ b/tools/randpkt-test.sh @@ -13,11 +13,10 @@ TEST_TYPE="randpkt" # Uncomment to disable WIRESHARK_ABORT_ON_DISSECTOR_BUG="True" -PKT_TYPES=`$RANDPKT -h | awk '/^\t/ {print $1}'` - # To do: add options for file names and limits -while getopts ":d:p:t:" OPTCHAR ; do +while getopts ":b:d:p:t:" OPTCHAR ; do case $OPTCHAR in + b) BIN_DIR=$OPTARG ;; d) TMP_DIR=$OPTARG ;; p) MAX_PASSES=$OPTARG ;; t) PKT_TYPES=$OPTARG ;; @@ -27,6 +26,11 @@ shift $(($OPTIND - 1)) ### usually you won't have to change anything below this line ### +ws_bind_exec_paths +ws_check_exec "$TSHARK" "$RANDPKT" "$DATE" "$TMP_DIR" + +[[ -z "$PKT_TYPES" ]] && PKT_TYPES=$($RANDPKT -h | awk '/^\t/ {print $1}') + # TShark arguments (you won't have to change these) # n Disable network object name resolution # V Print a view of the details of the packet rather than a one-line summary of the packet @@ -35,17 +39,6 @@ shift $(($OPTIND - 1)) declare -a TSHARK_ARGS=("-nVxr" "-nr") RANDPKT_ARGS="-b 2000 -c 5000" -NOTFOUND=0 -for i in "$TSHARK" "$RANDPKT" "$DATE" "$TMP_DIR" ; do - if [ ! -x $i ]; then - echo "Couldn't find $i" - NOTFOUND=1 - fi -done -if [ $NOTFOUND -eq 1 ]; then - exit 1 -fi - HOWMANY="forever" if [ $MAX_PASSES -gt 0 ]; then HOWMANY="$MAX_PASSES passes" @@ -97,7 +90,7 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then - exit_error + ws_exit_error fi echo " OK" rm -f $TMP_DIR/$TMP_FILE $TMP_DIR/$ERR_FILE |