diff --git a/bin/generate_test_tt2.pl b/bin/generate_test_tt2.pl index 4486c0f2..1555a0aa 100755 --- a/bin/generate_test_tt2.pl +++ b/bin/generate_test_tt2.pl @@ -29,14 +29,18 @@ use English; use utf8; use JSON; use Scalar::Util qw(reftype); +use List::MoreUtils qw(uniq); +my @common_hdrs = qw(Via Route Call-ID Expires Max-Forwards); sub usage { my $output = "usage: generate_test_tt2.pl [-h] [-f Header] file\n"; - $output .= "\tOptions:\n"; - $output .= "-h --help: this help\n"; - $output .= "-f --filter: remove this header ( can be used multiple times )\n"; - $output .= "-i --ids: subst ids present in scenarios_ids.yml file\n"; + $output .= "Options:\n"; + $output .= "\t-h --help: this help\n"; + $output .= "\t-f --filter: remove this header ( can be used multiple times )\n"; + $output .= "\t-F --filter-common: filter common headers:\n"; + $output .= "\t\t@common_hdrs\n"; + $output .= "\t-i --ids: subst ids present in scenarios_ids.yml file\n"; return $output } @@ -91,8 +95,8 @@ sub subst_common $line =~ s/nonce=".+"/nonce=".+"/; } elsif($line =~ /^Server: Sipwise/i) { $line =~ s/^: Sipwise .+/: Sipwise NGCP Proxy/; - } elsif($line =~ /^Content-Length: [1-9]/i) { - $line =~ s/: \d+/: \\d+/; + } elsif($line =~ /^Content-Length:[ ]+[1-9]/i) { + $line =~ s/:[ ]+\d+/: \\d+/; } elsif($line =~ /^P-LB-Uptime: /i) { $line =~ s/: \d+/: \\d+/; } @@ -129,14 +133,24 @@ sub filter_header } my $help = 0; +my $f_common = 0; my $f_ids; -GetOptions ("h|help" => \$help, "f|filter=s" => \@headers, "i|ids=s" => \$f_ids) - or die("Error in command line arguments\n".usage()); +GetOptions ( + "h|help" => \$help, + "f|filter=s" => \@headers, + "F|filter-common" => \$f_common, + "i|ids=s" => \$f_ids, +) or die("Error in command line arguments\n".usage()); if($#ARGV!=0 || $help) { die(usage()) } + +if($f_common) { + @headers = uniq(@headers, @common_hdrs); +} + my $filename = abs_path($ARGV[0]); my $json; { diff --git a/run_tests.sh b/run_tests.sh index cbccdc14..d5720c4c 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -14,7 +14,7 @@ SEMS_PBX_LOG=${SEMS_PBX_LOG:-"/var/log/ngcp/sems-pbx.log"} TMP_LOG_DIR="/tmp" KAM_DIR="/tmp/cfgtest" COREDUMP_DIR="/ngcp-data/coredumps" -PROFILE="CE" +PROFILE="${PROFILE:-CE}" OPTS=(-P -T -M) #SKIP_PARSE=true, SKIP_TESTS=true, SKIP_MOVE_JSON_KAM=true DOMAIN="spce.test" TIMEOUT=${TIMEOUT:-300}