Browse Source

MT#55283 support checking receive port in tests

Fix up tests that had this broken due to typoes

Change-Id: I3753d2ed0f523747224285a1b7f2ea59bc2079f7
rfuchs/dtls-ice
Richard Fuchs 3 months ago
parent
commit
255754d5b4
4 changed files with 23 additions and 18 deletions
  1. +17
    -12
      perl/NGCP/Rtpengine/AutoTest.pm
  2. +1
    -1
      t/auto-daemon-tests-audio-player-play-media.pl
  3. +1
    -1
      t/auto-daemon-tests-audio-player.pl
  4. +4
    -4
      t/auto-daemon-tests-pubsub.pl

+ 17
- 12
perl/NGCP/Rtpengine/AutoTest.pm View File

@ -282,18 +282,23 @@ sub rcv {
($m) = unpack('N', $m);
}
}
if ($port == -1 && @matches) {
if (sockaddr_family($addr) == AF_INET) {
my @addr = unpack_sockaddr_in($addr) or die;
unshift(@matches, $addr[0], inet_ntoa($addr[1]));
}
elsif (sockaddr_family($addr) == AF_INET6) {
my @addr = unpack_sockaddr_in6($addr) or die;
unshift(@matches, $addr[0], inet_ntop(AF_INET6, $addr[1]));
}
else {
die;
}
my ($rport, $raddr);
if (sockaddr_family($addr) == AF_INET) {
my @addr = unpack_sockaddr_in($addr) or die;
($rport, $raddr) = ($addr[0], inet_ntoa($addr[1]));
}
elsif (sockaddr_family($addr) == AF_INET6) {
my @addr = unpack_sockaddr_in6($addr) or die;
($rport, $raddr) = ($addr[0], inet_ntop(AF_INET6, $addr[1]));
}
else {
die;
}
if ($port != -1) {
is($port, $rport, "receive port matches");
}
elsif ($port == -1 && @matches) {
unshift(@matches, $rport, $raddr);
}
return @matches;
}


+ 1
- 1
t/auto-daemon-tests-audio-player-play-media.pl View File

@ -186,7 +186,7 @@ a=sendrecv
a=rtcp:PORT
SDP
($seq_b, $ts_b, $ssrc_b) = rcv($sock_a, $port_b, rtpm(0 | 0x80, -1, -1, -1, "\xff" x 160));
(undef, undef, $seq_b, $ts_b, $ssrc_b) = rcv($sock_a, -1, rtpm(0 | 0x80, -1, -1, -1, "\xff" x 160));
($port_b) = answer('early media',
{ 'audio-player' => 'force', flags => ['early media'] }, <<SDP);


+ 1
- 1
t/auto-daemon-tests-audio-player.pl View File

@ -173,7 +173,7 @@ a=sendrecv
a=rtcp:PORT
SDP
($seq_b, $ts_b, $ssrc_b) = rcv($sock_a, $port_b, rtpm(0 | 0x80, -1, -1, -1, "\xff" x 160));
(undef, undef, $seq_b, $ts_b, $ssrc_b) = rcv($sock_a, -1, rtpm(0 | 0x80, -1, -1, -1, "\xff" x 160));
($port_b) = answer('early media',
{ 'audio-player' => 'force', flags => ['early media'] }, <<SDP);


+ 4
- 4
t/auto-daemon-tests-pubsub.pl View File

@ -2096,7 +2096,7 @@ a=recvonly
a=rtcp:PORT
SDP
(undef, undef, undef, $tag_medias, $media_labels, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume',
(undef, undef, undef, $tag_medias, $media_labels, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume',
{ flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP);
v=0
o=- SDP_VERSION IN IP4 198.51.100.1
@ -3368,7 +3368,7 @@ SDP
snd($sock_a, $port_a, rtp(0, 2001, 4160, 0x3456, "\x00" x 160));
rcv($sock_b, $port_b, rtpm(0, 2001, 4160, 0x3456, "\x00" x 160));
($ftr, $ttr, undef, undef, undef, $port_b) = subscribe_request('publish/subscribe',
($ftr, $ttr, undef, undef, undef, $port_c) = subscribe_request('publish/subscribe',
{ 'from-tag' => ft() }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
@ -3464,7 +3464,7 @@ SDP
snd($sock_a, $port_a, rtp(8, 2001, 4160, 0x3456, "\x00" x 160));
rcv($sock_b, $port_b, rtpm(8, 2001, 4160, 0x3456, "\x00" x 160));
($ftr, $ttr, undef, undef, undef, $port_b) = subscribe_request('publish/subscribe w codec-accept',
($ftr, $ttr, undef, undef, undef, $port_c) = subscribe_request('publish/subscribe w codec-accept',
{ 'from-tag' => ft() }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
@ -3554,7 +3554,7 @@ SDP
snd($sock_a, $port_a, rtp(8, 2001, 4160, 0x3456, "\x00" x 160));
rcv($sock_b, $port_b, rtpm(8, 2001, 4160, 0x3456, "\x00" x 160));
($ftr, $ttr, undef, undef, undef, $port_b) = subscribe_request('publish/subscribe w unsupp and t/c',
($ftr, $ttr, undef, undef, undef, $port_c) = subscribe_request('publish/subscribe w unsupp and t/c',
{ 'from-tag' => ft(), codec => { strip => ['PCMA'], transcode => ['PCMU'] } }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1


Loading…
Cancel
Save