AFS-Monitor
view release on metacpan or search on metacpan
examples/xstat_cm_test view on Meta::CPAN
#!/usr/bin/perl -w
#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
# Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $Revision: 1.8 $ $Date: 2006/05/31 16:22:51 $ $Author: alfw $
#
use blib;
use strict;
use AFS::Monitor qw(xstat_cm_test constant);
use Data::Dumper;
my @cmname = ("virtue.openafs.org", "andrew.e.kth.se");
my @collID = (0, 1, 2);
my @tests; # choose which tests to run
$tests[1] = 1; # test of cmname @cmname and collIDs @collID
$tests[2] = 0; # test of cmname but no collID
$tests[3] = 0; # test of single cmname with collID
$tests[4] = 0; # test of single cmname but no single collID
my $all = 1;
my $showdump = 0; # print entire contents of hash for each test
my $formatted = 1; # print formatted like original xstat_cm_test program
print "# Starting now... #\n";
my $result;
if ($all || $tests[1]) {
print "\n******** TEST 1: ********\n";
print "\nxstat_cm_test -cmname ", join(" ", @cmname),
" -collID ", join(" ", @collID), "\n\n";
$result = xstat_cm_test(cmname => \@cmname,
collID => \@collID);
parse_result($result);
}
if ($all || $tests[2]) {
print "\n******** TEST 2: ********\n";
print "\nxstat_cm_test -cmname ", join(" ", @cmname), "\n\n";
$result = xstat_cm_test(cmname => \@cmname);
parse_result($result);
}
if ($all || $tests[3]) {
print "\n******** TEST 3: ********\n";
print "\nxstat_cm_test -cmname ", $cmname[0],
" -collID 2\n\n";
$result = xstat_cm_test(cmname => $cmname[0],
collID => 2);
parse_result($result);
}
if ($all || $tests[4]) {
print "\n******** TEST 4: ********\n";
print "\nxstat_cm_test -cmname ", $cmname[0], "\n\n";
$result = xstat_cm_test(cmname => $cmname[0]);
parse_result($result);
}
sub parse_result {
my $info = shift;
if ($AFS::CODE) {
print "Error case: ", ref($info), "\n" if (defined($info));
# die("Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n");
print "Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n";
return;
}
if ($showdump) {
( run in 1.086 second using v1.01-cache-2.11-cpan-39bf76dae61 )