TT#81700 run_tests.sh: use show_sip.pl to detect retransmissions

* show_sip.pl: add options to select what to show

Change-Id: I702d63ffcb8d47a01fc006a9de031c43e8cec194
mr10.5.1
Victor Seva 4 years ago
parent 144075611a
commit da05177d09

@ -33,18 +33,28 @@ sub usage
my $output = "usage: show_sip.pl [-h] file\n"; my $output = "usage: show_sip.pl [-h] file\n";
$output .= "\tOptions:\n"; $output .= "\tOptions:\n";
$output .= "-h --help: this help\n"; $output .= "-h --help: this help\n";
$output .= "-i --sip_in: print sip_in\n";
$output .= "-o --sip_out: print sip_out\n";
$output .= "by default prints both\n";
return $output return $output
} }
my $help = 0; my $help = 0;
my $json_in = 0; my $json_in = 0;
GetOptions ("h|help" => \$help) my $in = 0;
my $out = 0;
GetOptions ("h|help" => \$help, "i|sip_in" => \$in, "o|sip_out" => \$out)
or die("Error in command line arguments\n".usage()); or die("Error in command line arguments\n".usage());
if($#ARGV!=0 || $help) if($#ARGV!=0 || $help)
{ {
die(usage()) die(usage())
} }
if(!$in && !$out) {
# default behaviour
$in = 1;
$out = 1;
}
my $filename = abs_path($ARGV[0]); my $filename = abs_path($ARGV[0]);
my $json; my $json;
{ {
@ -55,14 +65,18 @@ my $json;
} }
my $inlog = decode_json($json); my $inlog = decode_json($json);
print "=== sip_in ===\n"; if($in) {
foreach my $i (@{$inlog->{'sip_in'}}) print "=== sip_in ===\n";
{ foreach my $i (@{$inlog->{'sip_in'}})
{
print "$i\n---\n"; print "$i\n---\n";
}
} }
print "=== sip_out ===\n"; if($out) {
foreach my $i (@{$inlog->{'sip_out'}}) print "=== sip_out ===\n";
{ foreach my $i (@{$inlog->{'sip_out'}})
{
print "$i\n---\n" print "$i\n---\n"
}
} }
#EOF #EOF

@ -163,14 +163,14 @@ fix_retransmissions() {
continue continue
fi fi
# Check if both sip_in and Sip_out are equals # Check if both sip_in and Sip_out are equals
if ( diff -q -u <(tail -n3 "${json_file}") <(tail -n3 "${next_json_file}") &> /dev/null ) ; then if ( diff -q -u <("${BIN_DIR}/show_sip.pl" "${json_file}") <("${BIN_DIR}/show_sip.pl" "${next_json_file}") &> /dev/null ) ; then
echo "$(date) - - - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") (case 1) ---> renaming the file in $(basename "${next_json_file}")_retransmission" echo "$(date) - - - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") (case 1) ---> renaming the file in $(basename "${next_json_file}")_retransmission"
mv -f "${next_json_file}" "${next_json_file}_retransmission" mv -f "${next_json_file}" "${next_json_file}_retransmission"
RETRANS_ISSUE=true RETRANS_ISSUE=true
continue continue
fi fi
# Check if only sip_in is equal # Check if only sip_in is equal
if ( diff -q -u <(tail -n3 "${json_file}" | sed -n 1p) <(tail -n3 "${next_json_file}" | sed -n 1p) &> /dev/null ) ; then if ( diff -q -u <("${BIN_DIR}/show_sip.pl" -i "${json_file}" | sed -n 1p) <("${BIN_DIR}/show_sip.pl" -i "${next_json_file}") &> /dev/null ) ; then
echo "$(date) - - - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") (case 2) ---> renaming the file in $(basename "${next_json_file}")_retransmission" echo "$(date) - - - $(basename "${next_json_file}") seems a retransmission of $(basename "${json_file}") (case 2) ---> renaming the file in $(basename "${next_json_file}")_retransmission"
mv -f "${next_json_file}" "${next_json_file}_retransmission" mv -f "${next_json_file}" "${next_json_file}_retransmission"
RETRANS_ISSUE=true RETRANS_ISSUE=true

Loading…
Cancel
Save