add the type and ~~ opt support for xcattest
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8730 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
a8027600c0
commit
4901036f4e
@ -462,7 +462,7 @@ sub loadcase
|
||||
#TODO: description line is treated as a comment line for now
|
||||
next if($line =~ /^description\s*:/);
|
||||
|
||||
if($line =~ /^start\s*:\s*(\w+)/){
|
||||
if($line =~ /^start\s*:\s*([\w-]+)/){
|
||||
$skip = 0;
|
||||
my $name = $1;
|
||||
if( $caserange[0] && !(grep {/^$name$/} @caserange)){
|
||||
@ -506,6 +506,14 @@ sub loadcase
|
||||
pop(@rightcase);
|
||||
$skip = 1;
|
||||
}
|
||||
}elsif($line =~ /^type\s*:\s*(\w[\w\,-]+)/){
|
||||
next if $skip;
|
||||
$cases[$i]->{type}=$1;
|
||||
if($cases[$i]->{type} !~ /$config{var}{TYPE}/){
|
||||
push(@notrightcase, $cases[$i]->{name});
|
||||
pop(@rightcase);
|
||||
$skip = 1;
|
||||
}
|
||||
}elsif($line =~ /^cmd\s*:\s*([\$\w].+)/){
|
||||
next if $skip;
|
||||
$j = $j + 1;
|
||||
@ -663,7 +671,8 @@ sub runcase
|
||||
log_this("CHECK:rc $op $rvalue\t[Pass]");
|
||||
push(@record, "CHECK:rc $op $rvalue\t[Pass]");
|
||||
}
|
||||
} elsif ($check =~ /output\s*([=!~]+)\s*(\S.*)/){
|
||||
} elsif ($check =~ /output\s*([=!~]+)\s*(\S.*)/
|
||||
&& $check !~ /output\s*([=!~])\1/){
|
||||
$lvalue = join ("\n",@output);
|
||||
$op = $1;
|
||||
$rvalue = $2;
|
||||
@ -682,6 +691,40 @@ sub runcase
|
||||
log_this("CHECK:output $op $rvalue\t[Pass]");
|
||||
push(@record, "CHECK:output $op $rvalue\t[Pass]");
|
||||
}
|
||||
} elsif ($check =~ /output\s*~~\s*(\S.*)/){
|
||||
$op = "~~";
|
||||
$failed = 1;
|
||||
$rvalue = $1;
|
||||
$rvalue = getfunc($rvalue);
|
||||
my $num;
|
||||
if ($rvalue =~ /(\d+)/) {
|
||||
$num = $1;
|
||||
}
|
||||
$rvalue =~ s/(\d+)//;
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
if ($line =~ /$rvalue/) {
|
||||
if ($num =~ /^\d+$/) {
|
||||
my $max = $num *1.1;
|
||||
my $min = $num *0.9;
|
||||
$line =~ /.*:.*: (\d+) /;
|
||||
if ($1 < $max && $1 > $min) {
|
||||
$failed = 0;
|
||||
last;
|
||||
}
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($failed){
|
||||
log_this("CHECK:output $op $rvalue $num\t[Failed]");
|
||||
push(@record, "CHECK:output $op $rvalue\t[Failed]");
|
||||
last;
|
||||
} else {
|
||||
log_this("CHECK:output $op $rvalue $num\t[Pass]");
|
||||
push(@record, "CHECK:output $op $rvalue\t[Pass]");
|
||||
}
|
||||
}
|
||||
}
|
||||
$j = $j + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user