From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [kvm-unit-tests v3 4/4] scripts: pretty print stack traces Date: Fri, 4 Mar 2016 11:24:13 +0100 Message-ID: <20160304102413.GA3108@localhost.redhat.com> References: <1456867658-10937-1-git-send-email-pfeiner@google.com> <1457038116-3448-1-git-send-email-pfeiner@google.com> <1457038116-3448-5-git-send-email-pfeiner@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, pbonzini@redhat.com To: Peter Feiner Return-path: Received: from mx1.redhat.com ([209.132.183.28]:51010 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758986AbcCDKYX (ORCPT ); Fri, 4 Mar 2016 05:24:23 -0500 Content-Disposition: inline In-Reply-To: <1457038116-3448-5-git-send-email-pfeiner@google.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Mar 03, 2016 at 12:48:36PM -0800, Peter Feiner wrote: > Optionally pretty print stacks in test.log with 'run_tests.sh -p'. > > The script runs addresses through addr2line to get file names and line > numbers. Also prints out source code lines if files are available. > For example > > 0x004013f5: ac_test_exec at x86/access.c:818 > } > > ac_test_setup_pte(at, pool); > r = ac_test_do_access(at); > 0x004014dd: ac_test_run at x86/access.c:852 > ++tests; > > successes += ac_test_exec(&at, &pool); > } while (ac_test_bump(&at)); > 0x0040157d: main at x86/access.c:873 > printf("starting test\n\n"); > > r = ac_test_run(); > return r ? 0 : 1; > 0x0040028e: start64 at x86/cstart64.S:206 > lea __argv(%rip), %rsi > > call main > mov %eax, %edi > > Signed-off-by: Peter Feiner > --- > run_tests.sh | 10 ++++- > scripts/pretty_print_stacks.py | 89 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 97 insertions(+), 2 deletions(-) > create mode 100755 scripts/pretty_print_stacks.py > > diff --git a/run_tests.sh b/run_tests.sh > index 89e8f84..b6f2003 100755 > --- a/run_tests.sh > +++ b/run_tests.sh > @@ -1,6 +1,7 @@ > #!/bin/bash > > verbose="no" > +pretty="no" > > if [ ! -f config.mak ]; then > echo "run ./configure && make first. See ./configure -h" > @@ -18,6 +19,7 @@ Usage: $0 [-g group] [-h] [-v] > -g: Only execute tests in the given group > -h: Output this help text > -v: Enables verbose mode > + -p: Pretty print stack traces in test.log > > Set the environment variable QEMU=/path/to/qemu-system-ARCH to > specify the appropriate qemu binary for ARCH-run. > @@ -27,8 +29,9 @@ EOF > > RUNTIME_arch_run="./$TEST_DIR/run" > source scripts/runtime.bash > +log_redir=">> test.log" > > -while getopts "g:hv" opt; do > +while getopts "g:hvp" opt; do > case $opt in > g) > only_group=$OPTARG > @@ -40,13 +43,16 @@ while getopts "g:hv" opt; do > v) > verbose="yes" > ;; > + p) > + log_redir="> >(./scripts/pretty_print_stacks.py \$kernel >> test.log)" > + ;; What about the idea of turning this on by default, and only turning it off if it was configured off? drew