Receiver.pm

filter: Statementstmt 87.0% 47 / 54 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 14 / 16 Podpod 100% 1 / 1 totaltotal 86.3% 63 / 73 CC 2 SCAR 2.4
CC
2
Cov
86%
__ANON__
2.3
__ANON__
2.0
__ANON__
2.0
CRAP 1.3
« Receiver/Util.pm ↑ Summary
1 package Tapper::Reports::Receiver;
2 # git description: v5.0.0-2-g454017d
3  
4 9 our $AUTHORITY = 'cpan:TAPPER';
5 # ABSTRACT: Tapper - Receiver for Tapper test reports as TAP or TAP::Archive
6 9 $Tapper::Reports::Receiver::VERSION = '5.0.1';
7 9 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 9 ▶use AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use AnyEvent::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use AnyEvent::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 9 ▶use Tapper::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 ▶use Tapper::Reports::Receiver::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 9 with 'MooseX::Log::Log4perl';
21  
22  
23 sub run
24 {
25 5 ▶ my ($self, $bind_port) = @_;
Subroutine run: called CC=1 SCAR=0.4
Pod documented
26 5 my $condvar = AnyEvent->condvar;
27  
28 tcp_server undef, $bind_port, sub {
29 11 ▶ my ($fh, $host, $port) = @_;
Subroutine __ANON__: called CC=2 SCAR=8.3
30 11 ▶ return unless $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless $fh 0 11 11
31  
32 11 my $util = Tapper::Reports::Receiver::Util->new();
33 11 my $report_id = $util->start_new_report($host, $port);
34  
35 11 my $buffer;
36 my $hdl; $hdl = AnyEvent::Handle->new(
37 fh => $fh,
38 rtimeout => Tapper::Config->subconfig->{times}{receiver_timeout},
39 on_eof => sub {
40 0 ▶ my $tap = $hdl->rbuf;
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 0 $hdl->destroy;
42 0 $util->process_request( $tap );
43 },
44 ▶ on_read => sub {},
Subroutine __ANON__: called CC=1 SCAR=0.0
45 on_rtimeout => sub {
46 0 ▶ my $tap = $hdl->rbuf;
Subroutine __ANON__: not called CC=1 SCAR=6.9
47 0 $hdl->destroy;
48 0 $self->log->error('timeout reached for reading TAP');
49 0 $util->process_request( $tap );
50 },
51 on_error => sub {
52 11 ▶ my $tap = $hdl->rbuf;
Subroutine __ANON__: called CC=1 SCAR=0.0
53 11 $hdl->destroy;
54 11 $util->process_request( $tap );
55 },
56 11 );
57  
58 11 $hdl->push_write(
59 "Tapper::Reports::Receiver. ".
60 "Protocol is TAP. ".
61 "Your report id: $report_id".
62 "\n"
63 );
64 5 };
65 5 $condvar->recv;
66 }
67  
68 9 1; # End of Tapper::Reports::Receiver
69  
70 __END__
71  
72 =pod
73  
74 =encoding UTF-8
75  
76 =head1 NAME
77  
78 Tapper::Reports::Receiver - Tapper - Receiver for Tapper test reports as TAP or TAP::Archive
79  
80 =head2 run
81  
82 Execute the reports receiver.
83  
84 =head1 AUTHOR
85  
86 AMD OSRC Tapper Team <tapper@amd64.org>
87  
88 =head1 COPYRIGHT AND LICENSE
89  
90 This software is Copyright (c) 2016 by Advanced Micro Devices, Inc..
91  
92 This is free software, licensed under:
93  
94 The (two-clause) FreeBSD License
95  
96 =cut
« Receiver/Util.pm ↑ Summary