1 # Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License version 2 as published
5 # by the Free Software Foundation.
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
19 use Test::More tests => 10;
23 use lib "@amperldir@";
25 use Installcheck::Run qw( run run_get );
26 use Installcheck::Catalogs;
28 use Amanda::Constants;
31 my $testconf = Installcheck::Run::setup();
34 ## try a few various options with a pretty normal logfile
36 $cat = Installcheck::Catalogs::load('normal');
39 ok(run('amstatus', 'TESTCONF'),
40 "plain amstatus runs without error");
41 like($Installcheck::Run::stdout,
42 qr{clienthost:/some/dir\s*0\s*100k\s*finished\s*\(13:01:53\)},
43 "output is reasonable");
45 ok(run('amstatus', 'TESTCONF', '--summary'),
46 "amstatus --summary runs without error");
47 unlike($Installcheck::Run::stdout,
48 qr{clienthost:/some/dir\s*0\s*100k\s*finished\s*\(13:01:53\)},
49 "output does not contain the finished dump");
50 like($Installcheck::Run::stdout,
52 "output contains summary info");
54 ## now test a file with spaces and other funny characters in filenames
56 $cat = Installcheck::Catalogs::load('quoted');
59 ok(run('amstatus', 'TESTCONF'),
60 "amstatus runs without error with quoted disknames");
61 like($Installcheck::Run::stdout,
62 # note that amstatus' output is quoted, so backslashes are doubled
63 qr{clienthost:"C:\\\\Some Dir\\\\"\s*0\s*100k\s*finished\s*\(13:01:53\)},
66 ## now test a chunker partial result
68 $cat = Installcheck::Catalogs::load('chunker-partial');
71 ok(!run('amstatus', 'TESTCONF'),
72 "amstatus return error with chunker partial");
73 is($Installcheck::Run::exit_code, 4,
74 "correct exit code for chunker partial");
75 like($Installcheck::Run::stdout,
76 qr{localhost:/etc 0 backup failed: dumper: \[/usr/sbin/tar returned error\] \(7:49:23\)},