line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
31
|
|
|
31
|
|
824217
|
use utf8; |
|
31
|
|
|
|
|
155
|
|
|
31
|
|
|
|
|
205
|
|
2
|
31
|
|
|
31
|
|
1069
|
use strict; |
|
31
|
|
|
|
|
67
|
|
|
31
|
|
|
|
|
786
|
|
3
|
31
|
|
|
31
|
|
235
|
use warnings; |
|
31
|
|
|
|
|
65
|
|
|
31
|
|
|
|
|
1205
|
|
4
|
|
|
|
|
|
|
|
5
|
31
|
|
|
31
|
|
246
|
use feature 'state'; |
|
31
|
|
|
|
|
62
|
|
|
31
|
|
|
|
|
3573
|
|
6
|
|
|
|
|
|
|
package DR::Tnt::Test; |
7
|
31
|
|
|
31
|
|
12184
|
use DR::Tnt::Test::TntInstance; |
|
31
|
|
|
|
|
114
|
|
|
31
|
|
|
|
|
1147
|
|
8
|
31
|
|
|
31
|
|
243
|
use IO::Socket::INET; |
|
31
|
|
|
|
|
66
|
|
|
31
|
|
|
|
|
251
|
|
9
|
31
|
|
|
31
|
|
17171
|
use Test::More; |
|
31
|
|
|
|
|
78
|
|
|
31
|
|
|
|
|
386
|
|
10
|
31
|
|
|
31
|
|
10263
|
use base qw(Exporter); |
|
31
|
|
|
|
|
87
|
|
|
31
|
|
|
|
|
25915
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw( |
12
|
|
|
|
|
|
|
free_port |
13
|
|
|
|
|
|
|
tarantool_version |
14
|
|
|
|
|
|
|
tarantool_version_check |
15
|
|
|
|
|
|
|
start_tarantool |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub tarantool_version() { |
20
|
|
|
|
|
|
|
|
21
|
30
|
|
|
0
|
0
|
316
|
local $SIG{__WARN__} = sub { }; |
|
|
|
|
30
|
|
|
|
22
|
30
|
50
|
|
|
|
79910
|
if (open my $fh, '-|', 'tarantool', '-V') { |
23
|
0
|
|
|
|
|
0
|
my $v = <$fh>; |
24
|
0
|
0
|
|
|
|
0
|
return undef unless $v =~ /^Tarantool\s+(\S+)/; |
25
|
0
|
|
|
|
|
0
|
return $1; |
26
|
|
|
|
|
|
|
} |
27
|
30
|
|
|
|
|
3280
|
return undef; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub tarantool_version_check($) { |
32
|
29
|
|
|
29
|
0
|
135089
|
my ($version) = @_; |
33
|
29
|
|
50
|
|
|
134
|
$version ||= '1.6'; |
34
|
|
|
|
|
|
|
|
35
|
29
|
|
|
|
|
89
|
my $v = tarantool_version; |
36
|
|
|
|
|
|
|
|
37
|
29
|
50
|
|
|
|
619
|
goto FAIL unless $v; |
38
|
0
|
|
|
|
|
0
|
my @p = split /\./, $version; |
39
|
0
|
|
|
|
|
0
|
$v =~ s/-.*//; |
40
|
0
|
|
|
|
|
0
|
my @v = split /\./, $v; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
for (my $i = 0; $i < @p; $i++) { |
43
|
0
|
0
|
|
|
|
0
|
last unless $i < @v; |
44
|
0
|
0
|
|
|
|
0
|
goto OK if $v[$i] > $p[$i]; |
45
|
0
|
0
|
|
|
|
0
|
goto FAIL unless $v[$i] >= $p[$i]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
0
|
goto FAIL unless @v >= @p; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
0
|
OK: |
51
|
|
|
|
|
|
|
return; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
FAIL: { |
54
|
29
|
|
|
|
|
302
|
my $tb = Test::More->builder; |
|
29
|
|
|
|
|
1365
|
|
55
|
29
|
|
|
|
|
1785
|
my @passed = $tb->details; |
56
|
29
|
|
|
|
|
15840
|
for (my $i = @passed; $i < $tb->expected_tests; $i++) { |
57
|
1243
|
|
|
|
|
952784
|
$tb->skip("tarantool $version is not found"); |
58
|
|
|
|
|
|
|
} |
59
|
29
|
|
|
|
|
90900
|
exit; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub free_port() { |
67
|
2
|
|
|
2
|
0
|
94
|
state $busy_ports = {}; |
68
|
2
|
|
|
|
|
5
|
while( 1 ) { |
69
|
2
|
|
|
|
|
37
|
my $port = 10000 + int rand 30000; |
70
|
2
|
50
|
|
|
|
12
|
next if exists $busy_ports->{ $port }; |
71
|
2
|
50
|
|
|
|
25
|
next unless IO::Socket::INET->new( |
|
|
50
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Listen => 5, |
73
|
|
|
|
|
|
|
LocalAddr => '127.0.0.1', |
74
|
|
|
|
|
|
|
LocalPort => $port, |
75
|
|
|
|
|
|
|
Proto => 'tcp', |
76
|
|
|
|
|
|
|
(($^O eq 'MSWin32') ? () : (ReuseAddr => 1)), |
77
|
|
|
|
|
|
|
); |
78
|
2
|
|
|
|
|
934
|
return $busy_ports->{ $port } = $port; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub start_tarantool { |
83
|
0
|
|
|
0
|
0
|
|
my %opts = @_; |
84
|
0
|
|
|
|
|
|
$opts{-port} = free_port; |
85
|
0
|
|
|
|
|
|
DR::Tnt::Test::TntInstance->new(%opts); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |