2009-06-03 17:16:56 +02:00
#!/usr/bin/perl
# Pretty-format subunit output
# Copyright (C) Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later
2009-06-04 13:49:11 +02:00
=pod
=head1 NAME
2010-03-28 21:45:42 +02:00
format-subunit [--immediate] < instream > outstream
2009-06-04 13:49:11 +02:00
=head1 SYNOPSIS
Format the output of a subunit stream.
=head1 OPTIONS
=over 4
=item I<--immediate>
Show errors as soon as they happen rather than at the end of the test run.
=head1 LICENSE
GNU General Public License, version 3 or later.
=head1 AUTHOR
Jelmer Vernooij <jelmer@samba.org>
=cut
2009-06-03 17:16:56 +02:00
use Getopt::Long;
use strict;
use FindBin qw($RealBin $Script);
use lib "$RealBin";
use Subunit qw(parse_results);
my $opt_help = undef;
my $opt_verbose = 0;
my $opt_immediate = 0;
my $opt_prefix = ".";
my $result = GetOptions (
'help|h|?' => \$opt_help,
'verbose' => \$opt_verbose,
'immediate' => \$opt_immediate,
'prefix:s' => \$opt_prefix,
);
exit(1) if (not $result);
my $msg_ops;
2009-11-16 16:34:13 +01:00
# we want unbuffered output
$| = 1;
2009-06-03 17:16:56 +02:00
my $statistics = {
SUITES_FAIL => 0,
TESTS_UNEXPECTED_OK => 0,
TESTS_EXPECTED_OK => 0,
TESTS_UNEXPECTED_FAIL => 0,
TESTS_EXPECTED_FAIL => 0,
TESTS_ERROR => 0,
TESTS_SKIP => 0,
};
2010-03-28 21:45:42 +02:00
require output::plain;
$msg_ops = new output::plain("$opt_prefix/summary", $opt_verbose, $opt_immediate, $statistics, undef);
2009-06-03 17:16:56 +02:00
2009-06-05 16:36:10 +02:00
my $expected_ret = parse_results($msg_ops, $statistics, *STDIN);
2009-06-03 17:16:56 +02:00
$msg_ops->summary();
exit($expected_ret);