X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=installcheck%2Famtapetype.pl;h=c1b2040b703a11fe532fc72782c733f646d4e34a;hb=fd48f3e498442f0cbff5f3606c7c403d0566150e;hp=23d93d72065c38d0df9f1c1e7cb736145a9f5486;hpb=96f35b20267e8b1a1c846d476f27fcd330e0b018;p=debian%2Famanda diff --git a/installcheck/amtapetype.pl b/installcheck/amtapetype.pl index 23d93d7..c1b2040 100644 --- a/installcheck/amtapetype.pl +++ b/installcheck/amtapetype.pl @@ -1,4 +1,4 @@ -# Copyright (c) 2005-2008 Zmanda Inc. All Rights Reserved. +# Copyright (c) 2008, 2009, 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 @@ -13,13 +13,13 @@ # 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 => 2; +use Test::More tests => 5; use lib "@amperldir@"; -use Installcheck::Run qw(run run_get run_err); +use Installcheck::Run qw(run run_get run_err vtape_dir); ## # First, check that the script runs -- this is essentially a syntax/strict @@ -30,5 +30,23 @@ ok(!run('amtapetype'), like($Installcheck::Run::stderr, qr(\AUsage: )i, ".. and gives usage message on stderr"); -# amtapetype demands far more resources than we can allow it to use in a -# test situation, so for now this is the best we can do. +## +# Set up a small vtape to write to + +my $testconf = Installcheck::Run::setup(); +$testconf->add_device("smallvtape", [ + "tapedev" => '"file:' . vtape_dir() . '"', + "device_property" => '"MAX_VOLUME_USAGE" "2m"', # need at least 1M +]); +$testconf->write(); + +like(run_get('amtapetype', 'TESTCONF', 'smallvtape'), + qr/define tapetype unknown-tapetype.*blocksize 32 kbytes/s, + "amtapetype runs successfully on a small vtape"); + +ok(run_err('amtapetype', 'TESTCONF', 'smallvtape'), + "a second run on the same device fails because -f isn't used") or die; + +like(run_get('amtapetype', 'TESTCONF', '-f', '-b', '33000', 'smallvtape'), + qr/add device_property/, + "with a non-kilobyte block size, directs user to add a device_property");