Debian Codegraph @

tests/CuSkip.pm

raw
1 package CuSkip;
2 # This file (CuSkip.pm) was copied from GNU Coretils.
3 # It has the following copyright notice and license:
4
5 # Skip a test: emit diag to log and to stderr, and exit 77
6
7 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
8
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 use strict;
23 use warnings;
24
25 our $ME = $0 || "<???>";
26
27 # Emit a diagnostic both to stderr and to $stderr_fileno_.
28 # FIXME: don't hard-code that value (9), since it's already defined in init.cfg.
29 sub skip ($)
30 {
31 my ($msg) = @_;
32 my $stderr_fileno_ = 9;
33 warn $msg;
34 open FH, ">&$stderr_fileno_"
35 or warn "$ME: failed to dup stderr\n";
36 print FH $msg;
37 close FH
38 or warn "$ME: failed to close FD $stderr_fileno_\n";
39 exit 77;
40 }
41
42 1;