aboutsummaryrefslogtreecommitdiffstats
path: root/tools/valgrind-wireshark.sh
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-06-06 10:10:07 -0700
committerGerald Combs <gerald@wireshark.org>2018-06-07 18:11:12 +0000
commit4905983845dd64fc37c7bbaaa0e1f2dcc32f21f4 (patch)
tree04a725c2972c2b16afdd74cd07d5dc6abf00079b /tools/valgrind-wireshark.sh
parent0882e94cff6a6a5087bfaf3883c9842cb8f9d944 (diff)
More shellcheck checks and fixes.
Remove a libtool check while we're here. Change-Id: I813add2031480f34ce89f268b541f8939016c2c7 Reviewed-on: https://code.wireshark.org/review/28066 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'tools/valgrind-wireshark.sh')
-rwxr-xr-xtools/valgrind-wireshark.sh60
1 files changed, 25 insertions, 35 deletions
diff --git a/tools/valgrind-wireshark.sh b/tools/valgrind-wireshark.sh
index b598c40c30..8209a09598 100755
--- a/tools/valgrind-wireshark.sh
+++ b/tools/valgrind-wireshark.sh
@@ -57,16 +57,16 @@ while getopts ":2a:b:C:lmnpP:rstTYwcevWdG" OPTCHAR ; do
d) COMMAND=dumpcap
COMMAND_ARGS="-i eth1 -c 3000"
VALID=1 ;;
- *) printf "Unknown option -$OPTARG!\n"
+ *) printf "Unknown option: %s\\n" "$OPTARG"
exit ;;
esac
done
-shift $(($OPTIND - 1))
+shift $(( OPTIND - 1 ))
# Sanitize parameters
if [ "$COMMAND" != "tshark" ] && [[ $COMMAND_ARGS =~ Vx ]]
then
- printf "\nYou can't use -T if you're not using tshark\n\n" >&2
+ printf "\\nYou can't use -T if you're not using tshark\\n\\n" >&2
exit 1
fi
@@ -78,25 +78,25 @@ fi
if [ $VALID -eq 0 ]
then
- printf "\nUsage: $(basename $0) [-2] [-a file] [-b bin_dir] [-c] [-e] [-C config_profile] "
- printf "[-l] [-m] [-n] [-p] [-r] [-s] [-t] [-T] [-w] [-v] /path/to/file.pcap\n"
- printf "\n"
- printf "[-2]: run tshark with 2-pass analysis\n"
- printf "[-a]: additional valgrind suppression file\n"
- printf "[-b]: tshark binary dir\n"
- printf "[-e]: use 'editcap -E 0.02' instead of tshark\n"
- printf "[-c]: use capinfos instead of tshark\n"
- printf "[-C]: binary profile file\n"
- printf "[-l]: add valgrind option --leak-check=full\n"
- printf "[-m]: use valgrind massif tool\n"
- printf "[-n]: print binary version\n"
- printf "[-p]: use callgrind massif tool\n"
- printf "[-r]: add valgrind option --show-reachable=yes\n"
- printf "[-s]: add valgrind option --gen-suppressions=yes\n"
- printf "[-t]: add valgrind option --track-origins=yes\n"
- printf "[-T]: build the tshark tree (-Vx)\n"
- printf "[-w]: use wireshark instead of tshark\n"
- printf "[-v]: run in verbose mode (--num-callers=256)\n"
+ printf "\\nUsage: %s [-2] [-a file] [-b bin_dir] [-c] [-e] [-C config_profile] " "$(basename "$0")"
+ printf "[-l] [-m] [-n] [-p] [-r] [-s] [-t] [-T] [-w] [-v] /path/to/file.pcap\\n"
+ printf "\\n"
+ printf "[-2]: run tshark with 2-pass analysis\\n"
+ printf "[-a]: additional valgrind suppression file\\n"
+ printf "[-b]: tshark binary dir\\n"
+ printf "[-e]: use 'editcap -E 0.02' instead of tshark\\n"
+ printf "[-c]: use capinfos instead of tshark\\n"
+ printf "[-C]: binary profile file\\n"
+ printf "[-l]: add valgrind option --leak-check=full\\n"
+ printf "[-m]: use valgrind massif tool\\n"
+ printf "[-n]: print binary version\\n"
+ printf "[-p]: use callgrind massif tool\\n"
+ printf "[-r]: add valgrind option --show-reachable=yes\\n"
+ printf "[-s]: add valgrind option --gen-suppressions=yes\\n"
+ printf "[-t]: add valgrind option --track-origins=yes\\n"
+ printf "[-T]: build the tshark tree (-Vx)\\n"
+ printf "[-w]: use wireshark instead of tshark\\n"
+ printf "[-v]: run in verbose mode (--num-callers=256)\\n"
exit 1
fi
@@ -111,23 +111,13 @@ fi
COMMAND="$WIRESHARK_BIN_DIR/$COMMAND"
-if file $COMMAND | grep -q "ASCII text"; then
- if [ -x "`dirname $0`/../libtool" ]; then
- LIBTOOL="`dirname $0`/../libtool"
- else
- LIBTOOL="libtool"
- fi
- LIBTOOL="$LIBTOOL --mode=execute"
-else
- LIBTOOL=""
-fi
-
-cmdline="$LIBTOOL valgrind --suppressions=`dirname $0`/vg-suppressions $ADDITIONAL_SUPPRESSION_FILE \
+cmdline="valgrind --suppressions=$( dirname "$0" )/vg-suppressions $ADDITIONAL_SUPPRESSION_FILE \
--tool=$TOOL $CALLGRIND_OUT_FILE $VERBOSE $LEAK_CHECK $REACHABLE $GEN_SUPPRESSIONS $TRACK_ORIGINS \
$COMMAND $COMMAND_ARGS $PCAP $COMMAND_ARGS2"
if [ "$VERBOSE" != "" ];then
- echo -e "\n$cmdline\n"
+ echo -e "\\n$cmdline\\n"
fi
+# shellcheck disable=SC2086
exec $cmdline > /dev/null