Imported Upstream version 3.2.0
[debian/amanda] / installcheck / amcheckdump.pl
index 65919111ae49f191c7ee95402b78af17e8ae0c3d..21fbdd501bbb445177f7e22ae58a10cc05218390 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2007, 2008, 2010 Zmanda, Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 use Test::More tests => 9;
+use strict;
+use warnings;
 
 use lib "@amperldir@";
 use Installcheck::Config;
+use Installcheck::Dumpcache;
 use Installcheck::Run qw(run run_get run_err $diskname);
 use Amanda::Paths;
 
@@ -40,9 +43,6 @@ like(run_err('amcheckdump', 'this-probably-doesnt-exist'), qr(could not open con
 # Now use a config with a vtape and without usetimestamps
 
 $testconf = Installcheck::Run::setup();
-$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
-$testconf->add_param('usetimestamps', 'no');
-$testconf->add_dle("localhost $diskname installcheck-test");
 $testconf->write();
 
 ok(run('amcheckdump', 'TESTCONF'),
@@ -50,8 +50,7 @@ ok(run('amcheckdump', 'TESTCONF'),
 like($Installcheck::Run::stdout, qr(could not find)i,
      "..but finds no dumps.");
 
-BAIL_OUT("amdump failed")
-    unless run('amdump', 'TESTCONF');
+Installcheck::Dumpcache::load("notimestamps");
 
 like(run_get('amcheckdump', 'TESTCONF'), qr(Validating),
     "amcheckdump succeeds, claims to validate something (usetimestamps=no)");
@@ -63,16 +62,9 @@ like(run_get('amcheckdump', 'TESTCONF', '-oorg=installcheck'), qr(Validating),
     "amcheckdump accepts '-o' options on the command line");
 
 ##
-# And a config with usetimestamps enabled
+# Try with usetimestamps enabled
 
-$testconf = Installcheck::Run::setup();
-$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
-$testconf->add_param('usetimestamps', 'yes');
-$testconf->add_dle("localhost $diskname installcheck-test");
-$testconf->write();
-
-BAIL_OUT("amdump failed")
-    unless run('amdump', 'TESTCONF');
+Installcheck::Dumpcache::load("basic");
 
 like(run_get('amcheckdump', 'TESTCONF'), qr(Validating),
     "amcheckdump succeeds, claims to validate something (usetimestamps=yes)");
@@ -82,7 +74,7 @@ like(run_get('amcheckdump', 'TESTCONF'), qr(Validating),
 
 my $vtape1 = Installcheck::Run::vtape_dir(1);
 opendir(my $vtape_dir, $vtape1) || die "can't opendir $vtape1: $!";
-@dump1 = grep { /^0+1/ } readdir($vtape_dir);
+my @dump1 = grep { /^0+1/ } readdir($vtape_dir);
 closedir $vtape_dir;
 
 for my $dumpfile (@dump1) {