s4-netlogon: implement dcesrv_netr_DsRAddressToSitenamesExW
[Samba/aatanasov.git] / selftest / filter-subunit.pl
blob9ebc67778f4dc54021db6c0fe54e6b3368dd5df6
1 #!/usr/bin/perl
2 # Filter a subunit stream
3 # Copyright (C) Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPL, v3 or later
6 =pod
8 =head1 NAME
10 filter-subunit - Filter a subunit stream
12 =head1 SYNOPSIS
14 filter-subunit --help
16 filter-subunit --prefix=PREFIX --known-failures=FILE < in-stream > out-stream
18 =head1 DESCRIPTION
20 Simple Subunit stream filter that will change failures to known failures
21 based on a list of regular expressions.
23 =head1 OPTIONS
25 =over 4
27 =item I<--prefix>
29 Add the specified prefix to all test names.
31 =item I<--expected-failures>
33 Specify a file containing a list of tests that are expected to fail. Failures
34 for these tests will be counted as successes, successes will be counted as
35 failures.
37 The format for the file is, one entry per line:
39 TESTSUITE-NAME.TEST-NAME
41 The reason for a test can also be specified, by adding a hash sign (#) and the reason
42 after the test name.
44 =head1 LICENSE
46 selftest is licensed under the GNU General Public License L<http://www.gnu.org/licenses/gpl.html>.
49 =head1 AUTHOR
51 Jelmer Vernooij
53 =cut
55 use Getopt::Long;
56 use strict;
57 use FindBin qw($RealBin $Script);
58 use lib "$RealBin";
59 use Subunit qw(parse_results);
60 use Subunit::Filter;
62 my $opt_expected_failures = undef;
63 my $opt_help = 0;
64 my $opt_prefix = undef;
65 my $opt_strip_ok_output = 0;
66 my @expected_failures = ();
68 my $result = GetOptions(
69 'expected-failures=s' => \$opt_expected_failures,
70 'strip-passed-output' => \$opt_strip_ok_output,
71 'prefix=s' => \$opt_prefix,
72 'help' => \$opt_help,
74 exit(1) if (not $result);
76 if ($opt_help) {
77 print "Usage: filter-subunit [--prefix=PREFIX] [--expected-failures=FILE]... < instream > outstream\n";
78 exit(0);
81 if (defined($opt_expected_failures)) {
82 @expected_failures = Subunit::Filter::read_test_regexes($opt_expected_failures);
85 my $statistics = {
86 TESTS_UNEXPECTED_OK => 0,
87 TESTS_EXPECTED_OK => 0,
88 TESTS_UNEXPECTED_FAIL => 0,
89 TESTS_EXPECTED_FAIL => 0,
90 TESTS_ERROR => 0,
91 TESTS_SKIP => 0,
94 my $msg_ops = new Subunit::Filter($opt_prefix, \@expected_failures,
95 $opt_strip_ok_output);
97 exit(parse_results($msg_ops, $statistics, *STDIN));