Test-Smoke-Database
view release on metacpan or search on metacpan
lib/Test/Smoke/Database.pm view on Meta::CPAN
# - Only rewrite cc if gcc. Else we lost solaris info
# - Remove ccache info for have less distinct compiler
# - Add another report to tests
# - Update FAQ.pod for last Test::Smoke version
# - Save only wanted headers for each nntp articles (and save From: field).
# - Move away last varchar field from builds to data
use Carp;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
use DBI;
use News::NNTPClient;
use Data::Dumper;
use Test::Smoke::Database::Graph;
use Test::Smoke::Database::DB;
use Test::Smoke::Database::Display;
use Test::Smoke::Database::Parsing;
use Carp qw(cluck);
use File::Basename;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
$VERSION = '1.17';
my $limite = 18600;
#$limite = 0;
#------------------------------------------------------------------------------
# new
#------------------------------------------------------------------------------
sub new($$) {
my $class = shift;
my $self = {};
bless $self, $class;
$self->{opts} = shift || {};
my $driver = "DBI:mysql:database=".($self->{opts}->{database} || 'test').
";host=localhost;port=3306";
if (!$self->{opts}->{no_dbconnect}) {
$self->{DBH} = DBI->connect($driver,
$self->{opts}->{user},
$self->{opts}->{password} || undef)
|| die "Can't connect to Mysql:$driver:$!\n";
}
if (defined($self->{opts}->{limit})) {
$self->{opts}->{limit} = 0 if ( $self->{opts}->{limit} eq 'All');
$limite = $self->{opts}->{limit};
} else { $limite = 0; }
$self->{DB} = new Test::Smoke::Database::DB($self);
$self->{HTML} = new Test::Smoke::Database::Display($self);
print scalar(localtime),
": New run with Test::Smoke::Database version $VERSION\n"
if ($self->{opts}->{verbose});
return $self;
}
#------------------------------------------------------------------------------
# db
#------------------------------------------------------------------------------
sub db(\%) { return $_[0]->{DB}; }
#------------------------------------------------------------------------------
# HTML
#------------------------------------------------------------------------------
sub HTML(\%) { return $_[0]->{HTML}; }
#------------------------------------------------------------------------------
# build_graph
#------------------------------------------------------------------------------
sub build_graph(\%) {
my $self = shift;
print scalar(localtime),": Create graph\n"
if ($self->{opts}->{verbose});
eval("use GD::Graph::mixed");
if ($@) {
print scalar(localtime),
": You don't seem to have GD::Graph, aborted graph\n"
if ($self->{opts}->{verbose});
return;
}
my $c = new CGI;
# Last 50 smoke
my $last50 = $self->db->last50;
# Begin, perl-5.9, last 50 smoke
my %limit = (0 =>'Since smoke 11613',
17500=>'Perl 5.9',
$last50=>'Last 50 smoke');
my %limit2 = %limit;
$limit2{cpan}= 'CPAN modules';
$limit2{"last50"}=$limit2{$last50};
delete $limit2{$last50};
foreach my $mt (keys %limit) {
my $mtx = $mt;
$mtx = "last50" if ($mt == $last50);
my $graph = new Test::Smoke::Database::Graph($self->{DBH}, $self,$mt, $mtx);
$graph->percent_configure();
$graph->percent_configure_all();
$graph->configure_per_os();
$graph->smoke_per_os();
$graph->configure_per_smoke();
$graph->os_by_smoke();
$graph->success_by_os();
$graph->create_html($mtx, \%limit2, $c);
}
my $graph = new Test::Smoke::Database::Graph($self->{DBH}, $self,undef, "cpan");
$graph->stats_cpan() &&
$graph->create_html("cpan", \%limit2, $c);
}
#------------------------------------------------------------------------------
# rename_rpt
#------------------------------------------------------------------------------
sub rename_rpt {
my $self = shift;
my $nb = 0;
print scalar(localtime),": Rename report with his nntp id\n"
if ($self->{opts}->{verbose});
( run in 2.283 seconds using v1.01-cache-2.11-cpan-524268b4103 )