From da05177d094fb8a0be7526b42d6daa1a2b00190f Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 20 Apr 2022 09:28:08 +0200 Subject: [PATCH] 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 --- bin/show_sip.pl | 32 +++++++++++++++++++++++--------- run_tests.sh | 4 ++-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/bin/show_sip.pl b/bin/show_sip.pl index 5633e18a..296caa76 100755 --- a/bin/show_sip.pl +++ b/bin/show_sip.pl @@ -33,18 +33,28 @@ sub usage my $output = "usage: show_sip.pl [-h] file\n"; $output .= "\tOptions:\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 } my $help = 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()); if($#ARGV!=0 || $help) { die(usage()) } +if(!$in && !$out) { + # default behaviour + $in = 1; + $out = 1; +} my $filename = abs_path($ARGV[0]); my $json; { @@ -55,14 +65,18 @@ my $json; } my $inlog = decode_json($json); -print "=== sip_in ===\n"; -foreach my $i (@{$inlog->{'sip_in'}}) -{ - print "$i\n---\n"; +if($in) { + print "=== sip_in ===\n"; + foreach my $i (@{$inlog->{'sip_in'}}) + { + print "$i\n---\n"; + } } -print "=== sip_out ===\n"; -foreach my $i (@{$inlog->{'sip_out'}}) -{ - print "$i\n---\n" +if($out) { + print "=== sip_out ===\n"; + foreach my $i (@{$inlog->{'sip_out'}}) + { + print "$i\n---\n" + } } #EOF diff --git a/run_tests.sh b/run_tests.sh index 3c91bab0..7f86a3e8 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -163,14 +163,14 @@ fix_retransmissions() { continue fi # 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" mv -f "${next_json_file}" "${next_json_file}_retransmission" RETRANS_ISSUE=true continue fi # 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" mv -f "${next_json_file}" "${next_json_file}_retransmission" RETRANS_ISSUE=true