1 # Copyright (c) 2010-2012 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
20 use Test::More tests => 10;
22 use lib "@amperldir@";
25 use Installcheck::Run qw(run run_err $diskname);
27 use Amanda::Constants;
28 use Amanda::Util qw( slurp burp );
29 use Amanda::Config qw( :init );
31 # this basically gets one run of amserverconfig in for each template, and then
32 # checks that the config loads correctly
37 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
39 my ($cfgerr_level, @cfgerr_errors) = config_errors();
40 ok($cfgerr_level < $CFGERR_WARNINGS, $msg || "..config is OK") or
41 config_print_errors();
46 Installcheck::Run::cleanup();
47 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'S3'),
48 "amserverconfig with S3 template")
49 or diag($Installcheck::Run::stdout);
52 Installcheck::Run::cleanup();
53 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'harddisk'),
54 "amserverconfig with harddisk template")
55 or diag($Installcheck::Run::stdout);
58 Installcheck::Run::cleanup();
59 mkpath(Installcheck::Run::vtape_dir());
60 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'harddisk',
62 '--tapedev', Installcheck::Run::vtape_dir()),
63 "amserverconfig with harddisk template and tapedev and tapecycle")
64 or diag($Installcheck::Run::stdout);
67 Installcheck::Run::cleanup();
68 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'single-tape'),
69 "amserverconfig with single-tape template")
70 or diag($Installcheck::Run::stdout);
74 skip "tape-changer template requires mtx", 2
75 unless $Amanda::Constants::MTX && -x $Amanda::Constants::MTX;
76 Installcheck::Run::cleanup();
77 ok(run("$sbindir/amserverconfig", 'TESTCONF', '--template', 'tape-changer'),
78 "amserverconfig with tape-changer template")
79 or diag($Installcheck::Run::stdout);
83 Installcheck::Run::cleanup();