1 # Copyright (c) 2009-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 => 23;
24 use lib "@amperldir@";
25 use Installcheck::Config;
26 use Installcheck::Run qw(run run_err run_get load_vtape vtape_dir);
27 use Amanda::Device qw( :constants );
28 use Amanda::Config qw( :init :getconf );
31 use Amanda::Constants;
36 Amanda::Debug::dbopen("installcheck");
37 Installcheck::log_test_output();
39 $testconf = Installcheck::Run::setup();
40 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share\" installcheck-test");
41 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-a\" installcheck-test");
42 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-b\" installcheck-test");
45 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
46 my ($cfgerr_level, @cfgerr_errors) = config_errors();
47 if ($cfgerr_level >= $CFGERR_WARNINGS) {
48 config_print_errors();
49 BAIL_OUT("config errors");
52 #Check ARGV argument, extra quoting because of perl.
53 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\\\\\\\\windows\\\\\\\\share'),
54 qr/Argument '\\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
57 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\windows\\\\share'),
58 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
61 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\windows\\share'),
62 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
65 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\windows\share'),
66 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
69 #Check sheel quoting, extra quoting because of perl
70 like(run_get('amadmin TESTCONF force localhost \\\\\\\\\\\\\\\\windows\\\\\\\\share'),
71 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
74 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\\\\\\\\\windows\\\\\\\\share"'),
75 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
78 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\\\\\\\\\windows\\\\\\\\share\''),
79 qr/\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
82 like(run_get('amadmin TESTCONF force localhost \\\\\\\\windows\\\\share'),
83 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
86 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\windows\\\\share"'),
87 qr/\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
90 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\windows\\\\share\''),
91 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
94 like(run_get('amadmin TESTCONF force localhost \\\\windows\\share'),
95 qr/Argument '\\windowsshare' matches neither a host nor a disk; quoting may not be correct./,
98 like(run_get('amadmin TESTCONF force localhost "\\\\windows\\share"'),
99 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
102 like(run_get('amadmin TESTCONF force localhost \'\\\\windows\\share\''),
103 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
106 like(run_get('amadmin TESTCONF force localhost share'),
107 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
110 like(run_get('amadmin TESTCONF force localhost windows'),
111 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run.
112 amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
113 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,
116 like(run_get('amadmin TESTCONF force localhost share-\*'),
117 qr/amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
118 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,
121 like(run_get('amadmin TESTCONF force localhost share-a share-a'),
122 qr/^amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.$/,
125 like(run_get('amadmin TESTCONF balance --days 12'),
126 qr/No data to report on yet.$/,
129 like(run_get('amadmin TESTCONF force =localhost share-a'),
130 qr/^amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.$/,
133 like(run_get('amadmin TESTCONF force =localhost =share-a'),
134 qr/^Argument '=share-a' matches neither a host nor a disk.$/,
137 like(run_get('amadmin --exact-match TESTCONF force localhost share-a'),
138 qr/^Argument '=share-a' matches neither a host nor a disk.$/,
141 like(run_get('amadmin TESTCONF force =localhost \'=\\\\windows\\share-a\''),
142 qr/^amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.$/,
145 like(run_get('amadmin --exact-match TESTCONF force localhost \'\\\\windows\\share-a\''),
146 qr/^amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.$/,