c154f38cf4c0adaf6ef3110c5ebeb3b600d61881
[platform/upstream/coreutils.git] / tests / misc / test-diag
1 #!/bin/sh
2
3 : ${PERL=perl}
4 : ${srcdir=.}
5
6 $PERL -e 1 > /dev/null 2>&1 || {
7   echo 1>&2 "$0: configure didn't find a usable version of Perl," \
8     "so can't run this test"
9   exit 77
10 }
11
12 exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
13 require 5.003;
14 use strict;
15
16 (my $program_name = $0) =~ s|.*/||;
17
18 # Turn off localisation of executable's ouput.
19 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
20
21 my $prog = '../../src/test';
22 my @Tests =
23     (
24      # In coreutils-5.93, this diagnostic lacked the newline.
25      ['o', '-o arg', {ERR => "$prog: extra argument `-o'\n"}, {EXIT => 2}],
26     );
27
28 my $save_temps = $ENV{DEBUG};
29 my $verbose = $ENV{VERBOSE};
30
31 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
32 exit $fail;
33 EOF