FAQ
Author: marvin
Date: Thu Dec 3 00:19:57 2009
New Revision: 886346

URL: http://svn.apache.org/viewvc?rev=886346&view=rev
Log:
Commit LUCY-80, adding a "test_valgrind" build target for Lucy's Perl
bindings.

Added:
lucene/lucy/trunk/devel/bin/
lucene/lucy/trunk/devel/bin/valgrind_triggers.pl (with props)
lucene/lucy/trunk/devel/conf/
lucene/lucy/trunk/devel/conf/lucyperl.supp
Modified:
lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm

Added: lucene/lucy/trunk/devel/bin/valgrind_triggers.pl
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/devel/bin/valgrind_triggers.pl?rev=886346&view=auto
==============================================================================
--- lucene/lucy/trunk/devel/bin/valgrind_triggers.pl (added)
+++ lucene/lucy/trunk/devel/bin/valgrind_triggers.pl Thu Dec 3 00:19:57 2009
@@ -0,0 +1,7 @@
+# This file is used by the test_valgrind build target to generate a list of
+# suppressions.
+use strict;
+use warnings;
+use Time::HiRes;
+use Data::Dumper; # triggers XSLoader
+

Propchange: lucene/lucy/trunk/devel/bin/valgrind_triggers.pl
------------------------------------------------------------------------------
svn:eol-style = native

Added: lucene/lucy/trunk/devel/conf/lucyperl.supp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/devel/conf/lucyperl.supp?rev=886346&view=auto
==============================================================================
--- lucene/lucy/trunk/devel/conf/lucyperl.supp (added)
+++ lucene/lucy/trunk/devel/conf/lucyperl.supp Thu Dec 3 00:19:57 2009
@@ -0,0 +1,161 @@
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_CB_new_from_trusted_utf8
+ fun:lucy_CB_clone
+ fun:lucy_Hash_make_key
+ fun:lucy_Hash_do_store
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:calloc
+ fun:lucy_Memory_wrapped_calloc
+ fun:lucy_VTable_make_obj
+ fun:lucy_Hash_new
+ fun:lucy_VTable_init_registry
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_Hash_do_store
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:calloc
+ fun:lucy_Memory_wrapped_calloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_CB_new_from_trusted_utf8
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+
+{
+ <Snowball XS constructor>
+ Memcheck:Leak
+ fun:calloc
+ fun:Perl_safesyscalloc
+ fun:XS_Lingua__Stem__Snowball__Stemmifier_new
+ fun:*
+}
+
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:calloc
+ fun:lucy_Memory_wrapped_calloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:lucy_Memory_wrapped_malloc
+ fun:lucy_CB_new_from_trusted_utf8
+ fun:lucy_Hash_store
+ fun:lucy_VTable_add_to_registry
+ fun:lucy_Lucy_bootstrap
+ fun:boot_Lucy
+ fun:*
+}
+
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:calloc
+ fun:lucy_Memory_wrapped_calloc
+ fun:lucy_Hash_do_store
+ fun:lucy_Hash_store
+ fun:lucy_VTable_singleton
+ fun:*
+}
+
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:calloc
+ fun:lucy_Memory_wrapped_calloc
+ fun:lucy_Hash_rebuild_hash
+ fun:*
+}
+

Modified: lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=886346&r1=886345&r2=886346&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm Thu Dec 3 00:19:57 2009
@@ -345,6 +345,102 @@
Devel::PPPort::WriteFile();
}

+sub ACTION_suppressions {
+ my $self = shift;
+ my $LOCAL_SUPP = 'local.supp';
+ return
+ if $self->up_to_date( '../devel/bin/valgrind_triggers.pl',
+ $LOCAL_SUPP );
+
+ # Generate suppressions.
+ print "Writing $LOCAL_SUPP...\n";
+ $self->add_to_cleanup($LOCAL_SUPP);
+ my $command
+ = "yes | "
+ . $self->_valgrind_base_command
+ . "--gen-suppressions=yes "
+ . $self->perl
+ . " ../devel/bin/valgrind_triggers.pl 2>&1";
+ my $suppressions = `$command`;
+ $suppressions =~ s/^==.*?\n//mg;
+ my $rule_number = 1;
+ while ( $suppressions =~ /<insert a.*?>/ ) {
+ $suppressions =~ s/^\s*<insert a.*?>/{\n <core_perl_$rule_number>/m;
+ $rule_number++;
+ }
+
+ # Write local suppressions file.
+ open( my $supp_fh, '>', $LOCAL_SUPP )
+ or confess("Can't open '$LOCAL_SUPP': $!");
+ print $supp_fh $suppressions;
+}
+
+sub _valgrind_base_command {
+ return
+ "PERL_DESTRUCT_LEVEL=2 LUCY_VALGRIND=1 valgrind "
+ . "--leak-check=yes "
+ . "--show-reachable=yes "
+ . "--num-callers=10 "
+ . "--suppressions=../devel/conf/lucyperl.supp ";
+}
+
+sub ACTION_test_valgrind {
+ my $self = shift;
+ die "Must be run under a perl that was compiled with -DDEBUGGING"
+ unless $Config{ccflags} =~ /-D?DEBUGGING\b/;
+ $self->dispatch('code');
+ $self->dispatch('suppressions');
+
+ # Unbuffer STDOUT, grab test file names and suppressions files.
+ $|++;
+ my $t_files = $self->find_test_files; # not public M::B API, may fail
+ my $valgrind_command = $self->_valgrind_base_command;
+ $valgrind_command .= "--suppressions=local.supp ";
+
+ if ( my $local_supp = $self->args('suppressions') ) {
+ for my $supp ( split( ',', $local_supp ) ) {
+ $valgrind_command .= "--suppressions=$supp ";
+ }
+ }
+
+ # Iterate over test files.
+ my @failed;
+ for my $t_file (@$t_files) {
+
+ # Run test file under Valgrind.
+ print "Testing $t_file...";
+ die "Can't find '$t_file'" unless -f $t_file;
+ my $command = "$valgrind_command $^X -Mblib $t_file 2>&1";
+ my $output = "\n" . ( scalar localtime(time) ) . "\n$command\n";
+ $output .= `$command`;
+
+ # Screen-scrape Valgrind output, looking for errors and leaks.
+ if ( $?
+ or $output =~ /ERROR SUMMARY:\s+[^0\s]/
+ or $output =~ /definitely lost:\s+[^0\s]/
+ or $output =~ /possibly lost:\s+[^0\s]/
+ or $output =~ /still reachable:\s+[^0\s]/ )
+ {
+ print " failed.\n";
+ push @failed, $t_file;
+ print "$output\n";
+ }
+ else {
+ print " succeeded.\n";
+ }
+ }
+
+ # If there are failed tests, print a summary list.
+ if (@failed) {
+ print "\nFailed "
+ . scalar @failed . "/"
+ . scalar @$t_files
+ . " test files:\n "
+ . join( "\n ", @failed ) . "\n";
+ exit(1);
+ }
+}
+
sub ACTION_compile_custom_xs {
my $self = shift;
my $xs_filepath = $self->xs_filepath;

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouplucy-commits @
categorieslucene
postedDec 3, '09 at 12:20a
activeDec 3, '09 at 12:20a
posts1
users1
websitelucene.apache.org

1 user in discussion

Marvin: 1 post

People

Translate

site design / logo © 2018 Grokbase