Commit ff61551f authored by Maximilien Colange's avatar Maximilien Colange

Fix tests scripts for a better report of errors.

parent 9d76d86d
...@@ -29,14 +29,13 @@ print "##teamcity[testStarted name='$title']\n"; ...@@ -29,14 +29,13 @@ print "##teamcity[testStarted name='$title']\n";
my $tested; my $tested;
my @outputs = (); my @outputs = ();
my @results = `$call`; my @results = `$call 2>&1;`;
while (my $line = shift(@results)) { while (my $line = shift(@results)) {
push (@outputs,$line);
chomp $line; chomp $line;
push (@outputs,$line);
if ($line =~ s/Result of verification is //) { if ($line =~ s/Result of verification is //) {
$tested = $line; $tested = $line;
last;
} }
} }
...@@ -48,13 +47,15 @@ if ($? == 0) { ...@@ -48,13 +47,15 @@ if ($? == 0) {
$failure = 1; $failure = 1;
} }
my $tc_output = join("|n|r", @outputs);
my $reg_output = join("\n", @outputs);
if ( $nominal ne $tested ) { if ( $nominal ne $tested ) {
print "@outputs\n"; print "$reg_output\n";
print "\n##teamcity[testFailed name='$title' message='regression detected' details='' expected='$nominal' actual='$tested'] \n"; print "\n##teamcity[testFailed name='$title' message='regression detected' details='$tc_output' expected='$nominal' actual='$tested'] \n";
print "Expected : $nominal Obtained : $tested \n"; print "Expected : $nominal Obtained : $tested \n";
} elsif ( $failure ) { } elsif ( $failure ) {
print "@outputs\n"; print "$reg_output\n";
print "\n##teamcity[testFailed name='$title' message='test did not exit properly' details='' expected='$nominal' actual='$tested'] \n"; print "\n##teamcity[testFailed name='$title' message='test did not exit properly' details='$tc_output' expected='$nominal' actual='$tested'] \n";
print "Expected : $nominal Obtained : $tested \n"; print "Expected : $nominal Obtained : $tested \n";
my $exitval = $? >> 8; my $exitval = $? >> 8;
print "test exited with value $exitval\n"; print "test exited with value $exitval\n";
......
...@@ -106,7 +106,7 @@ trap "st=141; $do_exit" 13 ...@@ -106,7 +106,7 @@ trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15 trap "st=143; $do_exit" 15
# Test script is run here. # Test script is run here.
TC_OUTPUT=`"$@" 2>&1 | awk '{if (/teamcity/) print ; else print > "$log_file"; }'` TC_OUTPUT=`"$@" 2>&1 | awk -v mylog=$log_file '{if (/teamcity/) print ; else print > mylog; }'`
estatus=$? estatus=$?
# estatus should always be 0 # estatus should always be 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment