CPAN-Reporter

 view release on metacpan or  search on metacpan

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

            if not CPAN::Reporter::History::_is_duplicate( $result );
    }
    else {
        _print_grade_msg($result->{make_cmd}, $result);
        if ( $result->{grade} ne 'pass' ) { _dispatch_report( $result ) }
    }
    return $result->{success};
}

sub grade_PL {
    my @args = @_;
    my $result = _init_result( 'PL', @args ) or return;
    _compute_PL_grade($result);
    if ( $result->{grade} eq 'discard' ) {
        $CPAN::Frontend->myprint(
            "\nCPAN::Reporter: test results were not valid, $result->{grade_msg}.\n\n",
            $result->{prereq_pm}, "\n",
            "Test report will not be sent"
        );
        CPAN::Reporter::History::_record_history( $result )
            if not CPAN::Reporter::History::_is_duplicate( $result );
    }
    else {
        _print_grade_msg($result->{PL_file} , $result);
        if ( $result->{grade} ne 'pass' ) { _dispatch_report( $result ) }
    }
    return $result->{success};
}

sub grade_test {
    my @args = @_;
    my $result = _init_result( 'test', @args ) or return;
    _compute_test_grade($result);
    if ( $result->{grade} eq 'discard' ) {
        $CPAN::Frontend->myprint(
            "\nCPAN::Reporter: test results were not valid, $result->{grade_msg}.\n\n",
            $result->{prereq_pm}, "\n",
            "Test report will not be sent"
        );
        CPAN::Reporter::History::_record_history( $result )
            if not CPAN::Reporter::History::_is_duplicate( $result );
    }
    else {
        _print_grade_msg( "Test", $result );
        _dispatch_report( $result );
    }
    return $result->{success};
}

sub record_command {
    my ($command, $timeout) = @_;

    # XXX refactor this!
    # Get configuration options
    if ( -r CPAN::Reporter::Config::_get_config_file() ) {
        my $config_obj = CPAN::Reporter::Config::_open_config_file();
        my $config;
        $config = CPAN::Reporter::Config::_get_config_options( $config_obj )
            if $config_obj;

        $timeout ||= $config->{command_timeout}; # might still be undef
    }

    my ($cmd, $redirect) = _split_redirect($command);

    # Teeing a command loses its exit value so we must wrap the command
    # and print the exit code so we can read it off of output
    my $wrap_code;
    if ( $timeout ) {
        $wrap_code = $^O eq 'MSWin32'
                   ? _timeout_wrapper_win32($cmd, $timeout)
                   : _timeout_wrapper($cmd, $timeout);
    }
    # if no timeout or timeout wrap code wasn't available
    if ( ! $wrap_code ) {
        my $safecmd = quotemeta($cmd);
        $wrap_code = << "HERE";
my \$rc = system("$safecmd");
my \$ec = \$rc == -1 ? -1 : \$?;
print "($safecmd exited with \$ec)\\n";
HERE
    }

    # write code to a tempfile for execution
    my $wrapper_name = _temp_filename( 'CPAN-Reporter-CW-' );
    my $wrapper_fh = IO::File->new( $wrapper_name, 'w' )
        or die "Could not create a wrapper for $cmd\: $!";

    $wrapper_fh->print( $wrap_code );
    $wrapper_fh->close;

    # tee the command wrapper
    my @tee_input = ( Probe::Perl->find_perl_interpreter, $wrapper_name );
    push @tee_input, $redirect if defined $redirect;
    my $tee_out;
    {
      # ensure autoflush if we can
      local $ENV{PERL5OPT} = _get_perl5opt() if _is_PL($command);
      $tee_out = tee_merged { system( @tee_input ) };
    }

    # cleanup
    unlink $wrapper_name unless $ENV{PERL_CR_NO_CLEANUP};

    my @cmd_output = split qr{(?<=$/)}, $tee_out;
    if ( ! @cmd_output ) {
        $CPAN::Frontend->mywarn(
            "CPAN::Reporter: didn't capture command results for '$cmd'\n"
        );
        return;
    }

    # extract the exit value
    my $exit_value;
    if ( $cmd_output[-1] =~ m{exited with} ) {
        ($exit_value) = $cmd_output[-1] =~ m{exited with ([-0-9]+)};
        pop @cmd_output;
    }

    # bail out on some errors
    if ( ! defined $exit_value ) {

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

  cpan> test File::Marker

If a distribution's tests fail, users will be prompted to edit the report to
add additional information that might help the author understand the failure.

=head1 UNDERSTANDING TEST GRADES

CPAN::Reporter will assign one of the following grades to the report:

=over

=item *

C<<< pass >>> -- distribution built and tested correctly

=item *

C<<< fail >>> --  distribution failed to test correctly

=item *

C<<< unknown >>> -- distribution failed to build, had no test suite or outcome was
inconclusive

=item *

C<<< na >>> --- distribution is not applicable to this platform andE<sol>or
version of Perl

=back

In returning results of the test suite to CPAN.pm, "pass" and "unknown" are
considered successful attempts to "make test" or "Build test" and will not
prevent installation.  "fail" and "na" are considered to be failures and
CPAN.pm will not install unless forced.

An error from Makefile.PLE<sol>Build.PL or makeE<sol>Build will also be graded as
"unknown" and a failure will be signaled to CPAN.pm.

If prerequisites specified in C<<< Makefile.PL >>> or C<<< Build.PL >>> are not available,
no report will be generated and a failure will be signaled to CPAN.pm.

=head1 PRIVACY WARNING

CPAN::Reporter includes information in the test report about environment
variables and special Perl variables that could be affecting test results in
order to help module authors interpret the results of the tests.  This includes
information about paths, terminal, locale, userE<sol>group ID, installed toolchain
modules (e.g. ExtUtils::MakeMaker) and so on.

These have been intentionally limited to items that should not cause harmful
personal information to be revealed -- it does I<not> include your entire
environment.  Nevertheless, please do not use CPAN::Reporter if you are
concerned about the disclosure of this information as part of your test report.

Users wishing to review this information may choose to edit the report
prior to sending it.

=head1 BUGS

Using command_timeout on Linux may cause problems. See
L<https://rt.cpan.org/Ticket/Display.html?id=62310>

Please report any bugs or feature using the CPAN Request Tracker.
Bugs can be submitted through the web interface at
L<http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Reporter>

When submitting a bug or request, please include a test-file or a patch to an
existing test-file that illustrates the bug or desired feature.

=head1 SEE ALSO

Information about CPAN::Testers:

=over

=item *

L<CPAN::Testers> -- overview of CPAN Testers architecture stack

=item *

L<http://www.cpantesters.org> -- project home with all reports

=item *

L<http://wiki.cpantesters.org> -- documentation and wiki

=back

Additional Documentation:

=over

=item *

L<CPAN::Reporter::Config> -- advanced configuration settings

=item *

L<CPAN::Reporter::FAQ> -- hints and tips

=back

=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan

=head1 SUPPORT

=head2 Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker
at L<https://github.com/cpan-testers/CPAN-Reporter/issues>.
You will be notified automatically of any progress on your issue.

=head2 Source Code

This is open source software.  The code repository is available for
public review and contribution under the terms of the license.

L<https://github.com/cpan-testers/CPAN-Reporter>



( run in 0.727 second using v1.01-cache-2.11-cpan-39bf76dae61 )