Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlebs Ivanovskis <git-no-reply@zabbix.com>2017-11-01 18:56:50 +0300
committerGlebs Ivanovskis <git-no-reply@zabbix.com>2017-11-01 18:56:50 +0300
commitc0f3966e8c9a847f946ce7ccd71320f9c2f74d47 (patch)
treed2fbc6746ff491a0b220c73a9e3b47f6de4b2712
parent968fb9068aaa1cd6b8f0b09264a8f60c73ed9534 (diff)
....I..... [DEV-628] separated launching json_parser.pl and test executable; made tests_run.pl work when called not from tests/
-rwxr-xr-xtests/tests_run.pl37
1 files changed, 28 insertions, 9 deletions
diff --git a/tests/tests_run.pl b/tests/tests_run.pl
index 196e22ac57e..daa2625214c 100755
--- a/tests/tests_run.pl
+++ b/tests/tests_run.pl
@@ -7,6 +7,7 @@ use JSON::XS;
use Path::Tiny;
use IPC::Run3;
use Time::HiRes qw(clock);
+use File::Basename qw(dirname);
use constant TEST_SUITE_ATTRIBUTES => ('name', 'tests', 'skipped', 'errors', 'failures', 'time');
use constant TEST_CASE_ATTRIBUTES => ('name', 'assertions', 'time');
@@ -53,7 +54,7 @@ sub launch($$$)
my $out;
my $err;
- eval {run3("./json_parser.pl | $test_exec", \$in, \$out, \$err)};
+ eval {run3(dirname($0) . "/json_parser.pl", \$in, \$out, \$err)};
if ($@) # something went wrong with run3()
{
@@ -62,19 +63,37 @@ sub launch($$$)
}
else # run3() was successful
{
- $test_case->{'system-out'} = $out;
- $test_case->{'system-err'} = $err;
-
- if ($?) # something went wrong with either json_parser or test executable
+ if ($?) # something went wrong with json_parser.pl
{
- $test_case->{'error'} = "non-zero exit code";
+ $test_case->{'error'} = "json_parser.pl failed";
$test_suite->{'errors'}++;
+
+ $test_case->{'system-out'} = $out;
+ $test_case->{'system-err'} = $err;
}
- elsif ($out =~ /FAILED/) # test case failed
+ else
{
- $test_case->{'failure'} = "test case failed";
- $test_suite->{'failures'}++;
+ $in = $out;
+ $out = undef;
+ $err = undef;
+
+ eval {run3($test_exec, \$in, \$out, \$err)};
+
+ if ($@) # something went wrong with run3()
+ {
+ $test_case->{'error'} = $!;
+ $test_suite->{'errors'}++;
+ }
+ elsif ($?) # something went wrong with test executable
+ {
+ $test_case->{'failure'} = "test case failed";
+ $test_suite->{'failures'}++;
+
+ $test_case->{'system-out'} = $out;
+ $test_case->{'system-err'} = $err;
+ }
}
+
}
}
else