From f82116d8069b5863c5ac1ece818e0c545bab7fb1 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 23 Sep 2004 00:01:22 +0000 Subject: [PATCH] Half implemented new report -- look for illegal symbols in the compiled libraries and compononents. Still to do: - check components - send mail if it finds anything wrong - check multiple installation directories (?) This commit was SVN r2811. --- contrib/nightly/illegal_symbols_report.pl | 93 +++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 contrib/nightly/illegal_symbols_report.pl diff --git a/contrib/nightly/illegal_symbols_report.pl b/contrib/nightly/illegal_symbols_report.pl new file mode 100644 index 0000000000..e6068129e0 --- /dev/null +++ b/contrib/nightly/illegal_symbols_report.pl @@ -0,0 +1,93 @@ +#!/usr/bin/env perl +# +# $HEADER$ +# +# Look for public symbols in Open MPI libraries and components that +# are "bad" +# + +use strict; +use Data::Dumper; + +my $prefix = $ARGV[0]; +if (! $prefix) { + die "Must supply the prefix to an Open MPI installation"; +} + +# Filenames of libraries to look through + +my @lib_prefixes = ("libmpi", "libmca" ); +my @lib_suffixes = ('\.so', '\.a'); + +# Filenames of components to look through + +my @comp_prefixes = ("mca_"); +my @comp_suffices = (".so"); + +# Acceptable public symbol prefixes + +my @acceptable = ("ompi_" , "mpi_", "MPI_", "OMPI_", "MPI::", "PMPI_", "PMPI::", "mca_", "lt_" ); + +# Troll through the library directory + +my $libdir = "$prefix/lib"; +if (! -d $libdir) { + die "libdir does not exist: $libdir"; +} +opendir(LIB, $libdir) || die "Unable to open libdir: $libdir"; +my @dir_files = readdir(LIB); +closedir(LIB); + +# Ok, not efficient. Sue me. :-) +# Find all the matching files + +my @found_files; +foreach my $prefix (@lib_prefixes) { + foreach my $suffix (@lib_suffixes) { + foreach my $file (@dir_files) { + if ($file =~ /^$prefix.*$suffix$/) { + push(@found_files, $file); + } + } + } +} + +# Run nm on each of those files looking for global symbols with "bad" +# names + +my @found_symbols; +foreach my $file (@found_files) { + open NM, "nm -l -C $libdir/$file|"; + while () { + chomp; + my ($bogus1, $scope, $symbol, $location) = split(/[ \t]+/, $_); + if ($scope =~ /[A-Z]/ && + $scope !~ /[UVW]/ && + $symbol !~ /^_/) { + push(@found_symbols, { + file => $file, + symbol => $symbol, + scope => $scope, + location => $location, + }); + } + } +} + +# Now list all the bad ones + +my $ok; +foreach my $symbol (@found_symbols) { + $ok = 0; + foreach my $prefix (@acceptable) { + if ($symbol->{symbol} =~ /^$prefix/) { + $ok = 1; + } + } + if (! $ok) { + print "$symbol->{file}: $symbol->{symbol}\n"; + if ($symbol->{location}) { + print " --> $symbol->{location}\n"; + } + } +}