Changeset ebb444 in git


Ignore:
Timestamp:
Sep 25, 2011, 4:13:56 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '3720ae8bfcff4a4649ee98a15552089151d2d59b')
Children:
c515addbdee3daf91cdb80efb76e41fd8ff2f111
Parents:
93e538c4b38681efb7cb7bfb840f6f5c5ff4002a
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-25 16:13:56+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:28+01:00
Message:
ADD: detailed error reporting to TC!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Tst/regress.cmd

    r93e538 rebb444  
    219219  putTCmsgNV( "blockClosed", "name", $v);
    220220}
    221 sub tcLog
    222 {
    223   local($text) = $_[0];
    224   putTCmsgNV2( "message", "text", $text, "status", "NORMAL");
    225 }
    226 sub tcWarn
    227 {
    228   local($text) = $_[0];
    229   putTCmsgNV2( "message", "text", $text, "status", "WARNING");
    230 }
    231221sub tcError
    232222{
    233   local($n) = tc_filter($_[0]);
    234   local($m) = tc_filter($_[1]);
    235   local($t) = tc_filter($_[2]);
     223  local($text) = tc_filter($_[0]);
     224  local($details) = tc_filter($_[1]);
     225  local($status) = tc_filter($_[2]);
    236226  # The status attribute may take following values:
    237227  # NORMAL, WARNING, FAILURE, ERROR.
     
    241231 
    242232  ##teamcity[message text='<message text>' errorDetails='<error details>' status='<status value>']
    243   putTCmsg( "message", "text=\'$n\' errorDetails=\'$m\' status=\'$t\'");
     233  putTCmsg( "message", "text=\'$text\' errorDetails=\'$details\' status=\'$status\'");
     234}
     235
     236sub tcFailure
     237{
     238  local($text) = tc_filter($_[0]);
     239  local($details) = tc_filter($_[1]);
     240  tcError( $text, $details, "FAILURE" );
     241}
     242
     243sub tcLog
     244{
     245  local($text) = $_[0];
     246  putTCmsgNV2( "message", "text", $text, "status", "NORMAL");
     247}
     248sub tcWarn
     249{
     250  local($text) = $_[0];
     251  putTCmsgNV2( "message", "text", $text, "status", "WARNING");
    244252}
    245253
     
    254262  putTCmsgNV( "testSuiteFinished", "name", $v);
    255263}
     264
     265$failed = 0;
     266
    256267sub testStarted
    257268{
    258269  local($v) = $_[0];       
    259270  putTCmsgNV2( "testStarted", "name", $v, "captureStandardOutput", "true");
     271  $failed = 0;   
    260272}
    261273sub testFinished
     
    263275  local($v) = $_[0];
    264276  local($d) = $_[1];
    265   putTCmsgNV2( "testFinished", "name", $v, "duration", $d);
    266 }
     277  putTCmsgNV2( "testFinished", "name", $v, "duration", $d);
     278  $failed = 0;   
     279}
     280
    267281sub testFailed
    268282{
    269283  local($n) = $_[0];
    270284  local($m) = $_[1];
    271   putTCmsgNV2( "testFailed", "name", $n, "message", $m);
     285   
     286  if( !$failed )
     287  {
     288    putTCmsgNV2( "testFailed", "name", $n, "message", $m);
     289    $failed = 1;
     290  } else
     291  {
     292    tcFailure("Test: $n => $m", "");
     293  }
    272294}
    273295sub testFailed2
     
    276298  local($m) = tc_filter($_[1]);
    277299  local($t) = tc_filter($_[2]);
    278   putTCmsg( "testFailed", "name=\'$n\' message=\'$m\' details=\'$t\'");
     300  if( !$failed )
     301  {
     302    putTCmsg( "testFailed", "name=\'$n\' message=\'$m\' details=\'$t\'");
     303    $failed = 1;
     304  } else
     305  {
     306    tcFailure("Test: $n => $m", $t);
     307  }
     308
    279309}
    280310sub testFailedCMP
    281311{
    282   local($n) = tc_filter($_[0]);
    283   local($m) = tc_filter($_[1]);
    284   local($d) = tc_filter($_[2]);
    285   local($e) = tc_filter($_[3]);
    286   local($a) = tc_filter($_[4]);
    287   putTCmsg( "testFailed", "type=\'comparisonFailure\' name=\'$n\' message=\'$m\' details=\'$d\' expected=\'$e\' actual=\'$a\'");
    288 }
    289 
    290 ##teamcity[testFailed type='comparisonFailure' name='test2' message='failure message' details='message and stack trace' expected='expected value' actual='actual value']
     312  local($name) = tc_filter($_[0]);
     313  local($msg) = tc_filter($_[1]);
     314  local($details) = tc_filter($_[2]);
     315  local($expected) = tc_filter($_[3]);
     316  local($actual) = tc_filter($_[4]);
     317  if( !$failed )
     318  {
     319    putTCmsg( "testFailed", "type=\'comparisonFailure\' name=\'$name\' message=\'$msg\' details=\'$details\' expected=\'$expected\' actual=\'$actual\'");
     320    $failed = 1;
     321  } else
     322  {
     323    tcFailure("Test: $name => $msg", "$detail\nExpected: $expected\nActual: $actual");
     324  }
     325
     326}
     327
     328##teamcity[testFailed type='comparisonFailure' name='test_file' message='failure_message' details='message and stack trace' expected='expected value' actual='actual value']
    291329sub testIgnored
    292330{
     
    375413  $exit_status = mysystem("$diff -w -b \"$root.res.cleaned\" \"$root.new.res.cleaned\" > \"$root.diff\" 2>&1");
    376414
     415 
    377416  # clean up time
    378417  mysystem("$rm -f \"$root.res.cleaned\" \"$root.new.res.cleaned\"");
     
    385424  $exit_status = $exit_status || (-e "$root.diff" && -s "$root.diff");
    386425
     426  if( $exit_status && (length($teamcity) > 0) )
     427  {
     428    local($details) = mysystem_catch("$cat \"$root.diff\"");
     429    local($expected) = mysystem_catch("$cat \"$root.res\"");
     430    local($actual) = mysystem_catch("$cat \"$root.new.res\"");
     431    testFailedCMP($test_file, "Differences in res files", $details, $expected, $actual )
     432  }
     433   
    387434  return($exit_status);
    388435}
     
    629676  $cuser_t = $cuser_t2 - $cuser_t;
    630677  $csystem_t = $csystem_t2 - $csystem_t;
    631  
     678
     679  tcLog("Test: $test_file, user time: $cuser_t, system time: $csystem_t" );
     680   
    632681  if ($exit_status != 0)
    633682  {
    634     $error_cause = "Singular call exited with status != 0";   
     683    $error_cause = "Singular call exited with status ($exit_status) != 0";
     684   
     685    if( length($teamcity) > 0 )
     686    {   
     687      ### TODO: add a way to detect timeout!!!
     688      if( $exit_status == 142 ) # perl sig alarm exit code? NOPE :(((
     689      {
     690        local($details) = mysystem_catch("$cat \"$resfile\"");     
     691        testFailed2($test_file, "Exit on timeout ($timeout sec)!", $details);   
     692      }
     693    }
    635694  }
    636695  else
     
    642701    {
    643702      $error_cause = "Segment fault";
     703      local($details) = mysystem_catch("$cat \"$resfile\"");
     704      testFailed2($test_file, $error_cause, $details);     
    644705    }
    645706    elsif (! defined($mtrack) && !defined($timings_only))
     
    701762    }
    702763    print STDERR "!!! $root : $error_cause\n";
    703     testFailed($test_file, $error_cause);
     764
     765    if( length($teamcity) > 0 )
     766    {
     767      local($details) = mysystem_catch("$cat \"$resfile\"");     
     768      testFailed2($test_file, $error_cause, $details);   
     769    }
    704770  }
    705771  else
     
    751817
    752818  mysystem("mv gmon.out \"gmon.$root.out\"") if (-e "gmon.out");
    753 
     819 
    754820  testFinished($test_file, $cuser_t + $csystem_t);
    755821 
     
    9691035if ($timeout > 0)
    9701036{
    971   $singular = "PERL_SIGNALS=unsafe perl -e 'alarm($timeout); exec(\@ARGV); ' $singular";
     1037  $singular = "PERL_SIGNALS=unsafe perl -e 'alarm($timeout);exec(\@ARGV);' $singular";
    9721038  tcLog ("Set exec timeout to $timeout sec.\n");
    9731039  # die;
Note: See TracChangeset for help on using the changeset viewer.