From: Michael Chase-S. <mc...@us...> - 2013-04-29 21:57:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "sfcb - Small Footprint CIM Broker". The branch, master has been updated via db944f053c40f167120207958f8217cf5ded39fb (commit) from e871329340110213d9978c0bccb2e28b86ecf11c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit db944f053c40f167120207958f8217cf5ded39fb Author: Michael Chase-Salerno <br...@li...> Date: Mon Apr 29 17:57:12 2013 -0400 [sfcb-tix:#40] Add valgrind test Moving to ABT only ----------------------------------------------------------------------- Summary of changes: configure.ac | 2 +- sfcb.init-none.in | 2 +- test/ABT/ABTScript | 17 ++++++++++++- test/ABT/parseVG.pl | 58 +++++++++++++++++++++++++++++++++++++++++++++ test/finaltest/parseVG.pl | 45 ---------------------------------- 5 files changed, 76 insertions(+), 48 deletions(-) diff --git a/configure.ac b/configure.ac index 0b903e9..9953c41 100644 --- a/configure.ac +++ b/configure.ac @@ -316,7 +316,7 @@ if [test "$enable_tests"]; then fi if [test "$test_valgrind" == "yes"]; then - PROFILER="$PROFILER valgrind --leak-check=full --xml=yes --xml-file=/tmp/sfcb-vgout.xml --child-silent-after-fork=yes" + PROFILER="$PROFILER touch /tmp/sfcb-suppressions \&\& valgrind --leak-check=full --log-file=/tmp/sfcb-vgout --trace-children=yes --suppressions=/tmp/sfcb-suppressions" AC_SUBST(PROFILER) KILLEXEC="-r memcheck.*" AC_SUBST(KILLEXEC) diff --git a/sfcb.init-none.in b/sfcb.init-none.in index 3f6cf8a..70b8a63 100644 --- a/sfcb.init-none.in +++ b/sfcb.init-none.in @@ -23,7 +23,7 @@ stop() { echo -n "Shutting down sfcb: " if killall KILLEXEC then - sleep 3 + sleep 5 # If it hasn't died gracefully, kill it if killall -KILL KILLEXEC 2>/dev/null then diff --git a/test/ABT/ABTScript b/test/ABT/ABTScript index e70cdca..14a7697 100755 --- a/test/ABT/ABTScript +++ b/test/ABT/ABTScript @@ -82,6 +82,12 @@ CVS_CHECK_OUT() SFCB_START() { + if [ -f /tmp/sfcb-vgout ] + then + rm /tmp/sfcb-vgout + fi + cp sfcb-vgsup.txt /tmp/ + /usr/local/etc/init.d/sfcb start if [ $? -eq 0 ] ; then DUALOUT "SFCB start : SUCCESS" @@ -110,7 +116,15 @@ SFCB_RESULTFILES() find . -name "*.result" -print0 | xargs -0 -r -I file cp file --target-directory=$RESULTDIR --parents fi } - +SFCB_VALGRIND() +{ + # Check the Valgrind output if it's there + if [ -f /tmp/sfcb-vgout ] + then + echo "Checking Valgrind output...." + ./parseVG.pl + fi +} SFCB_TESTS() { n=$((n+1)) # Keep track of test iteration @@ -220,6 +234,7 @@ BUILD_SFCB() DUALOUT "SECOND TEST RUN:" SFCB_TESTS SFCB_STOP + SFCB_VALGRIND SFCB_RESULTFILES else RC=1 diff --git a/test/ABT/parseVG.pl b/test/ABT/parseVG.pl new file mode 100755 index 0000000..c5256b8 --- /dev/null +++ b/test/ABT/parseVG.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use XML::Parser; +use XML::LibXML; + +my $vgfile="/tmp/sfcb-vgout"; +my $leakfile="./sfcbLeaks.txt"; +my %ht; +my $defCount=0; + +open VGO, '<', $vgfile or die "Can't open input file"; +my @contents = <VGO>; +close VGO; + +#Split the output by PID, which is the first token on +#each line +foreach my $line (@contents) +{ + my ($pid,$txt)=split(/ /,$line,2); + push(@{$ht{$pid}},$txt); +} + +#Prep the output file +open(LEAKFILE,">$leakfile"); + +#Look through the split up output for definite leaks +foreach my $pid(keys %ht) +{ + my $leakfound=0; + foreach my $line (@{$ht{$pid}}) + { + if ($leakfound && $line =~ /^$/){ + #Blank line ends the stanza + print LEAKFILE $line; + $leakfound=0; + } elsif ($leakfound) { + #Still in the stanza, keep printing + print LEAKFILE $line; + } elsif ($line =~ m/.*are definitely lost.*/){ + #Found a leak, print it and its stanza + #to the output file + print LEAKFILE $line; + $leakfound=1; + $defCount++; + } + } +} +close(LEAKFILE); + +# If we had any, note it and return the count, or 0 if none. +if ($defCount) { + print(" FAILED $defCount definite leaks. See $leakfile\n"); + exit($defCount); +} else { + print(" PASSED no definite leaks.\n"); + unlink($leakfile); + exit(0); +} diff --git a/test/finaltest/parseVG.pl b/test/finaltest/parseVG.pl deleted file mode 100755 index aae5820..0000000 --- a/test/finaltest/parseVG.pl +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl - -use XML::Parser; -use XML::LibXML; - -my $xmlfile="/tmp/sfcb-vgout.xml"; - -open XML, '<', $xmlfile or die "Can't open input file"; -my @contents = <XML>; -close XML; - -@contents = grep(!/\/valgrindoutput/,@contents); -push(@contents,"</valgrindoutput>"); - -# Slurp and parse the valgrind xml output -#$dom = XML::LibXML->load_xml(@contents); -$dom = XML::LibXML->load_xml( -# location => "/tmp/sfcb-vgout.xml" - string => join(' ',@contents) - ); -#Prep the output file -my $leakfile="./sfcbLeaks.xml"; -open(LEAKFILE,">$leakfile"); - -# Spin through the xml output looking for definite leaks -my $defCount=0; -foreach my $ele ($dom->findnodes('/valgrindoutput/error')) { - my($kind) = $ele->findnodes('./kind'); - if ($kind =~ m/Leak_DefinitelyLost/) { - print LEAKFILE "$ele\n"; - $defCount++; - } - } - -# If we had any, note it and return bad -if ($defCount) { - close(LEAKFILE); - print(" FAILED $defCount definite leaks. See $leakfile\n"); - exit($defCount); -} - -# If no leaks, cleanup -unlink($leakfile); -close(LEAKFILE); -exit(0); hooks/post-receive -- sfcb - Small Footprint CIM Broker |