Test-Smoke

 view release on metacpan or  search on metacpan

lib/Test/Smoke/BuildCFG.pm  view on Meta::CPAN

=back

=cut

sub _parse {
    my $self = shift;

    return unless defined $self->{_buildcfg}; # || $self->{_list};

    $self->{_sections} = [ ];
    my @sections = split m/^=.*\n/m, $self->{_buildcfg};
    $self->log_debug("Found %d raw-sections", scalar @sections);

    foreach my $section ( @sections ) {
        chomp $section;
        my $index = 0;
        my %opts = map { s/^\s+$//; $_ => $index++ }
            grep !/^#/ => split /\n/, $section, -1;
        # Skip empty sections
        next if (keys %opts == 0) or (exists $opts{ "" } and keys %opts == 1);

lib/Test/Smoke/FTPClient.pm  view on Meta::CPAN

=head2 __time_from_windows( $date, $time )

This takes the two date/time related columns from the C<dir> output
and returns a localtime-stamp

=cut

sub __time_from_windows {
    my( $date, $time ) = @_;

    my( $day, $month, $year ) = split m/-/, $date;
    $month--;
    my( $hour, $minutes, $off )     = $time =~ m/(\d+):(\d+)([ap])m/i;
    $off && lc $off eq 'p' and $hour += 12;

    require Time::Local;
    return Time::Local::timelocal( 0, $minutes, $hour, $day, $month, $year );
}

1;

lib/Test/Smoke/Reporter.pm  view on Meta::CPAN


    $self->{_rpt}    = \my %rpt;
    $self->{_cache}  = {};
    $self->{_mani}   = [];
    $self->{configs} = \my @new;
    return $self unless defined $self->{_outfile};

    my ($cfgarg, $debug, $tstenv, $start, $statarg, $fcnt);
    $rpt{count} = 0;
    # reverse and use pop() instead of using unshift()
    my @lines           = reverse split m/\n+/, $self->{_outfile};
    my $previous        = "";
    my $previous_failed = "";

    while (defined (local $_ = pop @lines)) {
        m/^\s*$/ and next;
        m/^-+$/  and next;
        s/\s*$//;

        if (my ($status, $time) = /(Started|Stopped) smoke at (\d+)/) {
            if ($status eq "Started") {

lib/Test/Smoke/Reporter.pm  view on Meta::CPAN

            );
            push @{$rpt{cfglist}}, $_ unless $rpt{config}->{$cfgarg}++;
            $tstenv          = "";
            $previous_failed = "";
            next;
        }

        if (my ($cinfo) = /^Compiler info: (.+)$/) {
            $rpt{$cfgarg}->{cinfo} = $cinfo;
            $rpt{cinfo} ||= $cinfo;
            @{$new[-1]}{qw( cc ccversion )} = split m/ version / => $cinfo, 2;
            next;
        }

        if (m/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/
              # skip this if it's from a build failure, since the
              # Unable to build... pushed an M
              && (!@{$new[-1]{results}}
                  || $new[-1]{results}[0]{summary} ne "M")) {
            $tstenv          = $1;
            $previous_failed = "";
            $rpt{$cfgarg}->{summary}{$debug}{$tstenv} ||= "?";
            my ($io_env, $locale) = split m/:/ => $tstenv,
                2;
            push(
                @{$new[-1]{results}},
                {
                    io_env        => $io_env,
                    locale        => $locale,
                    summary       => "?",
                    statistics    => undef,
                    stat_tests    => undef,
                    stat_cpu_time => undef,

lib/Test/Smoke/Reporter.pm  view on Meta::CPAN

sub smokedb_data {
    my $self = shift;
    $self->log_info("Gathering CoreSmokeDB information...");

    my %rpt  = map { $_ => $self->{$_} } keys %$self;
    $rpt{manifest_msgs}   = delete $rpt{_mani};
    $rpt{applied_patches} = [$self->registered_patches];
    $rpt{sysinfo}         = do {
        my %Conf = get_smoked_Config($self->{ddir} => qw( version lfile ));
        my $si = System::Info->new;
        my ($osname, $osversion) = split m/ - / => $si->os, 2;
        (my $ncpu      = $si->ncpu          || "?") =~ s/^\s*(\d+)\s*/$1/;
        (my $user_note = $self->{user_note} || "")  =~ s/(\S)[\s\r\n]*\z/$1\n/;
        {
            architecture     => lc $si->cpu_type,
            config_count     => $self->{_rpt}{count},
            cpu_count        => $ncpu,
            cpu_description  => $si->cpu,
            duration         => $self->{_rpt}{secs},
            git_describe     => $self->{_rpt}{patchdescr},
            git_id           => $self->{_rpt}{patch},

lib/Test/Smoke/SourceTree.pm  view on Meta::CPAN


C<mani2abs()> returns the absolute filename of C<$file>, which should
be in "MANIFEST" format (i.e. using '/' as directory separator).

=cut

sub mani2abs {
    my $self = shift;

    my $path = shift;
    my @dirs = split m{/+}, $path;
    my $file = pop @dirs;
    if ( $^O eq 'VMS' ) {
        my @parts = split m/\./, $file;
        my $last = pop @parts;
        @parts and
            $file = join( "_", map { s/[^\w-]/_/g; $_ } @parts ) . ".$last";
    }
    @dirs and $file = join '/', @dirs, $file;
    my @split_path = split m|/|, $file;
    my $base_path = File::Spec->rel2abs( $self->tree_dir, @_ );
    return File::Spec->catfile( $base_path, @split_path );
}

=head2 $tree->mani2absdir( $dir[, $base_path] )

C<mani2abs()> returns the absolute dirname of C<$dir>, which should
be in "MANIFEST" format (i.e. using '/' as directory separator).

=cut

sub mani2absdir {
    my $self = shift;

    my @split_path = split m|/|, shift;
    my $base_path = File::Spec->rel2abs( $self->tree_dir, @_ );
    return File::Spec->catdir( $base_path, @split_path );
}

=head2 $tree->abs2mani( $file )

C<abs2mani()> returns the MANIFEST style filename.

=cut

lib/Test/Smoke/SourceTree.pm  view on Meta::CPAN

    local *MANIFEST;
    open MANIFEST, "< $manifile" or do {
        $no_croak and return { };
        croak( "Can't open '$manifile': $!" );
    };

    my %manifest = map {
        m|(\S+)|;
        my $entry = $NOCASE ? uc $1 : $1;
        if ( $^O eq 'VMS' ) {
            my @dirs = split m|/|, $entry;
            my $file = pop @dirs;
            my @parts = split /[.@#]/, $file;
            if ( @parts > 1 ) {
                my $ext = ( pop @parts ) || '';
                $file = join( "_", @parts ) . ".$ext";
            }
            $entry = @dirs ? join( "/", @dirs, $file ) : $file;
        }
        ( $entry => ST_MISSING );
    } <MANIFEST>;

t/smoker.t  view on Meta::CPAN

                                                   48 50-54 56-60 62-66 68-72 74-78 80-84 86-
                                                   90 92-96 98-100
EOOUT

    is keys %inconsistent, 1, "One inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
Failed 2/2 test programs. 83/100 subtests failed.
../t/smoke/die....... Dubious, test returned 255 (wstat 65280, 0xff00)
 No subtests run 
../t/smoke/many...... Dubious, test returned 83 (wstat 21248, 0x5300)
 Failed 83/100 subtests 

Test Summary Report
-------------------
smoke/die.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255

t/smoker.t  view on Meta::CPAN

        Non-zero exit status: 83
EOOUT

    is keys %inconsistent, 1, "One inconsistent test result"
        or diag Dumper \%inconsistent;
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
Failed 2/2 test programs. 83/100 subtests failed.
../t/smoke/die....... Dubious, test returned 255 (wstat 65280, 0xff00)
 No subtests run 
../t/smoke/many...... Dubious, test returned 83 (wstat 21248, 0x5300)
 Failed 83/100 subtests 

Test Summary Report
-------------------
smoke/die (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255

t/smoker.t  view on Meta::CPAN

    ../t/smoke/many.t...........................................FAILED
        Non-zero exit status: 83
EOOUT

    is keys %inconsistent, 1, "One inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
op/test1.t .. # Looks like you planned 5 tests but ran 2.
op/test1.t .. Failed 3/5 subtests
        (1 TODO test unexpectedly succeeded)
op/test2.t .. # Looks like you planned 5 tests but ran 2.
op/test2.t .. Failed 3/5 subtests
        (1 TODO test unexpectedly succeeded)

Test Summary Report
-------------------
op/test1.t (Wstat: 0 Tests: 2 Failed: 0)

t/smoker.t  view on Meta::CPAN

        2
    ../t/op/test2.t.............................................FAILED
        Bad plan.  You planned 5 tests but ran 2.
EOOUT
    is keys %inconsistent, 0, "No inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
op/test1.t .. ok
op/test2.t .. ok
All tests successful.

Test Summary Report
-------------------
op/test1.t (Wstat: 0 Tests: 2 Failed: 0)
  TODO passed:   2
op/test2.t (Wstat: 0 Tests: 2 Failed: 0)
  TODO passed:   2

t/smoker.t  view on Meta::CPAN

    ../t/op/test2.t.............................................PASSED
        2
EOOUT
    # The inconsitent hash should not be updated: harness only detected passedd todo tests
    is keys %inconsistent, 2, "Two inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
op/test1.t .. # Failed at op/test1.t line 13
op/test1.t .. Failed 1/2 subtests
        (1 TODO test unexpectedly succeeded)
op/test2.t .. ok

Test Summary Report
-------------------
op/test1.t (Wstat: 0 Tests: 2 Failed: 1)
  Failed test:  1
  TODO passed:   2

t/smoker.t  view on Meta::CPAN

        2
EOOUT
    # ../t/op/test2.t did not fail under harness; it should still be in the %inconsitent hash
    is keys %inconsistent, 1, "One inconsistent test result";
}


{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
Extending failures with harness:
        op/test1.t
op/test1.t .. ok
All tests successful.

Test Summary Report
-------------------
op/test1.t (Wstat: 0 Tests: 2 Failed: 0)
  TODO passed:   2
Files=1, Tests=2,  0 wallclock secs ( 0.01 usr +  0.00 sys =  0.01 CPU)

t/smoker.t  view on Meta::CPAN

        2
EOOUT
    # ../t/op/test1.t did not fail under harness; it should still be in the %inconsitent hash
    is keys %inconsistent, 1, "One inconsistent test result";
}


{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
Extending failures with harness:
        op/test1.t
op/test1.t .. # Failed at op/test1.t line 12
op/test1.t .. Failed 1/2 subtests
        (1 TODO test unexpectedly succeeded)

Test Summary Report
-------------------
op/test1.t (Wstat: 0 Tests: 2 Failed: 1)
  Failed test:  1

t/smoker.t  view on Meta::CPAN

    ../t/op/test1.t.............................................PASSED
        2
EOOUT
    is keys %inconsistent, 0, "No inconsistent test result";
}


{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
Extending failures with harness:
        op/test1.t
        op/test2.t
op/test1.t .. ok
op/test2.t .. # Failed at op/test2.t line 13
op/test2.t .. Failed 1/2 subtests
        (1 TODO test unexpectedly succeeded)

Test Summary Report
-------------------

t/smoker.t  view on Meta::CPAN

        2
EOOUT
    # ../t/op/test1.t did not fail under harness; it should still be in the %inconsitent hash
    is keys %inconsistent, 1, "One inconsistent test result";
}


{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
op/test1.t .. # Failed at op/test1.t line 12
op/test1.t .. Failed 1/64 subtests
        (32 TODO tests unexpectedly succeeded)
op/test2.t .. # Looks like you planned 70 tests but ran 64.
op/test2.t .. Failed 6/70 subtests
        (32 TODO tests unexpectedly succeeded)
op/test3.t .. # Failed at op/test3.t line 12
# Failed at op/test3.t line 17
# Failed at op/test3.t line 23
# Failed at op/test3.t line 29

t/smoker.t  view on Meta::CPAN

    ../t/op/test5.t.............................................FAILED
        Bad plan.  You planned 75 tests but ran 64.
EOOUT
    is keys %inconsistent, 0, "No inconsistent test result";
}


{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
some_error at porting/diag.t line 11.
porting/diag.t .. skipped: (no reason given)

Test Summary Report
-------------------
porting/diag.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.02 CPU)
Result: FAIL
EOHO

t/smoker.t  view on Meta::CPAN

    is $harness_out, <<EOOUT, "Catch Test::Harness 3 output (Non-zero exit status)";
    ../t/porting/diag.t.........................................FAILED
        Non-zero exit status: 2
EOOUT
    is keys %inconsistent, 0, "No inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
some_error at porting/diag.t line 11.
porting/diag.t .. skipped: (no reason given)

Test Summary Report
-------------------
porting/diag.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.02 CPU)
Result: FAIL

t/smoker.t  view on Meta::CPAN

        Non-zero exit status: 2
    ../t/porting/diag.t.........................................FAILED
        No plan found in TAP output
EOOUT
    is keys %inconsistent, 0, "No inconsistent test result";
}

{
    my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
    isa_ok $smoker, 'Test::Smoke::Smoker';
    my @harness3_test = split m/\n/, <<'EOHO';
some_error at porting/diag.t line 11.
porting/diag.t .. skipped: (no reason given)

Test Summary Report
-------------------
porting/diag.t (Wstat: 512 Tests: 0 Failed: 0)
  unknown_harness_output_which_is_not_parseable
Files=1, Tests=0,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.02 CPU)
Result: FAIL
EOHO

t/syncer_ftpclient.t  view on Meta::CPAN

}
sub Net::FTP::login { return 1 }
sub Net::FTP::binary { return 1 }
sub Net::FTP::quit {return 1 }
sub Net::FTP::cwd { 
    my $self = shift;
    my $dir = shift;
    if ( $dir eq '/' ) {
        $self->{cwd} = $self->{root};
    } elsif ( $dir =~ s|^/|| ) {
        $self->{cwd} = File::Spec->catdir( $self->{root}, split m|[/]|, $dir );
    } else {
        $self->{cwd} = File::Spec->catdir( $self->{cwd}, split m|/|, $dir );
    }
#    print "# [NF][cwd $dir] $self->{cwd}\n";
}
sub Net::FTP::pwd {
    my $self = shift;
    File::Spec->abs2rel( $self->{cwd}, $self->{root} );
}
sub Net::FTP::ls { 
    my $self = shift;
    local *DLDIR;

t/tree.t  view on Meta::CPAN

    my $tree = Test::Smoke::SourceTree->new($tmpdir);
    isa_ok( $tree, 'Test::Smoke::SourceTree' );

    is( $tree->canonpath, File::Spec->canonpath( $path ) , "canonpath" );

    is( $tree->rel2abs, $path, "rel2abs" );
    my $rel = File::Spec->abs2rel( $path );
    is( $tree->abs2rel, $rel, "abs2rel" );

    is( $tree->mani2abs( 'win32/Makefile' ),
        File::Spec->catfile( $path, split m|/|, 'win32/Makefile' ),
        "mani2abs complex" );

}

SKIP: {
    eval { MANIFEST_from_dir($tmpdir) };
    $@ and skip $@, 3;

    my $tree = Test::Smoke::SourceTree->new($tmpdir);
    isa_ok( $tree, 'Test::Smoke::SourceTree' );



( run in 2.440 seconds using v1.01-cache-2.11-cpan-71847e10f99 )