From: Subrata <ris...@li...> - 2010-05-12 16:39:41
|
The branch, master, has been updated via 440fa0f6d857d4a15802b5ecdfdf6057e59975bf (commit) via bd9d440be1da8020c93ac92e497e3a16e66e9fa3 (commit) from 0ce709315c3f2493d8ff97d574641cb91f1b1fa6 (commit) - Log ----------------------------------------------------------------- commit 440fa0f6d857d4a15802b5ecdfdf6057e59975bf Author: Subrata Modak <sub...@su...> Date: Wed May 12 22:07:14 2010 +0530 Add an Option '-K' to Create dmesg logs for each test: Recently while running LTP , i found that the system had generated many kernel messages worth investigating. However, there was a loose gap to find out which test exactly was responsible for that message. So, i thought it could be worth to create a framework in LTP to log kernel messages for each test, to pinpoint exact messages created per test, for better debugging. The following patch adds a option to LTP and runs a old style script ;-) to achieve that. All this is done at the runltp level without any distrubance to ltp-pan. Messages can be logged at: 1) Absolute path(s) as specified by the user, else 2) Inside $LTPROOT/output/ Comments welcome. Signed-off-by: Subrata Modak <su...@li...> commit bd9d440be1da8020c93ac92e497e3a16e66e9fa3 Author: Subrata Modak <sub...@su...> Date: Wed May 12 22:03:21 2010 +0530 Add an Option '-K' to Create dmesg logs for each test: Recently while running LTP , i found that the system had generated many kernel messages worth investigating. However, there was a loose gap to find out which test exactly was responsible for that message. So, i thought it could be worth to create a framework in LTP to log kernel messages for each test, to pinpoint exact messages created per test, for better debugging. The following patch adds a option to LTP and runs a old style script ;-) to achieve that. All this is done at the runltp level without any distrubance to ltp-pan. Messages can be logged at: 1) Absolute path(s) as specified by the user, else 2) Inside $LTPROOT/output/ Comments welcome. Signed-off-by: Subrata Modak <su...@li...>, ----------------------------------------------------------------------- Summary of changes: runltp | 22 +++++- ...ck.pl => create_dmesg_entries_for_each_test.pl} | 78 ++++++-------------- 2 files changed, 44 insertions(+), 56 deletions(-) copy tools/{create_valgrind_check.pl => create_dmesg_entries_for_each_test.pl} (56%) mode change 100755 => 100644 diff --git a/runltp b/runltp index 36986af..07994e9 100755 --- a/runltp +++ b/runltp @@ -131,6 +131,8 @@ usage() -h Help. Prints all available options. -i NUM_PROCS Run LTP under additional background Load on IO Bus [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()] + -K DMESG_LOG_DIR + Log Kernel messages generated for each test cases inside this directory -l LOGFILE Log results of test in a logfile. -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG Run LTP under additional background Load on Main memory (Seperate by comma) @@ -178,6 +180,7 @@ main() local ALT_DIR_RES=0 local ALT_HTML_OUT=0 local ALT_EMAIL_OUT=0 + local ALT_DMESG_OUT=0 local RUN_NETEST=0 local RUN_REPEATED=0 local QUIET_MODE="" @@ -198,6 +201,7 @@ main() local OUTPUTFILE="" local HTMLFILE_NAME="" local HTMLFILE="" + local DMESG_DIR="" local EMAIL_TO="" local SCENFILES="" local TAG_RESTRICT_STRING="" @@ -205,7 +209,7 @@ main() local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"` version_date=$(cat "$LTPROOT/Version") - while getopts a:c:C:d:D:f:F:ehi:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg + while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg do case $arg in a) EMAIL_TO=$OPTARG ALT_EMAIL_OUT=1;; @@ -308,6 +312,15 @@ main() $LTPROOT/testcases/bin/genload --io $NUM_PROCS >/dev/null 2>&1 & GENLOAD=1 ;; + K) + case $OPTARG in + /*) + DMESG_DIR="$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; + *) + DMESG_DIR="$LTPROOT/output/$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; + esac + mkdir -p $DMESG_DIR + ALT_DMESG_OUT=1;; l) LOGFILE_NAME="$OPTARG" case $OPTARG in @@ -821,6 +834,13 @@ main() fi fi + if [ $ALT_DMESG_OUT -eq 1 ] ; then + #We want to print dmesg output for each test,lets do the trick inside the script + echo Enabling dmesg output logging for each test... + ${LTPROOT}/bin/create_dmesg_entries_for_each_test.pl ${TMP}/alltests $DMESG_DIR > ${TMP}/alltests.tmp + cp ${TMP}/alltests.tmp ${TMP}/alltests + rm -rf ${TMP}/alltests.tmp + fi # Some tests need to run inside the "bin" directory. cd "${LTPROOT}/testcases/bin" "${LTPROOT}/bin/ltp-pan" $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE diff --git a/tools/create_valgrind_check.pl b/tools/create_dmesg_entries_for_each_test.pl old mode 100755 new mode 100644 similarity index 56% copy from tools/create_valgrind_check.pl copy to tools/create_dmesg_entries_for_each_test.pl index 41ed93e..afb487f --- a/tools/create_valgrind_check.pl +++ b/tools/create_dmesg_entries_for_each_test.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ################################################################################ ## ## -## Copyright (c) International Business Machines Corp., 2009 ## +## Copyright (c) International Business Machines Corp., 2010 ## ## ## ## This program is free software; you can redistribute it and/or modify ## ## it under the terms of the GNU General Public License as published by ## @@ -19,62 +19,30 @@ ## ## ################################################################################ # ## -# File : create_valgrind_check ## +# File : create_dmesg_entries_for_each_test.pl ## # ## -# Usage: create_valgrind_check\ ## -# <LTP_COMMAND_FILE> <VALGRIND_CHECK_TYPE> ## +# Usage: create_dmesg_entries_for_each_test.pl\ ## +# <LTP_COMMAND_FILE> <DMESG_DIRECTORY> ## # ## # Description: This is a simple perl script which will take ltp command file ## -# as input and then create a final command file while will have ## +# as input and then create a final command file which will have ## # the following entries for each test tag: ## -# 1) <tag_name> <test_binary_name> ## -# 2) <tag_name_valgrind_check_type> <valgrind test_binary_name> ## +# <tag_name__with_dmesg_entry> <test_binary_name>;\ ## +# <save_dmesg_logs> ## # ## # Author: Subrata Modak <su...@li...> ## # ## -# History: Aug 23 2009 - Created - Subrata Modak. ## +# History: May 09 2010 - Created - Subrata Modak. ## ################################################################################ my $command_file = shift (@ARGV) || syntax(); -my $valgrind_check_type = shift (@ARGV) || syntax(); +my $dmesg_dir = shift (@ARGV) || syntax(); sub syntax() { - print "syntax: create_valgrind_check\ - <LTP_COMMAND_FILE> <VALGRIND_CHECK_TYPE>\n"; + print "syntax: create_dmesg_entries_for_each_test.pl <LTP_COMMAND_FILE> <DMESG_DIRECTORY>\n"; exit (1); } -sub print_memory_leak_check { - $sub_line = shift; - @sub_tag_and_actual_command = split(/\ /, $sub_line); - my $sub_token_counter = 0; - foreach my $sub_token (@sub_tag_and_actual_command) { - if ($sub_token_counter == 0 ) {#print the tagname now - print $sub_token . "_valgrind_memory_leak_check " . - " valgrind -q --leak-check=full --trace-children=yes "; - $sub_token_counter++; - next; - } - print " " . $sub_token . " "; - } - print "\n"; -} - -sub print_thread_concurrency_check { - $sub_line = shift; - @sub_tag_and_actual_command = split(/\ /, $sub_line); - my $sub_token_counter = 0; - foreach my $sub_token (@sub_tag_and_actual_command) { - if ($sub_token_counter == 0 ) {#print the tagname now - print $sub_token . "_valgrind_thread_concurrency_check " . - " valgrind -q --tool=helgrind --trace-children=yes "; - $sub_token_counter++; - next; - } - print " " . $sub_token . " "; - } - print "\n"; -} open (FILE, $command_file) || die "Cannot open file: $command_file\n"; while ($line = <FILE>) { @@ -86,21 +54,21 @@ while ($line = <FILE>) { next; } chomp $line; - print "$line\n"; #Print one instance for normal execution + @tag_and_actual_command = split(/\ /, $line); - if ($valgrind_check_type == 3) { - #Print for both Memory Leak and Thread Concurrency Checks - print_memory_leak_check($line); - print_thread_concurrency_check($line); - } - if ($valgrind_check_type == 2) { - #Print only for Thread concurrency Check - print_thread_concurrency_check($line); - } - if ($valgrind_check_type == 1) { - #Print only for Memory leak Check - print_memory_leak_check($line); + my $token_counter = 0; + my $tag_name = ""; + foreach my $token (@tag_and_actual_command) { + if ($token_counter == 0 ) { + print $token . "__with_dmesg_entry" . " "; + print "dmesg -c 1>/dev/null 2>/dev/null;" . " "; + $token_counter++; + $tag_name = $token; + next; + } + print " " . $token . " "; } + print "; dmesg > $dmesg_dir/$tag_name.dmesg.log \n"; } close (FILE); hooks/post-receive -- ltp |