2 # Pretty-format subunit output
3 # Copyright (C) Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPL, v3 or later
10 format-subunit [--format=<NAME>] [--immediate] < instream > outstream
14 Format the output of a subunit stream.
22 Show errors as soon as they happen rather than at the end of the test run.
24 =item I<--format>=FORMAT
26 Choose the format to print. Currently supported are plain or html.
30 GNU General Public License, version 3 or later.
34 Jelmer Vernooij <jelmer@samba.org>
40 use FindBin
qw($RealBin $Script);
42 use Subunit qw(parse_results);
44 my $opt_format = "plain";
47 my $opt_immediate = 0;
50 my $result = GetOptions
(
51 'help|h|?' => \
$opt_help,
52 'format=s' => \
$opt_format,
53 'verbose' => \
$opt_verbose,
54 'immediate' => \
$opt_immediate,
55 'prefix:s' => \
$opt_prefix,
58 exit(1) if (not $result);
65 TESTS_UNEXPECTED_OK
=> 0,
66 TESTS_EXPECTED_OK
=> 0,
67 TESTS_UNEXPECTED_FAIL
=> 0,
68 TESTS_EXPECTED_FAIL
=> 0,
73 if ($opt_format eq "plain") {
74 require output
::plain
;
75 $msg_ops = new output
::plain
("$opt_prefix/summary", $opt_verbose, $opt_immediate, $statistics, undef);
76 } elsif ($opt_format eq "html") {
78 mkdir("test-results", 0777);
79 $msg_ops = new output
::html
("test-results", $statistics);
81 die("Invalid output format '$opt_format'");
84 my $expected_ret = parse_results
($msg_ops, $statistics, *STDIN
);