Subversion Repositories DevTools

Rev

Rev 7322 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7322 Rev 7323
Line 65... Line 65...
65
#       TYPE            - Built type P or D
65
#       TYPE            - Built type P or D
66
#       UTFUID          - Unique Test Identifier
66
#       UTFUID          - Unique Test Identifier
67
#       UTFNAME         - Test Name
67
#       UTFNAME         - Test Name
68
#       UTFTEST         - Recommended file root for test results
68
#       UTFTEST         - Recommended file root for test results
69
#       UTFRC           - Result Code from Unit Test run
69
#       UTFRC           - Result Code from Unit Test run
-
 
70
#       RCFILE          - Path to the RC File (optional)
70
#
71
#
71
our %filterData;
72
our %filterData;
72
 
73
 
73
#-------------------------------------------------------------------------------
74
#-------------------------------------------------------------------------------
74
# Function        : help
75
# Function        : help
Line 122... Line 123...
122
                    "local=s"       => \$filterData{LOCAL},
123
                    "local=s"       => \$filterData{LOCAL},
123
                    "target=s"      => \$filterData{TARGET},
124
                    "target=s"      => \$filterData{TARGET},
124
                    "pkgdir=s"      => \$filterData{PKGDIR},
125
                    "pkgdir=s"      => \$filterData{PKGDIR},
125
                    "type=s"        => \$filterData{TYPE},
126
                    "type=s"        => \$filterData{TYPE},
126
                    "dir=s"         => \$filterData{DIR},
127
                    "dir=s"         => \$filterData{DIR},
-
 
128
                    "rcfile=s"      => \$filterData{RCFILE},
127
                    "arg=s"         => sub {my ( $key, $value) = split('=', $_[1], 2); $filterData{ARGS}{$key} = $value;},
129
                    "arg=s"         => sub {my ( $key, $value) = split('=', $_[1], 2); $filterData{ARGS}{uc $key} = $value;},
128
                    );
130
                    );
129
 
131
 
130
    pod2usage(-verbose => 0, -input =>  __FILE__) if ($opt_help == 1 || ! $result || $argCount < 1);
132
    pod2usage(-verbose => 0, -input =>  __FILE__) if ($opt_help == 1 || ! $result || $argCount < 1);
131
    pod2usage(-verbose => 1, -input =>  __FILE__) if ($opt_help == 2 );
133
    pod2usage(-verbose => 1, -input =>  __FILE__) if ($opt_help == 2 );
132
    pod2usage(-verbose => 2, -input =>  __FILE__) if ($opt_help  > 2);
134
    pod2usage(-verbose => 2, -input =>  __FILE__) if ($opt_help  > 2);
Line 245... Line 247...
245
    unlink $filename if -e $filename;
247
    unlink $filename if -e $filename;
246
    Error("Output file: Cannot delete $filename: $!") if -e $filename;
248
    Error("Output file: Cannot delete $filename: $!") if -e $filename;
247
    Verbose("Writing output to: $filename");
249
    Verbose("Writing output to: $filename");
248
 
250
 
249
    #
251
    #
-
 
252
    #   Recover the result code of the unit test run
-
 
253
    #   Do this before changing directory as the paths are relative
-
 
254
    #   The rcfile will be specified as relative to the current directory
-
 
255
    #
-
 
256
    if (defined $filterData{RCFILE}) {
-
 
257
        my $rcFile = $filterData{RCFILE};
-
 
258
        Verbose("Result Code File:", $rcFile);
-
 
259
        if (-f $rcFile)
-
 
260
        {
-
 
261
            open( my $rcFile, '<', $rcFile) || Error ("Cannot open file : $!");
-
 
262
            $filterData{UTFRC} = <$rcFile>;
-
 
263
            $filterData{UTFRC} =~ s~\s+$~~;
-
 
264
            $filterData{UTFRC} =~ s~^\s+~~;
-
 
265
            Verbose("Recover Result Code: ", $filterData{UTFRC});
-
 
266
            close $rcFile;
-
 
267
        } else {
-
 
268
            Error("ResultCode file specified, but not found: $rcFile");
-
 
269
        }
-
 
270
    }
-
 
271
    
-
 
272
    #
250
    #   Change to the test directory
273
    #   Change to the test directory
251
    #       Only if required
274
    #       Only if required
252
    #       Ensure that the specified directory exists
275
    #       Ensure that the specified directory exists
253
    #
276
    #
254
    if (defined $filterData{DIR})
277
    if (defined $filterData{DIR})
Line 256... Line 279...
256
        Verbose("Change directory:", $filterData{DIR});
279
        Verbose("Change directory:", $filterData{DIR});
257
        Error("Internal: Test directory does not exist: $filterData{DIR}")
280
        Error("Internal: Test directory does not exist: $filterData{DIR}")
258
            unless (-d $filterData{DIR});
281
            unless (-d $filterData{DIR});
259
        chdir $filterData{DIR} || Error("Internal: Could not chdir to: $filterData{DIR}");
282
        chdir $filterData{DIR} || Error("Internal: Could not chdir to: $filterData{DIR}");
260
    }
283
    }
261
 
-
 
262
    #
284
     
263
    #   Recover the result code of the unit test run
-
 
264
    #
-
 
265
    my $rcFile = join ('.', 'utf', $filterData{UTFUID}, 'rc');
-
 
266
    Verbose("Result Code File:", $rcFile);
-
 
267
    if (-f $rcFile)
-
 
268
    {
-
 
269
        open( my $rcFile, '<', $rcFile) || Error ("Cannot open file : $!");
-
 
270
        $filterData{UTFRC} = <$rcFile>;
-
 
271
        $filterData{UTFRC} =~ s~\s+$~~;
-
 
272
        $filterData{UTFRC} =~ s~^\s+~~;
-
 
273
        Verbose("Recover Result Code: ", $filterData{UTFRC});
-
 
274
        close $rcFile;
-
 
275
    }
-
 
276
    #
285
    #
277
    #   Diagnostics
286
    #   Diagnostics
278
    #
287
    #
279
    if (IsVerbose(1))
288
    if (IsVerbose(1))
280
    {
289
    {
Line 305... Line 314...
305
# Returns         : Nothing 
314
# Returns         : Nothing 
306
#
315
#
307
sub writeXmlResults
316
sub writeXmlResults
308
{
317
{
309
    my ($options, $results) = @_;
318
    my ($options, $results) = @_;
-
 
319
 
-
 
320
    # Create a summary report - more for the user
-
 
321
    my $summary;
-
 
322
    my $total = 0;
-
 
323
    foreach my $entry ( @$results) {
-
 
324
        if (exists $entry->{OUTCOME}) {
-
 
325
            $summary->{$entry->{OUTCOME}}++;
-
 
326
            $total++;
-
 
327
        }
-
 
328
    }
-
 
329
    my $summaryString = '';
-
 
330
    my $joiner = '';
-
 
331
    foreach my $entry ( sort keys %{$summary}) {
-
 
332
        $summaryString .= $joiner . $entry . ':' . $summary->{$entry};
-
 
333
        $joiner = ', ';
-
 
334
    }
-
 
335
    Message("Total: $total. $summaryString");
-
 
336
    
-
 
337
 
310
    #
338
    #
311
    #   Create a data structure to contain the dummy test result
339
    #   Create a data structure to contain the dummy test result
312
    #   Insert TARGET and TYPE attributes
340
    #   Insert TARGET and TYPE attributes
313
    #
341
    #
314
    my %xml;
342
    my %xml;
Line 342... Line 370...
342
=head1 SYNOPSIS
370
=head1 SYNOPSIS
343
 
371
 
344
  $(GBE_PERL) -Mjats_runutf -e processUtf -- <args>
372
  $(GBE_PERL) -Mjats_runutf -e processUtf -- <args>
345
 
373
 
346
 Options:
374
 Options:
347
    -help[=n]       - Brief help message
375
    -help[=n]           - Brief help message
348
    -help -help     - Detailed help message
376
    -help -help         - Detailed help message
349
    -man            - Full documentation
377
    -man                - Full documentation
350
    -verbose[=n]    - Verbose operation
378
    -verbose[=n]        - Verbose operation
351
    -filter=name    - Name of the required processing filter
379
    -filter=name        - Name of the required processing filter
352
    -target=name    - Current build target
380
    -target=name        - Current build target
353
    -root=path      - Path to the root of the build
381
    -root=path          - Path to the root of the build
354
    -pkgdir=path    - Path to the packaging directory
382
    -pkgdir=path        - Path to the packaging directory
355
    -interface=path - Path to the build interface directory
383
    -interface=path     - Path to the build interface directory
356
    -local=path     - Path to the local build directory
384
    -local=path         - Path to the local build directory
357
    -dir=path       - Path to test directory
385
    -dir=path           - Path to test directory
-
 
386
    -rcfile=path        - Path to a file that contains the test result code
358
 
387
 
359
=head1 OPTIONS
388
=head1 OPTIONS
360
 
389
 
361
=over 8
390
=over 8
362
 
391
 
Line 405... Line 434...
405
The path to the directory in which the test was run.
434
The path to the directory in which the test was run.
406
 
435
 
407
This is optional. If provided the filter will be invoked with the 
436
This is optional. If provided the filter will be invoked with the 
408
current working directory
437
current working directory
409
 
438
 
-
 
439
=item B<-rcfile=path>
-
 
440
 
-
 
441
The path to the file that will contain the rsult code of the test run.
-
 
442
This is optional, but if provided it should exist
-
 
443
 
410
=back
444
=back
411
 
445
 
412
=head1 DESCRIPTION
446
=head1 DESCRIPTION
413
 
447
 
414
This tool is not designed to be run directly by users. It is intended to be run by the 
448
This tool is not designed to be run directly by users. It is intended to be run by the 
Line 648... Line 682...
648
=head3 The Output Format
682
=head3 The Output Format
649
 
683
 
650
Yet to be defined.
684
Yet to be defined.
651
 
685
 
652
The output format is known to the build system. It should not be 
686
The output format is known to the build system. It should not be 
653
changed without also chnaging it for the consuming tools.
687
changed without also change it for the consuming tools.
654
 
688
 
655
=cut
689
=cut
656
 
690
 
657
 
691
 
658
1;
692
1;