Blame tests/CuSkip.pm

Packit 709fb3
package CuSkip;
Packit 709fb3
# Skip a test: emit diag to log and to stderr, and exit 77
Packit 709fb3
Packit 709fb3
# Copyright (C) 2011-2015, 2017 Free Software Foundation, Inc.
Packit 709fb3
Packit 709fb3
# This program is free software: you can redistribute it and/or modify
Packit 709fb3
# it under the terms of the GNU General Public License as published by
Packit 709fb3
# the Free Software Foundation, either version 3 of the License, or
Packit 709fb3
# (at your option) any later version.
Packit 709fb3
Packit 709fb3
# This program is distributed in the hope that it will be useful,
Packit 709fb3
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 709fb3
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 709fb3
# GNU General Public License for more details.
Packit 709fb3
Packit 709fb3
# You should have received a copy of the GNU General Public License
Packit 709fb3
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 709fb3
Packit 709fb3
use strict;
Packit 709fb3
use warnings;
Packit 709fb3
Packit 709fb3
our $ME = $0 || "";
Packit 709fb3
Packit 709fb3
# Emit a diagnostic both to stderr and to $stderr_fileno_.
Packit 709fb3
# FIXME: don't hard-code that value (9), since it's already defined in init.cfg.
Packit 709fb3
sub skip ($)
Packit 709fb3
{
Packit 709fb3
  my ($msg) = @_;
Packit 709fb3
  my $stderr_fileno_ = 9;
Packit 709fb3
  warn $msg;
Packit 709fb3
  open FH, ">&$stderr_fileno_"
Packit 709fb3
    or warn "$ME: failed to dup stderr\n";
Packit 709fb3
  print FH $msg;
Packit 709fb3
  close FH
Packit 709fb3
    or warn "$ME: failed to close FD $stderr_fileno_\n";
Packit 709fb3
  exit 77;
Packit 709fb3
}
Packit 709fb3
Packit 709fb3
1;