1 # Copyright (c) 2010-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;
21 use lib "@amperldir@";
24 use Installcheck::Run qw(run run_err $diskname);
26 use Amanda::Constants;
27 use Amanda::Util qw( slurp burp );
28 use Amanda::Config qw( :init );
30 # this basically gets one run of amserverconfig in for each template, and then
31 # checks that the config loads correctly
36 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
38 my ($cfgerr_level, @cfgerr_errors) = config_errors();
39 ok($cfgerr_level < $CFGERR_WARNINGS, $msg || "..config is OK") or
40 config_print_errors();
45 Installcheck::Run::cleanup();
46 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'S3'),
47 "amserverconfig with S3 template")
48 or diag($Installcheck::Run::stdout);
51 Installcheck::Run::cleanup();
52 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'harddisk'),
53 "amserverconfig with harddisk template")
54 or diag($Installcheck::Run::stdout);
57 Installcheck::Run::cleanup();
58 mkpath(Installcheck::Run::vtape_dir());
59 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'harddisk',
61 '--tapedev', Installcheck::Run::vtape_dir()),
62 "amserverconfig with harddisk template and tapedev and tapecycle")
63 or diag($Installcheck::Run::stdout);
66 Installcheck::Run::cleanup();
67 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'single-tape'),
68 "amserverconfig with single-tape template")
69 or diag($Installcheck::Run::stdout);
73 skip "tape-changer template requires mtx", 2
74 unless $Amanda::Constants::MTX && -x $Amanda::Constants::MTX;
75 Installcheck::Run::cleanup();
76 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'tape-changer'),
77 "amserverconfig with tape-changer template")
78 or diag($Installcheck::Run::stdout);
82 Installcheck::Run::cleanup();