1*cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}' 2*cdf0e10cSrcweir if 0; 3*cdf0e10cSrcweir#************************************************************************* 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# This file is part of OpenOffice.org. 12*cdf0e10cSrcweir# 13*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 14*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 15*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 16*cdf0e10cSrcweir# 17*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 18*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 19*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 21*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 22*cdf0e10cSrcweir# 23*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 24*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 25*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 26*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 27*cdf0e10cSrcweir# 28*cdf0e10cSrcweir#************************************************************************ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir# #!/usr/bin/perl -w 31*cdf0e10cSrcweir 32*cdf0e10cSrcweiruse strict; 33*cdf0e10cSrcweiruse POSIX; 34*cdf0e10cSrcweiruse Cwd; 35*cdf0e10cSrcweiruse File::Path; 36*cdf0e10cSrcweiruse English; 37*cdf0e10cSrcweiruse Cwd 'chdir'; 38*cdf0e10cSrcweir 39*cdf0e10cSrcweirmy $cwd = getcwd(); 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir# Prototypes 42*cdf0e10cSrcweirsub initEnvironment(); 43*cdf0e10cSrcweirsub main($); 44*cdf0e10cSrcweirsub checkForKillobj(); 45*cdf0e10cSrcweirsub checkARGVFor($); 46*cdf0e10cSrcweir 47*cdf0e10cSrcweirmy $g_sTempDir = ""; 48*cdf0e10cSrcweirmy $FS = ""; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweirmy $nGlobalFailures = 0; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweirmy %libraryRunThrough; 53*cdf0e10cSrcweirmy $bBuildAll = 0; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir# LLA: this does not exist, ... use a little bit simpler method. 56*cdf0e10cSrcweir# use File::Temp qw/ :POSIX /; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweirmy $params; 59*cdf0e10cSrcweirmy $param; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweirif ($#ARGV < 0) 62*cdf0e10cSrcweir{ 63*cdf0e10cSrcweir $params = "test "; # debug=t TESTOPTADD=\"-boom\" TESTOPTADD=\"-noerroronexit\" 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir # my $nNumber = 55; 66*cdf0e10cSrcweir # my $sLocalParams = $params; 67*cdf0e10cSrcweir # $sLocalParams =~ s/test\s/test$nNumber /; 68*cdf0e10cSrcweir # print "Testparams: $sLocalParams\n"; 69*cdf0e10cSrcweir # exit 1; 70*cdf0e10cSrcweir print "Default "; 71*cdf0e10cSrcweir} 72*cdf0e10cSrcweirelse 73*cdf0e10cSrcweir{ 74*cdf0e10cSrcweir # special hack! 75*cdf0e10cSrcweir if (checkForKillobj() == 1) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir $params = "killobj"; 78*cdf0e10cSrcweir } 79*cdf0e10cSrcweir elsif (checkARGVFor("buildall") == 1) 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir $bBuildAll = 1; 82*cdf0e10cSrcweir $params = "test"; 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir else 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir # always run test, but envelope the other in 'TESTOPT="..."' 87*cdf0e10cSrcweir $params = "test TESTOPT=\""; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir foreach $param (@ARGV) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir $params = $params . " " . $param; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir $params = $params . "\""; 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir print "User defined "; 96*cdf0e10cSrcweir} 97*cdf0e10cSrcweir 98*cdf0e10cSrcweirprint "parameters for dmake: $params\n"; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweirinitEnvironment(); 101*cdf0e10cSrcweirmain($params); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 104*cdf0e10cSrcweirsub checkARGVFor($) 105*cdf0e10cSrcweir{ 106*cdf0e10cSrcweir my $sCheckValue = shift; 107*cdf0e10cSrcweir my $sLocalParam; 108*cdf0e10cSrcweir my $nBackValue = 0; 109*cdf0e10cSrcweir foreach $sLocalParam (@ARGV) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir if ($sLocalParam =~ /^${sCheckValue}$/) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir $nBackValue = 1; 114*cdf0e10cSrcweir last; 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir return $nBackValue; 118*cdf0e10cSrcweir} 119*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 120*cdf0e10cSrcweirsub checkForKillobj() 121*cdf0e10cSrcweir{ 122*cdf0e10cSrcweir my $sLocalParam; 123*cdf0e10cSrcweir my $nBackValue = 0; 124*cdf0e10cSrcweir foreach $sLocalParam (@ARGV) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir if ($sLocalParam =~ /^killobj$/) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir $nBackValue = 1; 129*cdf0e10cSrcweir last; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir return $nBackValue; 133*cdf0e10cSrcweir} 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 136*cdf0e10cSrcweirsub initEnvironment() 137*cdf0e10cSrcweir{ 138*cdf0e10cSrcweir my $gui = $ENV{GUI}; 139*cdf0e10cSrcweir # no error output in forms of message boxes 140*cdf0e10cSrcweir $ENV{'DISABLE_SAL_DBGBOX'}="t"; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir SWITCH: { 143*cdf0e10cSrcweir if ( $gui eq "WNT" ) { 144*cdf0e10cSrcweir $FS = "\\"; 145*cdf0e10cSrcweir $g_sTempDir = $ENV{TMP} ? "$ENV{TMP}${FS}" : "c:${FS}tmp${FS}"; 146*cdf0e10cSrcweir last SWITCH; 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir if ( $gui eq "WIN" ) { 149*cdf0e10cSrcweir $FS = "\\"; 150*cdf0e10cSrcweir $g_sTempDir = $ENV{TMP} ? "$ENV{TMP}${FS}" : "c:${FS}tmp${FS}"; 151*cdf0e10cSrcweir last SWITCH; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir if ( $gui eq "OS2" ) { 154*cdf0e10cSrcweir $FS = "\\"; 155*cdf0e10cSrcweir $g_sTempDir = $ENV{TMP} ? "$ENV{TMP}${FS}" : "c:${FS}tmp${FS}"; 156*cdf0e10cSrcweir last SWITCH; 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir if ( $gui eq "UNX" ) { 159*cdf0e10cSrcweir $FS = "/"; 160*cdf0e10cSrcweir $g_sTempDir = $ENV{TMP} ? "$ENV{TMP}${FS}" : "${FS}tmp${FS}"; 161*cdf0e10cSrcweir last SWITCH; 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir print STDERR "buildall.pl: unkown platform\n"; 164*cdf0e10cSrcweir exit(1); 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir} 167*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 168*cdf0e10cSrcweir 169*cdf0e10cSrcweirsub trim($) 170*cdf0e10cSrcweir{ 171*cdf0e10cSrcweir my $oldstr = shift; 172*cdf0e10cSrcweir $oldstr =~ s/^\s*(.*?)\s*$/$1/; 173*cdf0e10cSrcweir return $oldstr; 174*cdf0e10cSrcweir} 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 177*cdf0e10cSrcweirsub getLibName($) 178*cdf0e10cSrcweir{ 179*cdf0e10cSrcweir my $sFile = shift; 180*cdf0e10cSrcweir if ($OSNAME eq "linux" || $OSNAME eq "solaris") 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir return "lib" . $sFile . ".so"; 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir if ($OSNAME eq "MSWin32" || $OSNAME eq "OS2") 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir return $sFile . ".dll"; 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir return $sFile; 189*cdf0e10cSrcweir} 190*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 191*cdf0e10cSrcweirsub giveOutAll($) 192*cdf0e10cSrcweir{ 193*cdf0e10cSrcweir my $sFailureFile = shift; 194*cdf0e10cSrcweir local *IN; 195*cdf0e10cSrcweir if (! open(IN, $sFailureFile)) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir print "ERROR: Can't open output file $sFailureFile\n"; 198*cdf0e10cSrcweir return; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir my $line; 201*cdf0e10cSrcweir while ($line = <IN>) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir chomp($line); 204*cdf0e10cSrcweir print "$line\n"; 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir close(IN); 207*cdf0e10cSrcweir} 208*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 209*cdf0e10cSrcweirsub giveOutFailures($$) 210*cdf0e10cSrcweir{ 211*cdf0e10cSrcweir my $sTest = shift; 212*cdf0e10cSrcweir my $sFailureFile = shift; 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir my $bBegin = 0; 215*cdf0e10cSrcweir my $nFailures = 0; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir my $line; 218*cdf0e10cSrcweir local *IN; 219*cdf0e10cSrcweir if (! open(IN, $sFailureFile)) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir print "ERROR: Can't open output file $sFailureFile\n"; 222*cdf0e10cSrcweir return; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir my $bStartUnitTest = 0; 226*cdf0e10cSrcweir while ($line = <IN>) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir chomp($line); 229*cdf0e10cSrcweir if ( $line =~ /^- start unit test/) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir $bStartUnitTest = 1; 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir close(IN); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir if ($bStartUnitTest == 0) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir print "\nFailure: Unit test not started. Maybe compiler error.\n"; 239*cdf0e10cSrcweir giveOutAll($sFailureFile); 240*cdf0e10cSrcweir $nFailures++; 241*cdf0e10cSrcweir # exit(1); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir else 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir open(IN, $sFailureFile); 246*cdf0e10cSrcweir # check if testshl2 was started 247*cdf0e10cSrcweir while ($line = <IN>) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir chomp($line); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir # handling of the states 252*cdf0e10cSrcweir if ( $line =~ /^\# -- BEGIN:/) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir $bBegin = 1; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir elsif ( $line =~ /^\# -- END:/) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir $bBegin = 0; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir else 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir if ($bBegin == 1) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir print "$line\n"; 265*cdf0e10cSrcweir $nFailures++; 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir close(IN); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir if ($nFailures > 0) 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir # extra return for a better output 275*cdf0e10cSrcweir print "\nFailures occured: $nFailures\n"; 276*cdf0e10cSrcweir print "The whole output can be found in $sFailureFile\n"; 277*cdf0e10cSrcweir print "\n"; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir # Statistics 280*cdf0e10cSrcweir $nGlobalFailures += $nFailures; 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir} 283*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 284*cdf0e10cSrcweirsub printOnLibrary($) 285*cdf0e10cSrcweir{ 286*cdf0e10cSrcweir my $sTarget = shift; 287*cdf0e10cSrcweir print " on library: " . getLibName($sTarget); 288*cdf0e10cSrcweir} 289*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 290*cdf0e10cSrcweirsub runASingleTest($$) 291*cdf0e10cSrcweir{ 292*cdf0e10cSrcweir my $sTarget = shift; 293*cdf0e10cSrcweir my $params = shift; 294*cdf0e10cSrcweir my $dmake = "dmake $params"; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir my $sLogPath = $g_sTempDir . "dmake_out_$$"; 297*cdf0e10cSrcweir mkdir($sLogPath); 298*cdf0e10cSrcweir my $sLogFile = $sLogPath . "/" . $sTarget . ".out"; 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir # due to the fact, a library name in one project is distinct, we should remember all already run through libraries and 301*cdf0e10cSrcweir # supress same libraries, if they occur one more. 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir if (exists $libraryRunThrough{getLibName($sTarget)}) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir # already done 306*cdf0e10cSrcweir return; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir printOnLibrary($sTarget); 309*cdf0e10cSrcweir print "\n"; 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir# redirect tcsh ">&" (stdout, stderr) 312*cdf0e10cSrcweir# redirect 4nt ">" (stdout), "2>" (stderr) 313*cdf0e10cSrcweir# print "OSNAME: $OSNAME\n"; 314*cdf0e10cSrcweir# LLA: redirect check canceled, seems to be not work as I want. 315*cdf0e10cSrcweir# my $redirect = ""; 316*cdf0e10cSrcweir# if ($OSNAME eq "linux" || $OSNAME eq "solaris") 317*cdf0e10cSrcweir# { 318*cdf0e10cSrcweir# # print "UNIX, linux or solaris\n"; 319*cdf0e10cSrcweir# $redirect = '>>&!' . $sLogFile; 320*cdf0e10cSrcweir# } 321*cdf0e10cSrcweir# else 322*cdf0e10cSrcweir# { 323*cdf0e10cSrcweir# if ($OSNAME eq "MSWin32" || $OSNAME eq "OS2") 324*cdf0e10cSrcweir# { 325*cdf0e10cSrcweir# # test 326*cdf0e10cSrcweir# $redirect = ">>$sLogFile 2>>$sLogFile"; 327*cdf0e10cSrcweir# } 328*cdf0e10cSrcweir# } 329*cdf0e10cSrcweir# print "$dmake $redirect\n"; 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir# LLA: so system does also not work as I imagine 332*cdf0e10cSrcweir# system("$dmake $redirect"); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir# LLA: next check, use open with pipe 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir local *LOGFILE; 337*cdf0e10cSrcweir if (! open( LOGFILE, '>' . "$sLogFile")) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir print "ERROR: can't open logfile: $sLogFile\n"; 340*cdf0e10cSrcweir return; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir my $line; 344*cdf0e10cSrcweir local *DMAKEOUTPUT; 345*cdf0e10cSrcweir if (! open( DMAKEOUTPUT, "$dmake 2>&1 |")) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir print "ERROR: can't open dmake\n"; 348*cdf0e10cSrcweir return; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir while ($line = <DMAKEOUTPUT>) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir chomp($line); 353*cdf0e10cSrcweir print LOGFILE "$line\n"; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir close(DMAKEOUTPUT); 356*cdf0e10cSrcweir close(LOGFILE); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir giveOutFailures($sTarget, $sLogFile); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir $libraryRunThrough{getLibName($sTarget)} = "done"; 361*cdf0e10cSrcweir} 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 364*cdf0e10cSrcweirsub interpretLine($) 365*cdf0e10cSrcweir{ 366*cdf0e10cSrcweir my $line = shift; 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir my $path; 369*cdf0e10cSrcweir my $file; 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir if ($line =~ /^\#/ || $line =~ /^$/) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir # remark or empty line 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir # special format, $file == $path 378*cdf0e10cSrcweir ($path, $file) = split(/;/, $line); 379*cdf0e10cSrcweir if (! $file) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir $file = $path; 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir $file = trim($file); 384*cdf0e10cSrcweir $path = trim($path); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir return $path, $file; 387*cdf0e10cSrcweir} 388*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 389*cdf0e10cSrcweirsub runTestsOnPath($$$) 390*cdf0e10cSrcweir{ 391*cdf0e10cSrcweir my $path = shift; 392*cdf0e10cSrcweir my $file = shift; 393*cdf0e10cSrcweir my $params = shift; 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir # empty values 396*cdf0e10cSrcweir if (!$path || $path eq "") 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir # DBG: print "empty path '$path'\n"; 399*cdf0e10cSrcweir return; 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir if (!$file || $file eq "") 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir # DBG: print "empty file '$file'\n"; 404*cdf0e10cSrcweir return; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir# print "File: '$file', Path: '$path'\n"; 408*cdf0e10cSrcweir print "Work in directory: $path\n"; 409*cdf0e10cSrcweir my $newpath = $cwd . $FS . $path; 410*cdf0e10cSrcweir# print "chdir to $newpath\n"; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir my $error = chdir($newpath); 413*cdf0e10cSrcweir cwd(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir # run through the hole makefile.mk and check if SHL<D>TARGET = ... exist, for every target call "dmake test<D>" 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir local *MAKEFILE_MK; 418*cdf0e10cSrcweir if (! open(MAKEFILE_MK, "makefile.mk")) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir print "ERROR: can't open makefile.mk in path: $newpath\n"; 421*cdf0e10cSrcweir print "please check your libs2test.txt file in qa directory.\n"; 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir my $line; 424*cdf0e10cSrcweir my $nNumber; 425*cdf0e10cSrcweir my $sTarget; 426*cdf0e10cSrcweir my $sLocalParams; 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir while($line = <MAKEFILE_MK>) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir chomp($line); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir if ($line =~ /SHL(\d)TARGET=(.*)/) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir $nNumber = $1; 435*cdf0e10cSrcweir $sTarget = trim($2); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir # DBG: print "test$number is lib: $target\n"; 438*cdf0e10cSrcweir $sLocalParams = $params . " "; # append a whitespace, so we can check if 'test' exist without additional digits 439*cdf0e10cSrcweir $sLocalParams =~ s/test\s/test$nNumber/; 440*cdf0e10cSrcweir # DBG: print "$sLocalParams\n"; 441*cdf0e10cSrcweir if ($bBuildAll == 1 || 442*cdf0e10cSrcweir $file eq $sTarget) 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir # print "runASingleTest on Target: $sTarget 'dmake $sLocalParams'\n"; 445*cdf0e10cSrcweir runASingleTest($sTarget, $sLocalParams); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir else 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir # printOnLibrary($sTarget); 450*cdf0e10cSrcweir # print " suppressed, not in libs2test.txt\n"; 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir close(MAKEFILE_MK); 455*cdf0e10cSrcweir} 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 458*cdf0e10cSrcweir 459*cdf0e10cSrcweirsub main($) 460*cdf0e10cSrcweir{ 461*cdf0e10cSrcweir my $params = shift; 462*cdf0e10cSrcweir# my $sLogFile = shift; # "buildall_$$.out"; 463*cdf0e10cSrcweir local *LIBS2TEST; 464*cdf0e10cSrcweir my $filename = "libs2test.txt"; 465*cdf0e10cSrcweir my $line; 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir open(LIBS2TEST, $filename) || die "can't open $filename\n"; 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir while($line = <LIBS2TEST>) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir chomp($line); 472*cdf0e10cSrcweir # DOS Hack grrrr... 473*cdf0e10cSrcweir while ($line =~ / 474*cdf0e10cSrcweir$/) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir $line = substr($line, 0, -1); 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir # print "$line\n"; 480*cdf0e10cSrcweir my $path; 481*cdf0e10cSrcweir my $file; 482*cdf0e10cSrcweir ($path, $file) = interpretLine($line); 483*cdf0e10cSrcweir runTestsOnPath($path, $file, $params); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir close(LIBS2TEST); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir print "\nComplete logging information will be found in dir: ".$g_sTempDir."dmake_out_$$/\n"; 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir if ($nGlobalFailures > 0) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir print "\nFailures over all occured: $nGlobalFailures\n"; 492*cdf0e10cSrcweir print "\nPASSED FAILED.\n"; 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir else 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir print "\nPASSED OK.\n"; 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir} 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir# ------------------------------------------------------------------------------ 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir# TODO: 503*cdf0e10cSrcweir# -verbose 504*cdf0e10cSrcweir# -fan - \ | / 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir# END! 507*cdf0e10cSrcweir 508