1 # Copyright (c) 2006 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, 505 N Mathlida Ave, Suite 120
17 # Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
19 use Test::More qw( no_plan );
22 use lib "@amperldir@";
26 my $cmd = "$sbindir/amdevcheck " . join(" ", @_) . " 2>&1";
35 # First, try amgetconf out without a config
37 like(amdevcheck(), qr(\AUsage: )i,
38 "bare 'amdevcheck' gives usage message");
39 like(amdevcheck("this-probably-doesnt-exist"), qr(could not open conf file)i,
40 "error message when configuration parameter doesn't exist");
43 # Next, work against a basically empty config
45 # this is re-created for each test
46 $testconf = Amconfig->new();
47 $testconf->add_param("tapedev", '"/dev/null"');
51 like(amdevcheck('TESTCONF'), qr{File /dev/null is not a tape device},
52 "uses tapedev by default");
55 # Now use a config with a vtape
57 # this is re-created for each test
58 $testconf = Amconfig->new();
59 $testconf->setup_vtape();
62 is_deeply([ sort split "\n", amdevcheck('TESTCONF') ],
63 [ sort "VOLUME_UNLABELED", "VOLUME_ERROR", "DEVICE_ERROR" ],
64 "empty vtape described as VOLUME_UNLABELED, VOLUME_ERROR, DEVICE_ERROR");
66 like(amdevcheck('TESTCONF', "/dev/null"), qr{File /dev/null is not a tape device},
67 "can override device on the command line");