scstadmin: Add more regression tests

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5070 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-10-10 16:40:02 +00:00
parent a02cf2379d
commit ca750d6383
5 changed files with 42 additions and 10 deletions

View File

@@ -4,15 +4,24 @@ use strict;
use Test;
BEGIN {
plan tests => ($> == 0) ? 2 : 0;
plan tests => ($> == 0) ? 3 : 0;
}
if ($> == 0) {
system("/etc/init.d/scst stop");
ok(system("killall iscsi-scstd >/dev/null 2>&1; " .
"modprobe -r scst_local; " .
"modprobe -r iscsi-scst; " .
"modprobe -r ib_srpt; " .
"modprobe -r qla2x00tgt; " .
"modprobe -r qla2xxx_scst; " .
"modprobe -r scst_vdisk"), 0);
ok(!(-d "/sys/module/scst"));
ok(system("modprobe scst_local add_default_tgt=0 && " .
"modprobe iscsi-scst && " .
"modprobe ib_srpt && " .
"modprobe qla2x00tgt && " .
"modprobe scst_vdisk && " .
"/usr/local/sbin/iscsi-scstd"), 0);
}

View File

@@ -4,7 +4,7 @@ use strict;
use Test;
BEGIN {
plan tests => 179;
plan tests => 181;
}
use Data::Dumper;
@@ -17,7 +17,20 @@ sub addTargets {
ok($SCST->{'err_string'},
"targets(): Driver 'no-such-driver' is not available");
ok(Dumper($SCST->drivers()), Dumper(['iscsi', 'scst_local']));
my %drivers = map { $_ => 1 } @{$SCST->drivers()};
ok(exists($drivers{'iscsi'}));
ok(exists($drivers{'scst_local'}));
my $all_hw_tgt = 1;
for my $driver (@{$SCST->drivers()}) {
for my $target (@{$SCST->targets($driver)}) {
if ($SCST->targetType($driver, $target) !=
$SCST::SCST::TGT_TYPE_HARDWARE) {
$all_hw_tgt = undef;
}
}
}
ok($all_hw_tgt);
ok(Dumper($SCST->targets()), Dumper(undef));
ok(Dumper($SCST->targets('no-such-driver')), Dumper(undef));

View File

@@ -4,7 +4,7 @@ use strict;
use Test;
BEGIN {
plan tests => 64;
plan tests => 65;
}
use Data::Dumper;
@@ -13,7 +13,9 @@ use SCST::SCST;
sub setup {
my $SCST = shift;
ok(Dumper($SCST->drivers()), Dumper(['iscsi', 'scst_local']));
my %drivers = map { $_ => 1 } @{$SCST->drivers()};
ok(exists($drivers{'iscsi'}));
ok(exists($drivers{'scst_local'}));
ok($SCST->openDevice("vdisk_fileio", "disk01",
{ 'filename' => '/proc/cpuinfo' }), 0);

View File

@@ -4,7 +4,7 @@ use strict;
use Test;
BEGIN {
plan tests => 56;
plan tests => 57;
}
use Data::Dumper;
@@ -13,7 +13,9 @@ use SCST::SCST;
sub setup {
my $SCST = shift;
ok(Dumper($SCST->drivers()), Dumper(['iscsi', 'scst_local']));
my %drivers = map { $_ => 1 } @{$SCST->drivers()};
ok(exists($drivers{'iscsi'}));
ok(exists($drivers{'scst_local'}));
ok($SCST->openDevice("vdisk_fileio", "disk01",
{ 'filename' => '/proc/cpuinfo' }), 0);

View File

@@ -4,11 +4,17 @@ use strict;
use Test;
BEGIN {
plan tests => 1;
plan tests => 2;
}
if ($> == 0) {
system("/etc/init.d/scst stop");
ok(system("killall iscsi-scstd; " .
"modprobe -r scst_local; " .
"modprobe -r iscsi-scst; " .
"modprobe -r ib_srpt; " .
"modprobe -r qla2x00tgt; " .
"modprobe -r qla2xxx_scst; " .
"modprobe -r scst_vdisk"), 0);
ok(!(-d "/sys/module/scst"));
} else {
ok(1);