1 # Copyright (c) 2009 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 => 16;
21 use lib "@amperldir@";
22 use Installcheck::Config;
23 use Installcheck::Run qw(run run_err run_get load_vtape vtape_dir);
24 use Amanda::Device qw( :constants );
25 use Amanda::Config qw( :init :getconf );
28 use Amanda::Constants;
33 Amanda::Debug::dbopen("installcheck");
34 Installcheck::log_test_output();
36 $testconf = Installcheck::Run::setup();
37 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share\" installcheck-test");
38 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-a\" installcheck-test");
39 $testconf->add_dle("localhost \"\\\\\\\\windows\\\\share-b\" installcheck-test");
42 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
43 my ($cfgerr_level, @cfgerr_errors) = config_errors();
44 if ($cfgerr_level >= $CFGERR_WARNINGS) {
45 config_print_errors();
46 BAIL_OUT("config errors");
49 #Check ARGV argument, extra quoting because of perl.
50 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\\\\\\\\windows\\\\\\\\share'),
51 qr/Argument '\\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
54 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\\\\\windows\\\\share'),
55 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
58 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\\\windows\\share'),
59 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
62 like(run_get('amadmin', 'TESTCONF', 'force', 'localhost', '\\windows\share'),
63 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
66 #Check sheel quoting, extra quoting because of perl
67 like(run_get('amadmin TESTCONF force localhost \\\\\\\\\\\\\\\\windows\\\\\\\\share'),
68 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
71 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\\\\\\\\\windows\\\\\\\\share"'),
72 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
75 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\\\\\\\\\windows\\\\\\\\share\''),
76 qr/\\\\\\\\\\\\\\\windows\\\\\\\\share' matches neither a host nor a disk; quoting may not be correct./,
79 like(run_get('amadmin TESTCONF force localhost \\\\\\\\windows\\\\share'),
80 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
83 like(run_get('amadmin TESTCONF force localhost "\\\\\\\\windows\\\\share"'),
84 qr/\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
87 like(run_get('amadmin TESTCONF force localhost \'\\\\\\\\windows\\\\share\''),
88 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
91 like(run_get('amadmin TESTCONF force localhost \\\\windows\\share'),
92 qr/Argument '\\windowsshare' matches neither a host nor a disk; quoting may not be correct./,
95 like(run_get('amadmin TESTCONF force localhost "\\\\windows\\share"'),
96 qr/Argument '\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
99 like(run_get('amadmin TESTCONF force localhost \'\\\\windows\\share\''),
100 qr/Argument '\\\\windows\\share' matches neither a host nor a disk; quoting may not be correct./,
103 like(run_get('amadmin TESTCONF force localhost share'),
104 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run./,
107 like(run_get('amadmin TESTCONF force localhost windows'),
108 qr/amadmin: localhost:\\\\windows\\share is set to a forced level 0 at next run.
109 amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
110 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,
113 like(run_get('amadmin TESTCONF force localhost share-\*'),
114 qr/amadmin: localhost:\\\\windows\\share-a is set to a forced level 0 at next run.
115 amadmin: localhost:\\\\windows\\share-b is set to a forced level 0 at next run.$/,