2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-13 15:00:15 +00:00

Allow os: testcase tag to specify rhels version

This commit is contained in:
Mark Gurevich
2022-08-26 14:01:31 -04:00
parent f52c2aa7df
commit 9d1e473d2c
7 changed files with 162 additions and 64 deletions

View File

@@ -128,15 +128,15 @@ The xCAT-test test cases are in flat text format, the testing framework will par
#optional, description of the test case
description: what the test case is for?
#optional, environment requirements
os:AIX/Linux
os:AIX/Linux/sles/ubuntu/rhels/rhels7/rhels8
#optional, environment requirements
arch:ppc/x86
arch:ppc/ppc64/ppc64le/x86_64
#optional, environment requirements
hcp:hmc/mm/bmc/fsp
hcp:hmc/mm/bmc/fsp/ipmi/openbmc
#optional, label
label:label1
#required, command need to run
cmd:comand
cmd:command
#optional, check return code of last executed command
check:rc == or != return code
#optional, check output of last executed command
@@ -155,7 +155,7 @@ EXAMPLES
1.
To run all test cases related command rpower:
To run all test cases related to command \ **rpower**\ :
.. code-block:: perl
@@ -167,7 +167,7 @@ EXAMPLES
2.
To run customized bundle with /tmp/config file:
To run customized bundle with \ */tmp/config*\ file:
.. code-block:: perl
@@ -181,7 +181,7 @@ EXAMPLES
3.
To run specified test cases with /tmp/config file:
To run specified test cases with \ */tmp/config*\ file:
.. code-block:: perl
@@ -193,7 +193,7 @@ EXAMPLES
4.
To add a new case to test \ **chvm**\ . In the example, we assume that the min_mem should not be equal to 16 in the lpar profile of computenode. The case name is chvm_custom. It create a test lpar named testnode firstly, that change the min_mem of the lpar to 16 using chvm, then check if min_mem have changed correctly. At last, the testnode be remove to ensure no garbage produced in the cases.
To add a new test case to test \ **chvm**\ . In this example, we assume that the \ **min_mem**\ should not be equal to 16 in the lpar profile of computenode. The case name is \ **chvm_customi**\ . It creates a test lpar named \ **testnode**\ first, then changes the \ **min_mem**\ of the lpar to 16 using \ **chvm**\ , then checks if \ **min_mem**\ have changed correctly. Finally, the \ **testnode**\ is removed.
.. code-block:: perl

View File

@@ -24,11 +24,13 @@ nodeset_cmdline
nodeset_runimg
nodeset_shell
reg_linux_diskfull_installation_flat
reg_linux_diskfull_installation_flat_groups_rh7
reg_linux_diskfull_installation_flat_modules_and_groups_rh8
compare_postscripts
cleanup_postscripts_diskfull
reg_linux_diskless_installation_flat
reg_linux_diskless_installation_flat_squashfs
reg_linux_diskless_installation_flat_modules_and_groups
reg_linux_diskless_installation_flat_modules_and_groups_rh
reg_linux_statelite_installation_flat
cleanup_postscripts_diskless
rmimage_diskless

View File

@@ -24,11 +24,13 @@ nodeset_cmdline
nodeset_runimg
nodeset_shell
reg_linux_diskfull_installation_flat
reg_linux_diskfull_installation_flat_groups_rh7
reg_linux_diskfull_installation_flat_modules_and_groups_rh8
compare_postscripts
cleanup_postscripts_diskfull
reg_linux_diskless_installation_flat
reg_linux_diskless_installation_flat_squashfs
reg_linux_diskless_installation_flat_modules_and_groups
reg_linux_diskless_installation_flat_modules_and_groups_rh
reg_linux_statelite_installation_flat
cleanup_postscripts_diskless
rmimage_diskless

View File

@@ -1,6 +1,6 @@
start:reg_linux_diskfull_installation_flat_modules_and_groups
start:reg_linux_diskfull_installation_flat_modules_and_groups_rh8
description:Test provision and updatenode with yum groups and modules. Runs only on RH8
os:Linux
os:rhels8
label:flat_cn_diskful,provision
cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
@@ -37,3 +37,44 @@ check:output!~ruby 2.6
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist
cmd:rm /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
end
start:reg_linux_diskfull_installation_flat_groups_rh7
description:Test provision and updatenode with yum groups. Runs only on RH7
os:rhels7
label:flat_cn_diskful,provision
cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:cat /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
# Verify group was installed by cheking individual RPMs
cmd:xdsh $$CN rpm -q xml-common openscap-scanner openscap scap-security-guide
check:output=~xml-common-
check:output=~openscap-scanner-
check:output=~openscap-
check:output=~scap-security-guide-
# Verify group can be removed (manually install, then remove using updatenode)
cmd:xdsh $$CN yum group install -y compat-libraries
check:rc==0
cmd:xdsh $$CN yum group list installed
check:output=~Compatibility Libraries
cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:echo "-@Compatibility Libraries" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
cmd:updatenode $$CN -P ospkgs
check:rc==0
cmd:xdsh $$CN yum group list installed
check:output!~Compatibility Libraries
# Cleanup
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist
cmd:rm /opt/xcat/share/xcat/install/rh/compute.pkglist.modules
end

View File

@@ -1,11 +1,11 @@
start:reg_linux_diskless_installation_flat_modules_and_groups
description:Test provision and updatenode with yum groups and modules. Runs only on RH7 and RH8
os:Linux
start:reg_linux_diskless_installation_flat_modules_and_groups_rh8
description:Test provision and updatenode with yum groups and modules. Runs only on RH8
os:rhels8
label:flat_cn_diskless,provision
cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "yum" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi
cmd:echo "@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
check:rc==0
cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
@@ -26,27 +26,73 @@ check:rc==0
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
# Verify group and module (on RH8) were installed. Can not use "yum group"
# Verify group and module were installed. Can not use "yum group"
# since .repo files are not setup at this point
cmd:xdsh $$CN rpm -q xml-common
check:rc==0
check:output=~xml-common
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo "ruby 2.6"; fi
cmd:xdsh $$CN yum module list --installed
check:output=~ruby
check:output=~2.6
# Verify group and module (on RH8) can be removed
cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
# Verify group and module can be removed
cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "-@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi
cmd:echo "-@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:updatenode $$CN -P ospkgs
check:rc==0
cmd:xdsh $$CN yum group list installed
check:output!~Security Tools
cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo ""; fi
cmd:xdsh $$CN yum module list --installed
check:output!~ruby
# Cleanup
cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist
cmd:rm /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
end
start:reg_linux_diskless_installation_flat_groups_rh7
description:Test provision and updatenode with yum groups. Runs only on RH7
os:rhels7
label:flat_cn_diskless,provision
cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "yum" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
check:rc==0
cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
# Verify group was installed. Can not use "yum group"
# since .repo files are not setup at this point
cmd:xdsh $$CN rpm -q xml-common
check:rc==0
check:output=~xml-common
# Verify group can be removed
cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
cmd:updatenode $$CN -P ospkgs
check:rc==0
cmd:xdsh $$CN yum group list installed
check:output!~Security Tools
# Cleanup
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist
cmd:rm /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules
end

View File

@@ -80,15 +80,15 @@ The xCAT-test test cases are in flat text format, the testing framework will par
#optional, description of the test case
description: what the test case is for?
#optional, environment requirements
os:AIX/Linux
os:AIX/Linux/sles/ubuntu/rhels/rhels7/rhels8
#optional, environment requirements
arch:ppc/x86
arch:ppc/ppc64/ppc64le/x86_64
#optional, environment requirements
hcp:hmc/mm/bmc/fsp
hcp:hmc/mm/bmc/fsp/ipmi/openbmc
#optional, label
label:label1
#required, command need to run
cmd:comand
cmd:command
#optional, check return code of last executed command
check:rc == or != return code
#optional, check output of last executed command
@@ -103,13 +103,13 @@ B<Note>: Each test case can have more than one I<cmd> sections and each I<cmd> s
=item 1.
To run all test cases related command rpower:
To run all test cases related to command B<rpower>:
xcattest -f /tmp/config -c rpower
=item 2.
To run customized bundle with /tmp/config file:
To run customized bundle with I</tmp/config> file:
xcattest -c lsdef -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle
Modify custom.bundle
@@ -117,13 +117,13 @@ To run customized bundle with /tmp/config file:
=item 3.
To run specified test cases with /tmp/config file:
To run specified test cases with I</tmp/config> file:
xcattest -f /tmp/config -t lsdef_t_o_l_z
=item 4.
To add a new case to test B<chvm>. In the example, we assume that the min_mem should not be equal to 16 in the lpar profile of computenode. The case name is chvm_custom. It create a test lpar named testnode firstly, that change the min_mem of the lpar to 16 using chvm, then check if min_mem have changed correctly. At last, the testnode be remove to ensure no garbage produced in the cases.
To add a new test case to test B<chvm>. In this example, we assume that the B<min_mem> should not be equal to 16 in the lpar profile of computenode. The case name is B<chvm_customi>. It creates a test lpar named B<testnode> first, then changes the B<min_mem> of the lpar to 16 using B<chvm>, then checks if B<min_mem> have changed correctly. Finally, the B<testnode> is removed.
add a new test case file in /opt/xcat/share/xcat/tools/autotest/chvm
edit filename

View File

@@ -205,7 +205,7 @@ if (defined $list) {
log_this($running_log_fd, "$_");
}
} elsif (!@cases_to_be_run && $search_expression){
log_this($running_log_fd, "There is no cases match search expression $search_expression");
log_this($running_log_fd, "There are no cases match search expression $search_expression");
} else {
#list the cases shipped by xcat test package
@@ -219,7 +219,7 @@ if (defined $list) {
}
} elsif ($list eq "caseinfo") {
if (!@cases_to_be_run && $search_expression){
log_this($running_log_fd, "There is no cases match search expression $search_expression");
log_this($running_log_fd, "There are no cases match search expression $search_expression");
} else {
$rst = show_case_info(\@cases_to_be_run, \$error);
if ($rst) {
@@ -436,7 +436,7 @@ if ($stop_to_keep_env) {
# Description: print message to log file and STDOUT.
# Set '-q' option in command line, just print message to log file
# Atrributes: $logdf: the file description of openning log file
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub log_this {
my $logdf = shift;
@@ -463,7 +463,7 @@ sub log_this {
# Fuction name: pro_init
# Description: Do program initialization
# Atrributes:
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub pro_init {
mkpath("$resultdir") unless (-d "$resultdir");
@@ -489,7 +489,7 @@ sub pro_init {
# The reference of array to save the cases to be handled
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#-------------------------------------------------------
sub calculate_cases_to_be_run {
my $cases_to_be_run_ref = shift;
@@ -596,7 +596,7 @@ sub calculate_cases_to_be_run {
# Fuction name: expend_include_file
# Description: To support '#INCLUDE" label in bundle file, to expend the include file
# Atrributes: $bundle (input attribute): the name of bundle
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub expend_include_file {
my $bundle = shift;
@@ -629,7 +629,7 @@ sub expend_include_file {
# Fuction name: to_exit
# Description: customize exit function, include clean up environment
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub to_exit {
my $exit_code = shift;
@@ -645,7 +645,7 @@ sub to_exit {
# Atrributes:
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub check_option_validity {
my $error_ref = shift;
@@ -675,7 +675,7 @@ sub check_option_validity {
# The reference of array to save the cases to be handled
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub show_case_info {
my $cases_to_be_run_ref = shift;
@@ -715,7 +715,7 @@ sub show_case_info {
# Atrributes:
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub show_bundle_info {
my $error_ref = shift;
@@ -775,7 +775,7 @@ sub show_bundle_info {
# config{var}{varname}
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub load_config_file {
my $configfile = shift;
@@ -932,7 +932,7 @@ sub load_config_file {
# The flag of whether run these case nex.
# 0 means no, just load case basic information, used by "searching informaiotn funtion of xcattest"
# 1 means yes, load case basic information and parse the attribure at the sametime. used by "run case funtion of xcattest"
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub load_case {
my $cases_to_be_run_ref = shift;
@@ -1280,7 +1280,7 @@ sub load_case {
}
}
if (@unexisted_cases) {
log_this($running_log_fd, "Not existed:", @unexisted_cases);
log_this($running_log_fd, "Does not exist:", @unexisted_cases);
push @wrong_cases, @unexisted_cases;
$caseerror = 2;
}
@@ -1310,7 +1310,7 @@ sub load_case {
# Atrributes:
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub bakup_current_env {
my $error_ref = shift;
@@ -1330,7 +1330,7 @@ sub bakup_current_env {
# Atrributes:
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub restore_current_env {
my $error_ref = shift;
@@ -1354,7 +1354,7 @@ sub restore_current_env {
# Due to there maybe is more than one implementation for one case
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub run_case {
my $cases_to_be_run_ref = shift;
@@ -1556,7 +1556,7 @@ sub run_case {
# The structure of %config please refer to the comment of function load_config_file
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub setup_env_by_configure_file {
my $config_ref = shift;
@@ -1620,7 +1620,7 @@ sub setup_env_by_configure_file {
# The structure of %config please refer to the comment of function load_config_file
# $error_ref (output attribe)
# The reference of scalar to save the error message generated during running current function
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub detect_current_env {
my $config_ref = shift;
@@ -1672,7 +1672,7 @@ sub detect_current_env {
# Fuction name: runcmd
# Description: run a command after 'cmd' label in one case
# Atrributes:
# Retrun code:
# Return code:
# $::RUNCMD_RC : the return code of command
# @$outref : the output of command
#--------------------------------------------------------
@@ -1701,7 +1701,7 @@ sub runcmd
# Atrributes:
# $script_ref (input attribute)
# the reference of array where save every line of script
# Retrun code:
# Return code:
# $::RUNCMD_RC : the return code of command
# @$outref : the output of command
#--------------------------------------------------------
@@ -1730,7 +1730,7 @@ sub runscript {
# Fuction name: getnodeattr
# Description: get the value of node attribute from current environment
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub getnodeattr {
my $node = shift;
@@ -1743,7 +1743,7 @@ sub getnodeattr {
# Fuction name: getobjectattr
# Description: get the value of object attribute from current DB
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub getobjectattr {
my $objtype = shift;
@@ -1772,7 +1772,7 @@ sub getobjectattr {
# The target scan directory
# $files_path_ref (output attribute)
# the reference of array where save all vaild files under $dir
# Retrun code:
# Return code:
#--------------------------------------------------------
sub get_files_recursive
{
@@ -1804,7 +1804,7 @@ sub get_files_recursive
# Fuction name: is_valid_case_name
# Description: to check if a case name is valid
# Atrributes: $casename (input atrribute): the target case name
# Retrun code: 0 Success 1 Failed
# Return code: 0 Success 1 Failed
#--------------------------------------------------------
sub is_valid_case_name {
my $casename = shift;
@@ -1817,13 +1817,20 @@ sub is_valid_case_name {
#-------------------------------------------------------
# Fuction name: get_current_os
# Description:
# Description: Return name of current OS. For rhels, also return major number
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub get_current_os {
if (-f "/etc/redhat-release") {
return "rhels";
# Try to return "rhels" + major version, if can not get it, just return "rhels"
my $major_version = "";
my @output = &runcmd("cat /etc/redhat-release");
my $out_line = $output[0];
if ($out_line =~ (/(\d+)\.(\d*)/)) {
$major_version = $1;
}
return "rhels".$major_version;
} elsif (-f "/etc/lsb-release") {
return "ubuntu";
} elsif (-f "/etc/os-release") {
@@ -1844,7 +1851,7 @@ sub get_current_os {
# Fuction name: generate_performance_report
# Description:
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub generate_performance_report {
my $runninglog = shift;
@@ -1889,7 +1896,7 @@ sub generate_performance_report {
# Fuction name: getvar
# Description: replace specific attribute in case definition by the value set in config file
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub getvar
{
@@ -1913,7 +1920,7 @@ sub getvar
# Fuction name: getfunc
# Description: replace specific funciton in case definition
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub getfunc
{
@@ -1952,7 +1959,7 @@ sub getfunc
# Fuction name: gettablevalue
# Description: get specific table value from current environment
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub gettablevalue
{
@@ -1965,7 +1972,7 @@ sub gettablevalue
# Fuction name: print_table
# Description: print a hash table in good format
# Atrributes:
# Retrun code:
# Return code:
#--------------------------------------------------------
sub print_table {
my $msg_ref = shift;