Changeset 1a300b9 in git
- Timestamp:
- Sep 23, 2011, 9:56:00 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 617c42754f9beacefcc608d79a6205d4f5c48938
- Parents:
- 1d50ea3cd9b2f2e4957a9f15c782e61d03d0cc2b
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-23 21:56:00+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:25+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Tst/regress.cmd
r1d50ea r1a300b9 1 #!/usr/bin/perl 1 #!/usr/bin/perl -CS 2 2 3 3 ################################################################# … … 8 8 # AUTHOR: obachman@mathematik.uni-kl.de 9 9 10 use Env; 11 10 12 ################################################################# 11 13 # … … 29 31 [-t] -- compute and call system("mtrack", 1) at the end, no diffs 30 32 [-A num] -- set timeout [in sec.] for executed Singular 33 [-C name] -- be TeamCity friendly, use "name" as a test-suite name 31 34 [-tt max] -- compute and call system("mtrack", max) at the end 32 35 [-T] -- simply compute and determine timmings, no diffs … … 129 132 chop $hostname; 130 133 134 # flag indicating whether to produce TeamCity output ("" - no): 135 $teamcity = ""; 136 # current argument: test file name? 137 $test_file = ""; 138 139 140 141 142 ################################################################# 143 # 144 # teamcity helpers: 145 # 146 sub myGetTCprop 147 { 148 local($prop) = $_[0]; 149 return( &mysystem_catch("cat \"\$TEAMCITY_BUILD_PROPERTIES_FILE\"|grep \"$prop=\"|sed \"s/$prop=//\"") ); 150 } 151 152 sub tc_filter 153 { 154 local($t) = $_[0]; 155 156 $t =~ s/\|/|\|/g; 157 158 $t =~ s/\n/|n/g; 159 $t =~ s/\r/|r/g; 160 161 $t =~ s/\u0085/|x/g; 162 $t =~ s/\u2028/|l/g; 163 $t =~ s/\u2029/|p/g; 164 165 ## \x{263A} 166 167 $t =~ s/\'/|\'/g; 168 $t =~ s/\[/|\[/g; 169 $t =~ s/\]/|\]/g; 170 return ($t); 171 } 172 sub putTCmsg 173 { 174 if( length($teamcity) > 0 ) 175 { 176 local($message) = $_[0]; 177 local($text) = $_[1]; 178 179 print( "\n##teamcity[$message $text]\n" ); 180 } 181 } 182 sub putTCmsgV 183 { 184 local($message) = $_[0]; 185 local($unquotedValue) = tc_filter($_[1]); 186 187 putTCmsg( $message, "\'$unquotedValue\'"); 188 } 189 sub putTCmsgNV 190 { 191 local($m) = $_[0]; 192 local($p) = $_[1]; 193 local($v) = tc_filter($_[2]); 194 putTCmsg( $m, "$p=\'$v\'" ); 195 } 196 sub putTCmsgNV2 197 { 198 local($m) = $_[0]; 199 local($p) = $_[1]; 200 local($v) = tc_filter($_[2]); 201 local($pp) = $_[3]; 202 local($vv) = tc_filter($_[4]); 203 putTCmsg( $m, "$p='$v' $pp='$vv'" ); 204 } 205 206 ################################################################# 207 # 208 # teamcity routines: 209 # 210 sub blockOpened 211 { 212 local($v) = $_[0]; 213 putTCmsgNV( "blockOpened", "name", $v); 214 } 215 sub blockClosed 216 { 217 local($v) = $_[0]; 218 putTCmsgNV( "blockClosed", "name", $v); 219 } 220 sub tcLog 221 { 222 local($text) = $_[0]; 223 putTCmsgNV2( "message", "text", $text, "status", "NORMAL"); 224 } 225 sub tcError 226 { 227 local($n) = tc_filter($_[0]); 228 local($m) = tc_filter($_[1]); 229 local($t) = tc_filter($_[2]); 230 # The status attribute may take following values: 231 # NORMAL, WARNING, FAILURE, ERROR. 232 # The default value is NORMAL. 233 # The errorDetails attribute is used only if status is ERROR, in other cases it is ignored. 234 # This message fails the build in case its status is ERROR and "Fail build if an error message is logged by build runner" checkbox is checked on build configuration general settings page. 235 236 ##teamcity[message text='<message text>' errorDetails='<error details>' status='<status value>'] 237 putTCmsg( "message", "text=\'$n\' errorDetails=\'$m\' status=\'$t\'"); 238 } 239 240 sub testSuiteStarted 241 { 242 local($v) = $_[0]; 243 putTCmsgNV( "testSuiteStarted", "name", $v); 244 } 245 sub testSuiteFinished 246 { 247 local($v) = $_[0]; 248 putTCmsgNV( "testSuiteFinished", "name", $v); 249 } 250 sub testStarted 251 { 252 local($v) = $_[0]; 253 putTCmsgNV2( "testStarted", "name", $v, "captureStandardOutput", "true"); 254 } 255 sub testFinished 256 { 257 local($v) = $_[0]; 258 local($d) = $_[1]; 259 putTCmsgNV2( "testFinished", "name", $v, "duration", $d); 260 } 261 sub testFailed 262 { 263 local($n) = $_[0]; 264 local($m) = $_[1]; 265 putTCmsgNV2( "testFailed", "name", $n, "message", $m); 266 } 267 sub testFailed2 268 { 269 local($n) = tc_filter($_[0]); 270 local($m) = tc_filter($_[1]); 271 local($t) = tc_filter($_[2]); 272 putTCmsg( "testFailed", "name=\'$n\' message=\'$m\' details=\'$t\'"); 273 } 274 sub testFailedCMP 275 { 276 local($n) = tc_filter($_[0]); 277 local($m) = tc_filter($_[1]); 278 local($d) = tc_filter($_[2]); 279 local($e) = tc_filter($_[3]); 280 local($a) = tc_filter($_[4]); 281 putTCmsg( "testFailed", "type=\'comparisonFailure\' name=\'$n\' message=\'$m\' details=\'$d\' expected=\'$e\' actual=\'$a\'"); 282 } 283 284 ##teamcity[testFailed type='comparisonFailure' name='test2' message='failure message' details='message and stack trace' expected='expected value' actual='actual value'] 285 sub testIgnored 286 { 287 local($n) = $_[0]; 288 local($m) = $_[1]; 289 putTCmsgNV2( "testIgnored", "name", $n, "message", $m); 290 } 291 292 293 131 294 ################################################################# 132 295 # … … 147 310 } 148 311 close(FD); 312 &mysystem("if [ -e /proc/cpuinfo ]; then cat /proc/cpuinfo >> SingularVersionDate; fi "); 313 &mysystem("sysctl -a >> SingularVersionDate"); 314 &mysystem("uname -a >> SingularVersionDate"); 315 &mysystem("if [ -e /proc/meminfo ]; then cat /proc/meminfo >> SingularVersionDate; fi "); 316 &mysystem("free -h >> SingularVersionDate"); 149 317 } 150 318 … … 308 476 if (/(\d+) >> (\w+) :: /) 309 477 { 310 311 478 s/$hostname:(\d+)/$this_time:$singular_date:$singular_version:$singular_uname:$hostname:$1/g; 479 print RES_FILE $_; 312 480 } 313 481 } … … 374 542 { 375 543 print (STDERR "Can not read $root.tst\n"); 544 testIgnored($test_file, "Can not read $root.tst"); 376 545 return (1); 377 546 } … … 381 550 { 382 551 print "Warning: $root not tested: needs MP\n"; 552 testIgnored($test_file, "Warning: $root not tested: needs MP"); 383 553 return (0); 384 554 } … … 393 563 { 394 564 print (STDERR "Can not decode $root.res.gz.uu\n"); 565 testIgnored($test_file, "Can not decode $root.res.gz.uu"); 395 566 return ($exit_status); 396 567 } … … 399 570 { 400 571 print (STDERR "Can not read $root.res[.gz.uu]\n"); 572 testIgnored($test_file, "Can not read $root.res[.gz.uu]"); 401 573 return (1); 402 574 } 403 575 } 404 576 577 testStarted($test_file); 578 405 579 my $resfile = "\"$root.new.res\""; 406 580 $resfile = "\"$root.mtrack.res\"" if (defined($mtrack)); 407 581 my $statfile = "$root.new.stat"; 408 582 &mysystem("$rm -f \"$statfile\""); 583 409 584 if (defined($mtrack)) 410 585 { … … 434 609 $cuser_t = $cuser_t2 - $cuser_t; 435 610 $csystem_t = $csystem_t2 - $csystem_t; 611 436 612 if ($exit_status != 0) 437 613 { 438 $error_cause = "Singular call exited with status != 0"; 614 $error_cause = "Singular call exited with status != 0"; 439 615 } 440 616 else … … 504 680 } 505 681 print STDERR "!!! $root : $error_cause\n"; 682 testFailed($test_file, $error_cause); 506 683 } 507 684 else … … 552 729 $total_checks_pass++ unless $exit_status; 553 730 554 mysystem("mv gmon.out \"gmon.$root.out\"") 555 if (-e "gmon.out"); 556 731 mysystem("mv gmon.out \"gmon.$root.out\"") if (-e "gmon.out"); 732 733 testFinished($test_file, $cuser_t + $csystem_t); 734 557 735 return ($exit_status); 558 736 } … … 595 773 { 596 774 $timeout = shift; 775 } 776 elsif (/^-C$/) 777 { 778 $teamcity = shift; 597 779 } 598 780 elsif(/^-t$/) … … 725 907 726 908 909 if( length($teamcity) > 0 ) 910 { 911 # tcLog("|Hi|\r I\'m [Alex]|\nHow are You?|"); 912 913 blockOpened ("init"); 914 915 local($TEAMCITY_BUILD_PROPERTIES_FILE) = $ENV{TEAMCITY_BUILD_PROPERTIES_FILE}; 916 917 tcLog("TEAMCITY_BUILD_PROPERTIES_FILE: $TEAMCITY_BUILD_PROPERTIES_FILE"); 918 919 if ( length($TEAMCITY_BUILD_PROPERTIES_FILE) > 0 ) 920 { 921 print( "teamcity.tests.runRiskGroupTestsFirst: " . myGetTCprop("teamcity.tests.runRiskGroupTestsFirst") . "\n" ); 922 print( "teamcity.tests.recentlyFailedTests.file: " . myGetTCprop("teamcity.tests.recentlyFailedTests.file") . "\n" ); 923 print( "teamcity.build.changedFiles.file: " . myGetTCprop("teamcity.build.changedFiles.file") . "\n" ); 924 print( "teamcity.build.properties.file: " . myGetTCprop("teamcity.build.properties.file") . "\n" ); 925 print( "teamcity.configuration.properties.file: " . myGetTCprop("teamcity.configuration.properties.file") . "\n" ); 926 print( "teamcity.runner.properties.file : " . myGetTCprop("teamcity.runner.properties.file ") . "\n" ); 927 } 928 blockClosed ("init"); 929 } 930 727 931 if ($timeout > 0) 728 932 { 729 $singular = " perl -e 'alarm $timeout; exec \@ARGV' $singular";730 print ("Set exec timeout to $timeout sec.\n") if ($verbosity > 1);933 $singular = "PERL_SIGNALS=unsafe perl -e 'alarm($timeout); exec(\@ARGV); ' $singular"; 934 tcLog ("Set exec timeout to $timeout sec.\n"); 731 935 # die; 732 936 } 937 938 testSuiteStarted($teamcity); 939 733 940 # now do the work 734 941 foreach (@ARGV) 735 942 { 736 943 $test_file = $_; 944 945 tcLog("test_file: $test_file"); 946 737 947 if ( /^(.*)\.([^\.\/]*)$/ ) 738 948 { … … 753 963 $base = $_; 754 964 } 965 966 tcLog("path: $path, base: $base, extension: $extension"); 967 755 968 $file = "$base.$extension"; 756 969 chop ($tst_curr_dir = `pwd`); … … 762 975 elsif ($extension eq "lst") 763 976 { 764 765 977 if (! open(LST_FILE, "<$file")) 766 978 { 767 979 print (STDERR "Can not open $path/$file for reading\n"); 768 980 $exit_code = 1; 981 testIgnored($test_file, "Can not open $path/$file for reading"); 769 982 next; 770 983 } 984 985 local ($b) = $test_file; 986 blockOpened ($b); 987 771 988 $lst_used_time = 0; 772 989 $lst_checks = 0; … … 781 998 next if (/^\s*$/); #ignore whitespaced lines 782 999 chop if (/\n$/); #chop of \n 783 784 $_ = $1 if (/^(.*)\.([^\.\/]*)$/ ); # chop of extension 1000 1001 tcLog("path: $path, test_file: $_, file: $file"); 1002 1003 if (length($path) > 0) 1004 { 1005 $test_file = "$path/$_"; 1006 } 1007 else 1008 { 1009 $test_file = $_; 1010 } 1011 1012 1013 $_ = $1 if (/^(.*)\.([^\.\/]*)$/ ); # chop of extension (.tst!!!?) 785 1014 if ( /^(.*)\/([^\/]*)$/ ) 786 1015 { … … 798 1027 $tst_base =~ s/(.*?)\s+.*/$1/; 799 1028 $lst_checks++; 1029 1030 tcLog("tst_path: $tst_path, tst_base: $tst_base"); 1031 1032 800 1033 my $this_exit_code = &tst_check($tst_base); 1034 801 1035 $lst_checks_pass++ unless $this_exit_code; 802 1036 $exit_code = $this_exit_code || $exit_code; … … 810 1044 close (LST_FILE); 811 1045 printf("$base Summary: Checks:$lst_checks Failed:%d Time:%.2f\n", $lst_checks - $lst_checks_pass, $lst_used_time) 812 unless ($verbosity < 2) 1046 unless ($verbosity < 2); 1047 blockClosed ($b); 813 1048 } 814 1049 else … … 829 1064 } 830 1065 1066 if( length($teamcity) > 0 ) 1067 { 1068 testSuiteFinished($teamcity); 1069 } 1070 1071 831 1072 # Und Tschuess 832 1073 exit $exit_code;
Note: See TracChangeset
for help on using the changeset viewer.