ff6a150cfdd62b3f2dcfbcb221f6667850634ff7
[debian/amanda] / installcheck / amcheckdump.pl
1 use Test::More qw( no_plan );
2
3 use Amconfig;
4
5 use lib "@amperldir@";
6 use Amanda::Paths;
7
8 sub amcheckdump {
9     my $cmd = "$sbindir/amcheckdump " . join(" ", @_) . " 2>&1";
10     my $result = `$cmd`;
11     chomp $result;
12     return $result;
13 }
14
15 my $testconf;
16
17 ##
18 # First, try amgetconf out without a config
19
20 like(amcheckdump(), qr/\AUSAGE:/i, 
21     "bare 'amcheckdump' gives usage message");
22 like(amcheckdump("this-probably-doesnt-exist"), qr(could not open conf file)i, 
23     "error message when configuration parameter doesn't exist");
24
25 ##
26 # Now use a config with a vtape
27
28 # this is re-created for each test
29 $testconf = Amconfig->new();
30 $testconf->setup_vtape();
31 $testconf->write();
32
33 like(amcheckdump("TESTCONF"), qr(could not find)i,
34      "'amcheckdump' on a brand-new config finds no dumps.");