scstadmin: Make test 06 more robust

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8913 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-05-14 16:37:18 +00:00
parent 29548a4ad7
commit 198cb64c8d

View File

@@ -24,7 +24,7 @@ BEGIN {
unless(grep /blib/, @INC) {
unshift(@INC, File::Spec->catdir($scstadmin_pm_dir, "lib"));
}
plan tests => 5;
plan tests => 6;
}
use Data::Dumper;
@@ -46,12 +46,15 @@ sub testRestoreConfig {
"scstadmin-test-06-$$-1");
my $tmpfilename2 = File::Spec->catfile(File::Spec->tmpdir(),
"scstadmin-test-06-$$-2");
my $scstadmin_output = File::Spec->catfile(File::Spec->tmpdir(),
"scstadmin-test-06-$$-adm-out");
my $diff = File::Spec->catfile(File::Spec->tmpdir(),
"scstadmin-test-06-$$-diff");
ok(system("$scstadmin -clear_config -force -noprompt -no_lip $redirect"), 0);
system("$scstadmin -cont_on_err -no_lip -config $to_be_restored" .
" >/dev/null");
ok(system("$scstadmin -clear_config -force -noprompt -no_lip $redirect"),
0);
ok(system("$scstadmin -cont_on_err -no_lip -config $to_be_restored" .
" > " . $scstadmin_output . " 2>&1"), 256);
ok(system("$scstadmin -write_config $tmpfilename1 >/dev/null"), 0);
ok(system("awk 'BEGIN {t = 0 } /^# Automatically generated by SCST Configurator v/ " .
'{ $0 = "# Automatically generated by SCST Configurator v..." } ' .
@@ -78,6 +81,8 @@ if ($_DEBUG_) {
$redirect = ">/dev/null";
}
unlink("/var/lib/scst/vdev_mode_pages/disk01");
my $SCST = eval { new SCST::SCST($_DEBUG_) };
die("Creation of SCST object failed") if (!defined($SCST));