Imported Upstream version 3.3.3
[debian/amanda] / installcheck / Amanda_Taper_Scan.pl
index 92550f100e47922e51f3e70d9580c37665c877da..8d37aa6e511099a1e23d7d0a04e1a2995e9cd800 100644 (file)
@@ -1,8 +1,9 @@
 # Copyright (c) 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
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -38,10 +39,11 @@ Installcheck::log_test_output();
 # and disable Debug's die() and warn() overrides
 Amanda::Debug::disable_die_override();
 
-my $tapelist = "$Installcheck::TMP/tapelist";
+my $tapelist_filename = "$Installcheck::TMP/tapelist";
+my $tapelist = Amanda::Tapelist->new($tapelist_filename);
 sub set_tapelist {
     my ($content) = @_;
-    open(my $fh, ">", $tapelist) or die("opening '$tapelist': $!");
+    open(my $fh, ">", $tapelist_filename) or die("opening '$tapelist_filename': $!");
     print $fh $content;
     close($fh);
 }
@@ -51,8 +53,8 @@ sub set_tapelist {
 # methods are never invoked in this test.
 my $taperscan = Amanda::Taper::Scan->new(
     algorithm => "traditional",
-    changer => {}, # (not used)
-    tapelist_filename => $tapelist,
+    changer => undef, # (not used)
+    tapelist => $tapelist,
     tapecycle => 1, # will be changed periodically below
     labelstr => "TEST-[0-9]",
     autolabel => { 'template'    => "TEST-%",
@@ -65,6 +67,7 @@ set_tapelist(<<EOF);
 20090424173002 TEST-2 reuse
 20090424173003 TEST-3 reuse
 20090424173004 TEST-4 reuse
+20090424172000 CONF-4 reuse
 EOF
 $taperscan->read_tapelist();
 
@@ -140,3 +143,5 @@ ok(!$taperscan->is_reusable_volume(label => "TEST-2", new_label_ok => 0), " TEST
 ok(!$taperscan->is_reusable_volume(label => "TEST-3", new_label_ok => 0), " TEST-3 not reusable");
 ok(!$taperscan->is_reusable_volume(label => "TEST-4", new_label_ok => 0), " TEST-4 not reusable");
 
+$taperscan->quit();
+