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