File: errors-t

package info (click to toggle)
kstart 4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,884 kB
  • sloc: ansic: 5,937; sh: 4,785; perl: 2,130; makefile: 142
file content (42 lines) | stat: -rwxr-xr-x 1,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w
#
# Tests for error handling in krenew.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2021 Russ Allbery <eagle@eyrie.org>
# Copyright 2011-2012
#     The Board of Trustees of the Leland Stanford Junior University
#
# SPDX-License-Identifier: MIT

use Test::More;

# The full path to the newly-built k5start client.
our $KRENEW = "$ENV{C_TAP_BUILD}/../commands/krenew";

# Load our test utility programs.
require "$ENV{C_TAP_SOURCE}/libtest.pl";

# Don't overwrite the user's ticket cache.
$ENV{KRB5CCNAME} = 'krb5cc_test';

# Test invalid options.
our @OPTIONS = (
    [ [ qw/-H 0/    ], '-H limit argument 0 invalid' ],
    [ [ qw/-H -1/   ], '-H limit argument -1 invalid' ],
    [ [ qw/-H 4foo/ ], '-H limit argument 4foo invalid' ],
    [ [ qw/-K 4foo/ ], '-K interval argument 4foo invalid' ],
    [ [ qw/-H4  a/  ], '-H option cannot be used with a command' ],
    [ [ qw/-s/      ], '-s option only makes sense with a command to run' ]
);

# Test plan.
plan tests => scalar (@OPTIONS) * 3;

# Run the invalid option tests.
for my $opt (@OPTIONS) {
    my ($out, $err, $status) = command ($KRENEW, @{ $opt->[0] });
    is ($status, 1, "krenew @{ $opt->[0] } fails");
    is ($out, '', ' with no output');
    is ($err, 'krenew: ' . $opt->[1] . "\n", ' and correct error');
}