Virt/UNIXSocket.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond 76.9% 10 / 13 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 87.9% 51 / 58 CC 8 SCAR 16.8
CC
8
Cov
93%
socket_path
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« Virt/URI.pm ↑ Summary Virt/KeepAlive.pm »
1 ####################################################################
2 #
3 # This file was generated using XDR::Parse version v1.0.1,
4 # XDR::Gen version 1.1.2 and LibVirt version v12.9.0
5 #
6 # Don't edit this file, use the source template instead
7 #
8 # ANY CHANGES HERE WILL BE LOST !
9 #
10 ####################################################################
11  
12  
13 1 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 package Protocol::Sys::Virt::UNIXSocket v12.9.0;
17  
18 1 ▶use parent qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 our @EXPORT = qw( socket_path );
24  
25 14 ▶sub socket_path {
Subroutine socket_path: called CC=8 SCAR=20.9
Pod documented
26 14 my %args = @_;
27 14 ▶ my $path = $args{prefix} // '';
Condition100%2/2
$args{"prefix"} // ""
l!l
113
MC/DC100%1/1
$args{"prefix"} // ""
$args{"prefix"}
Truth table100%2/2
A
A= $args{"prefix"}
Aresult
11
00
28 14 $path .= '/run/libvirt';
29  
30 14 my $driver;
31 14 ▶ my $mode = $args{mode} // 'legacy';
Condition100%2/2
$args{"mode"} // "legacy"
l!l
68
MC/DC100%1/1
$args{"mode"} // "legacy"
$args{"mode"}
Truth table100%2/2
A
A= $args{"mode"}
Aresult
11
00
32 14 ▶ if ($mode eq 'direct' and ($args{hypervisor} // $args{driver})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode eq 'direct' and $args{'hypervisor'} // $args{'driver'}) { } 6 8 14
Condition66%4/6
$mode eq "direct" and $args{"hypervisor"} // $args{"driver"}
!ll&&!rl&&r
806
$args{"hypervisor"} // $args{"driver"}
l!l&&r!l&&!r
420
MC/DC33%1/3
$mode eq "direct" and $args{"hypervisor"} // $args{"driver"}
$mode eq "direct" $args{"hypervisor"} $args{"driver"}
Truth table75%3/4
A and B // C
A= $mode eq "direct"B= $args{"hypervisor"}C= $args{"driver"}
ABCresult
0XX0
1000
11X1
1011
33 6 ▶ $path .= '/virt' . ($args{hypervisor} // $args{driver}) . 'd-sock';
Condition66%2/3
$args{"hypervisor"} // $args{"driver"}
l!l&&r!l&&!r
420
MC/DC0%0/2
$args{"hypervisor"} // $args{"driver"}
$args{"hypervisor"} $args{"driver"}
Truth table66%2/3
A // B
A= $args{"hypervisor"}B= $args{"driver"}
ABresult
1X1
011
000
34 }
35 else {
36 8 $path .= '/libvirt-sock';
37 }
38 14 ▶ if ($args{readonly}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"readonly"}) 6 8 14
39 6 $path .= '-ro';
40 }
41  
42 14 return $path;
43 }
44  
45 1 1;
46  
47  
48 __END__
« Virt/URI.pm ↑ Summary Virt/KeepAlive.pm »