Multiple revisions 350127-350128
authorRichard Mudgett <rmudgett@digium.com>
Mon, 9 Jan 2012 18:58:58 +0000 (18:58 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 9 Jan 2012 18:58:58 +0000 (18:58 +0000)
........
  r350127 | rmudgett | 2012-01-09 12:40:33 -0600 (Mon, 09 Jan 2012) | 12 lines

  Update contrib script live_ast to invoke Asterisk with valgrind and suppression file.

  * Added valgrind_compare script to compare two valgrind log files for
  differences.

  (issue ASTERISK-17339)
  Reported by: Tzafrir Cohen
  Patches:
        valgrind_compare (license #5035) script uploaded by Tzafrir Cohen
        live_ast_valgrind.diff (license #5035) patch uploaded by Tzafrir Cohen
        live_ast_valgrind_v2.diff (license #5185) patch uploaded by Paul Belanger
........
  r350128 | rmudgett | 2012-01-09 12:54:56 -0600 (Mon, 09 Jan 2012) | 11 lines

  live_ast: valgrind: run asterisk under valgrind

  Adds a new sub-command, "valgrind" to live_ast. It runs asterisk under
  valgrind. The extra command-line parameters are passed to Asterisk as
  usual, and parameters to valgrind are passed through LIVE_AST_VALGRIND_ARGS
  in live.conf .

  Review: https://reviewboard.asterisk.org/r/1109/

  Merged revisions 326636 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 350127-350128 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 350129 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350130 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/scripts/valgrind_compare [new file with mode: 0755]

diff --git a/contrib/scripts/valgrind_compare b/contrib/scripts/valgrind_compare
new file mode 100755 (executable)
index 0000000..9f814d4
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# compare_valgrind: diff two valgrinf memory usage logs. Masks out PIDs,
+# addresses and such that should normally be different.
+#
+# Usage: ./compare_valgrind file1.log file2.log | less
+#
+# (Requires /bin/bash due to usage of '<()' )
+
+log1="$1"
+log2="$2"
+
+pipe_log() {
+       sed \
+               -e 's/^--[0-9]\+-- //' -e 's/^==[0-9]\+== //' "$1" \
+               -e 's/ record [0-9]\+ of [0-9]\+$/ <snipped>/' \
+               -e 's/^ Address 0x[0-9a-f]\+/ Address 0x<snipped>/' \
+
+}
+
+diff -u -L "$log1" <(pipe_log "$log1") -L "$log2" <(pipe_log "$log2")