1 # Copyright (c) 2008, 2009, 2010 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 => 5;
21 use lib "@amperldir@";
22 use Installcheck::Run qw(run run_get run_err vtape_dir);
25 # First, check that the script runs -- this is essentially a syntax/strict
26 # check of the script.
28 ok(!run('amtapetype'),
29 "'amtapetype' with no arguments returns an error exit status");
30 like($Installcheck::Run::stderr, qr(\AUsage: )i,
31 ".. and gives usage message on stderr");
34 # Set up a small vtape to write to
36 my $testconf = Installcheck::Run::setup();
37 $testconf->add_device("smallvtape", [
38 "tapedev" => '"file:' . vtape_dir() . '"',
39 "device_property" => '"MAX_VOLUME_USAGE" "2m"', # need at least 1M
43 like(run_get('amtapetype', 'TESTCONF', 'smallvtape'),
44 qr/define tapetype unknown-tapetype.*blocksize 32 kbytes/s,
45 "amtapetype runs successfully on a small vtape");
47 ok(run_err('amtapetype', 'TESTCONF', 'smallvtape'),
48 "a second run on the same device fails because -f isn't used") or die;
50 like(run_get('amtapetype', 'TESTCONF', '-f', '-b', '33000', 'smallvtape'),
51 qr/add device_property/,
52 "with a non-kilobyte block size, directs user to add a device_property");