fix bug 4568, support user specified OS in xcattest configuration file

This commit is contained in:
litingt 2015-02-12 00:40:55 -08:00
parent 662a62c57a
commit d41512f24c

View File

@ -192,7 +192,7 @@ sub getConfig
}
}elsif ($type eq "Object") {
##OBJECT BLOCK##
if($line =~ /(\w+)\s*=\s*([:\w\.\-]+)/) {
if($line =~ /(\w+)\s*=\s*([:\w\.\-]+)/) {
$attr = $1;
$value = $2;
if($attr eq "Name"){
@ -338,7 +338,10 @@ sub init
my @output = runcmd("uname");
$config{var}{OS} = $output[0];
log_this("Detecting: OS = $config{var}{OS}");
}
} else {
$config{var}{OS} = lc($config{var}{OS});
}
if(!exists $config{var}{ARCH}){
if(!exists $config{var}{CN}){
$config{var}{ARCH} = "Unknown";
@ -536,21 +539,25 @@ sub loadcase
next if $skip;
$string1=$1;
if($string1 =~ /^rhels\s*/ && -f "/etc/redhat-release"){
$cases[$i]->{os}="Linux";
$cases[$i]->{os}="rhels";
}elsif($string1 =~ /^sles\s*/ && -f "/etc/SuSE-release"){
$cases[$i]->{os}="Linux";
$cases[$i]->{os}="sles";
}elsif($string1 =~ /^ubuntu\s*/ && -f "/etc/lsb-release"){
$cases[$i]->{os}="Linux";
$cases[$i]->{os}="ubuntu";
}
else{
$cases[$i]->{os}=$string1;
}
chomp($cases[$i]->{os});
chomp($config{var}{OS});
if($cases[$i]->{os} !~ /$config{var}{OS}/){
push(@notrightcase, $cases[$i]->{name});
pop(@rightcase);
$skip = 1;
if((($config{var}{OS} =~ /^Linux\s*/) && ($cases[$i]->{os} =~ /^aix\s*/)) || (($config{var}{OS} =~ /^aix\s*/)&&($cases[$i]->{os} !~ /^aix\s*/)) || (($config{var}{OS} =~ /^rhels\s*/) && ($cases[$i]->{os} !~ /^Linux\s*/)) || (($config{var}{OS} =~ /^sles\s*/) && ($cases[$i]->{os} !~ /^Linux\s*/)) || (($config{var}{OS} =~ /^ubuntu\s*/) && ($cases[$i]->{os} !~ /^Linux\s*/))){
push(@notrightcase, $cases[$i]->{name});
pop(@rightcase);
$skip = 1;
}
}
}elsif($line =~ /^arch\s*:\s*(\w[\w\,]+)/){