1 # Copyright (c) 2009-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 => 18;
23 use lib "@amperldir@";
24 use Installcheck::Config;
25 use Installcheck::Run qw(run run_err run_get load_vtape vtape_dir);
26 use Amanda::Device qw( :constants );
27 use Amanda::Config qw( :init :getconf );
30 use Amanda::Constants;
35 Amanda::Debug::dbopen("installcheck");
36 Installcheck::log_test_output();
38 $testconf = Installcheck::Run::setup();
39 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share\" installcheck-test");
40 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-a\" installcheck-test");
41 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-b\" installcheck-test");
44 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
45 my ($cfgerr_level, @cfgerr_errors) = config_errors();
46 if ($cfgerr_level >= $CFGERR_WARNINGS) {
47 config_print_errors();
48 BAIL_OUT("config errors");
51 #Check ARGV argument, extra quoting because of perl.
52 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\\\\\\\\windows\\\\\\\\share'),
53 qr/Argument '\\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
56 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\windows\\\\share'),
57 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
60 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\windows\\share'),
61 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
64 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\windows\share'),
65 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
68 #Check sheel quoting, extra quoting because of perl
69 like(run_get('amadmin TESTCONF force localhost \\\\\\\\\\\\\\\\windows\\\\\\\\share'),
70 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
73 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\\\\\\\\\windows\\\\\\\\share"'),
74 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
77 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\\\\\\\\\windows\\\\\\\\share\''),
78 qr/\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
81 like(run_get('amadmin TESTCONF force localhost \\\\\\\\windows\\\\share'),
82 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
85 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\windows\\\\share"'),
86 qr/\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
89 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\windows\\\\share\''),
90 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
93 like(run_get('amadmin TESTCONF force localhost \\\\windows\\share'),
94 qr/Argument '\\windowsshare' matches neither a host nor a disk; quoting may not be correct./,
97 like(run_get('amadmin TESTCONF force localhost "\\\\windows\\share"'),
98 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
101 like(run_get('amadmin TESTCONF force localhost \'\\\\windows\\share\''),
102 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
105 like(run_get('amadmin TESTCONF force localhost share'),
106 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
109 like(run_get('amadmin TESTCONF force localhost windows'),
110 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run.
111 amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
112 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,
115 like(run_get('amadmin TESTCONF force localhost share-\*'),
116 qr/amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
117 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,
120 like(run_get('amadmin TESTCONF force localhost share-a share-a'),
121 qr/^amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.$/,
124 like(run_get('amadmin TESTCONF balance --days 12'),
125 qr/No data to report on yet.$/,