1 # Copyright (c) 2005-2008 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 Mathlida Ave, Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
19 use Test::More tests => 8;
21 use lib "@amperldir@";
22 use Cwd qw(abs_path getcwd);
23 use Installcheck::Config;
24 use Installcheck::Run qw(run run_err $diskname amdump_diag);
25 use Amanda::Config qw( :init );
32 # Run amdump with client- and server-side scripts
34 my $templog = $Amanda::Paths::AMANDA_TMPDIR . "/check-script." . $$;
42 if (!open($logfile, "<", $templog)) {
44 diag("Logfile '$templog' does not exist.");
53 diag(" Line: $linenum");
54 diag("Expected: '$exp'");
62 diag(" Line: $linenum");
63 diag("Expected: '$exp'");
72 diag(" Line: $linenum");
73 diag("Expected: EOF");
81 # check script on client
83 $testconf = Installcheck::Run::setup();
84 $testconf->add_param('label_new_tapes', '"TESTCONF%%"');
86 $testconf->add_dle(<<EODLE);
87 localhost diskname1 $diskname {
92 property "atime_preserve" "no" # note underscore
97 execute-on pre-dle-amcheck, post-dle-amcheck, pre-dle-estimate, post-dle-estimate, pre-dle-backup, post-dle-backup
98 property "logfile" "$templog"
105 ok(run('amcheck', '-c', 'TESTCONF'), "amcheck runs successfully for client scripts.");
107 verify_log("amcheck invokes correct script commands",
108 "TESTCONF pre-dle-amcheck client localhost diskname1 $diskname ",
109 "TESTCONF post-dle-amcheck client localhost diskname1 $diskname ",
113 ok(run('amdump', 'TESTCONF'), "amdump runs successfully for client scripts.")
116 verify_log("amdump invokes correct script commands",
117 "TESTCONF pre-dle-estimate client localhost diskname1 $diskname 0",
118 "TESTCONF post-dle-estimate client localhost diskname1 $diskname 0",
119 "TESTCONF pre-dle-backup client localhost diskname1 $diskname 0",
120 "TESTCONF post-dle-backup client localhost diskname1 $diskname 0",
123 Installcheck::Run::cleanup();
125 #check script on server
126 $testconf = Installcheck::Run::setup();
127 $testconf->add_param('label_new_tapes', '"TESTCONF%%"');
129 $testconf->add_dle(<<EODLE);
130 localhost diskname2 $diskname {
132 program "APPLICATION"
135 property "atime-preserve" "no"
138 plugin "amlog-script"
140 execute-on pre-host-amcheck, post-host-amcheck, pre-host-estimate, post-host-estimate, pre-host-backup, post-host-backup
141 property "logfile" "$templog"
148 ok(run('amcheck', '-c', 'TESTCONF'), "amcheck runs successfully for server scripts.");
150 verify_log("amcheck invokes correct script commands",
151 "TESTCONF pre-host-amcheck server localhost diskname2 $diskname ",
152 "TESTCONF post-host-amcheck server localhost diskname2 $diskname ",
156 ok(run('amdump', 'TESTCONF'), "amdump runs successfully for server scripts.")
159 verify_log("amdump invokes correct script commands",
160 "TESTCONF pre-host-estimate server localhost diskname2 $diskname 0",
161 "TESTCONF post-host-estimate server localhost diskname2 $diskname 0",
162 "TESTCONF pre-host-backup server localhost diskname2 $diskname ",
163 "TESTCONF post-host-backup server localhost diskname2 $diskname ",
167 Installcheck::Run::cleanup();