s3-util_sock: Rise debug level for getpeername failed messages.
[Samba/gebeck_regimport.git] / selftest / format-subunit.pl
blob472f51a815badbee4c66f964f225fb8b02d716ed
1 #!/usr/bin/perl
2 # Pretty-format subunit output
3 # Copyright (C) Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPL, v3 or later
6 =pod
8 =head1 NAME
10 format-subunit [--format=<NAME>] [--immediate] < instream > outstream
12 =head1 SYNOPSIS
14 Format the output of a subunit stream.
16 =head1 OPTIONS
18 =over 4
20 =item I<--immediate>
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.
28 =head1 LICENSE
30 GNU General Public License, version 3 or later.
32 =head1 AUTHOR
34 Jelmer Vernooij <jelmer@samba.org>
36 =cut
38 use Getopt::Long;
39 use strict;
40 use FindBin qw($RealBin $Script);
41 use lib "$RealBin";
42 use Subunit qw(parse_results);
44 my $opt_format = "plain";
45 my $opt_help = undef;
46 my $opt_verbose = 0;
47 my $opt_immediate = 0;
48 my $opt_prefix = ".";
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);
60 my $msg_ops;
62 # we want unbuffered output
63 $| = 1;
65 my $statistics = {
66 SUITES_FAIL => 0,
68 TESTS_UNEXPECTED_OK => 0,
69 TESTS_EXPECTED_OK => 0,
70 TESTS_UNEXPECTED_FAIL => 0,
71 TESTS_EXPECTED_FAIL => 0,
72 TESTS_ERROR => 0,
73 TESTS_SKIP => 0,
76 if ($opt_format eq "plain") {
77 require output::plain;
78 $msg_ops = new output::plain("$opt_prefix/summary", $opt_verbose, $opt_immediate, $statistics, undef);
79 } elsif ($opt_format eq "html") {
80 require output::html;
81 mkdir("test-results", 0777);
82 $msg_ops = new output::html("test-results", $statistics);
83 } else {
84 die("Invalid output format '$opt_format'");
87 my $expected_ret = parse_results($msg_ops, $statistics, *STDIN);
89 $msg_ops->summary();
91 exit($expected_ret);