diff options
author | Glebs Ivanovskis <git-no-reply@zabbix.com> | 2018-05-09 14:10:44 +0300 |
---|---|---|
committer | Glebs Ivanovskis <git-no-reply@zabbix.com> | 2018-05-09 14:10:44 +0300 |
commit | f13361992b89a4859231ebeee61581a363d3be6b (patch) | |
tree | 07b375f32efd9b434793557d68645ac74ec76461 /tests | |
parent | 0751bd2eb52aace77bc36c68f6ba8f1935799985 (diff) |
.......... [DEV-833] added option for tests_run.pl to determine output formatting and optionally set different package names in XML for Jenkins builds
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/tests_run.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/tests_run.pl b/tests/tests_run.pl index f589b731201..b4101d6828f 100755 --- a/tests/tests_run.pl +++ b/tests/tests_run.pl @@ -8,6 +8,7 @@ use Path::Tiny qw(path); use IPC::Run3 qw(run3); use Time::HiRes qw(time); use File::Basename qw(dirname); +use Getopt::Long qw(GetOptions); use constant TEST_SUITE_ATTRIBUTES => ('name', 'tests', 'skipped', 'errors', 'failures', 'time'); use constant TEST_CASE_ATTRIBUTES => ('name', 'assertions', 'time'); @@ -91,6 +92,10 @@ sub launch($$$) push(@{$test_suite->{'testcases'}}, $test_case); } +my $xml; + +die("Bad command-line arguments") unless(GetOptions(('xml:s' => \$xml))); + my $iter = path(".")->iterator({ 'recurse' => 1, 'follow_symlinks' => 0 @@ -121,7 +126,7 @@ while (my $path = $iter->()) push(@test_suites, $test_suite); } -if (-t STDOUT) +unless (defined($xml)) { use Term::ANSIColor qw(:constants); @@ -293,7 +298,7 @@ if (-t STDOUT) } print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); -print("<testsuites>\n"); +print("<testsuites" . ($xml ? " package=\"" . escape_xml_attribute($xml) . "\"" : "") . ">\n"); foreach my $test_suite (@test_suites) { |