diff options
author | 2016-11-30 10:52:54 +0200 | |
---|---|---|
committer | 2016-11-30 10:52:54 +0200 | |
commit | 36e8a41f68941fbc40f3854654d38c95bd678318 (patch) | |
tree | ba64c7274ae2ab7479b74f3326df4b22dcb2f9a1 | |
parent | 8b410454ecdc416eb3af2e634b6c69c94cba34e3 (diff) |
added valgrind launcher
Signed-off-by: imarom <imarom@cisco.com>
-rwxr-xr-x | scripts/t-rex-64-valgrind | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/scripts/t-rex-64-valgrind b/scripts/t-rex-64-valgrind new file mode 100755 index 00000000..a770895d --- /dev/null +++ b/scripts/t-rex-64-valgrind @@ -0,0 +1,66 @@ +#! /bin/bash +if [ "$(id -u)" != 0 ]; then + echo 'Error: Please run as root (sudo etc.)' + exit -1 +fi + +INPUT_ARGS=${@//[]/-} # replace bizarre minuses with normal one + +./trex-cfg $INPUT_ARGS +RESULT=$? +if [ $RESULT -ne 0 ]; then + exit $RESULT +fi + +pci_desc_re='^(\S+) - (.+)$' +source find_python.sh +while read line +do + if [[ "$line" =~ $pci_desc_re ]]; then + pci_name="pci$(echo ${BASH_REMATCH[1]} | tr ':' '_' | tr '.' '_')" # make alphanumeric name + export $pci_name="${BASH_REMATCH[2]}" + fi +done <<< "$($PYTHON dpdk_setup_ports.py --dump-pci-description)" + +cd $(dirname $0) +export LD_LIBRARY_PATH=$PWD + +#Add dummy lib in case we don't find it, e.g. there is no OFED installed +if ldd ./_t-rex-64 | grep "libibverbs.so" | grep -q "not found"; then +export LD_LIBRARY_PATH=$PWD:$PWD/dumy_libs +fi + +export VALGRIND_LIB=/auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/lib/valgrind + +if [ -t 0 ] && [ -t 1 ]; then + export is_tty=true + saveterm="$(stty -g)" +else + export is_tty=false +fi + +# if we have a new core run optimized trex +if grep -q avx /proc/cpuinfo ; then + /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64 $INPUT_ARGS + RESULT=$? + if [ $RESULT -eq 132 ]; then + echo " WARNING this program is optimized for the new Intel processors. " + echo " try the ./t-rex-64-o application that should work for any Intel processor but might be slower. " + echo " try to run t-rex-64-o .. " + /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64-o $INPUT_ARGS + RESULT=$? + fi +else + /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64-o $INPUT_ARGS + RESULT=$? +fi + +if $is_tty; then + stty $saveterm +fi + +if [ $RESULT -ne 0 ]; then + exit $RESULT +fi + + |