提交 2b59e1b3 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1 add smoke test cases

Merge pull request !1 from Charlie_Li/master
木兰宽松许可证, 第2版
木兰宽松许可证, 第2版
2020年1月 http://license.coscl.org.cn/MulanPSL2
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
0. 定义
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
“法人实体”是指提交贡献的机构及其“关联实体”。
“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
1. 授予版权许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
2. 授予专利许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
3. 无商标许可
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
4. 分发限制
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
5. 免责声明与责任限制
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
6. 语言
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
条款结束
如何将木兰宽松许可证,第2版,应用到您的软件
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
3, 请将如下声明文本放入每个源文件的头部注释中。
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
Mulan Permissive Software License,Version 2
Mulan Permissive Software License,Version 2 (Mulan PSL v2)
January 2020 http://license.coscl.org.cn/MulanPSL2
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
0. Definition
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
Contribution means the copyrightable work licensed by a particular Contributor under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
1. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
2. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
3. No Trademark License
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
4. Distribution Restriction
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
5. Disclaimer of Warranty and Limitation of Liability
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. Language
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
END OF THE TERMS AND CONDITIONS
How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
#### 介绍
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
# integration-test
## 介绍
此仓库提供openEuler操作系统集成和冒烟类测试能力源代码
## 软件架构
软件架构说明
├── README.md
├── License
│ └── LICENSE
├── suite2cases
└── testcases
## 使用说明
本仓库提供的测试代码是基于[mugen](https://gitee.com/openeuler/test-tools.git)框架编写,用户使用此能力步骤如下:
- 下载[mugen](https://gitee.com/openeuler/test-tools.git)测试框架
- 下载本仓库测试代码并归档到测试框架对应目录
- 按照[mugen使用指南](https://gitee.com/openeuler/test-tools/blob/master/mugen/README.md)进行测试执行
## 参与贡献
1. Fork 本仓库
2. 在suite2cases目录的指定文件中定义测试套和测试用例对应关系
3. 在testcases目录下参考[测试用例命名及代码编程规范](https://gitee.com/openeuler/package-reinforce-test/blob/master/测试用例命名及代码编程规范.md)编写测试代码
4. 下载[mugen](https://gitee.com/openeuler/test-tools.git)测试框架并完成代码调试
5. 本地提交代码
6. 码云新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
oe_test_basic_ssh_001
oe_test_cat_001
oe_test_cd_002
oe_test_chmod_001
oe_test_chown.001
oe_test_cp_001
oe_test_CPUinfo_001
oe_test_dateinfo_001
oe_test_dd_001
oe_test_file_001
oe_test_grep_001
oe_test_group_001
oe_test_group_002
oe_test_ln_001
oe_test_localectl_001
oe_test_log_001
oe_test_ls_001
oe_test_MEMinfo_001
oe_test_mkdir_001
oe_test_mv_001
oe_test_network_001
oe_test_pwd_001
oe_test_rmdir_001
oe_test_sevice_001
oe_test_tar_001
oe_test_touch_001
oe_test_umask_001
oe_test_user_001
oe_test_user_002
oe_test_user_003
oe_test_yumgroup_001
oe_test_syslog_dmesg_001
oe_test_syslog_journalctl_001
oe_test_syslog_journalctl_002
oe_test_syslog_journald_001
oe_test_syslog_logrotate_001
oe_test_syslog_messages_001
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Query CPU configure test-lscpu
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
lscpu | grep "^CPU(s)" | egrep '[0-9]'
CHECK_RESULT $?
lscpu | grep "Vendor ID"
CHECK_RESULT $?
lshw -c cpu | grep "capacity" | grep "Hz"
CHECK_RESULT $?
if [ "$(uname -i)"x == "aarch64"x ]; then
cat /proc/cpuinfo | grep "0x48"
CHECK_RESULT $?
else
cat /proc/cpuinfo | grep $(lscpu | grep "Vendor ID" | awk -F " " '{print$3}')
CHECK_RESULT $?
fi
if [[ "$(dmidecode -s system-product-name)" =~ "KVM" ]]; then
cpu_num1=$(lshw -c cpu | grep 'description' | wc -l)
cpu_num2=$(lscpu | grep "^CPU(s):" | awk -F ' ' '{print $2}')
CHECK_RESULT $cpu_num1 $cpu_num2
fi
Disk_name=$(lshw -c disk | grep 'logical name' | grep -v 'sr0' | grep -v 'cdrom' | awk -F ': ' 'NR==1{print $2}')
Disk_size=$(lshw -c disk | grep "$Disk_name$" -A 5 | grep 'size:' | awk -F ': ' '{print $2}' | awk -F 'GiB' '{print $1}')
fdisk -l $Disk_name | grep Disk | grep 'TiB'
if [ $? -eq 0 ]; then
tmp_disk=$(fdisk -l $Disk_name | grep Disk | grep TiB | awk -F ' ' '{print $3}')
Disk_size2=$(echo $tmp_disk | awk '{printf("%0.0f\n",$1*1024)}')
[ $Disk_size2 -lt $((Disk_size + 20)) ] && [ $Disk_size2 -gt $((Disk_size - 20)) ]
CHECK_RESULT $?
else
tmp_disk=$(fdisk -l $Disk_name | grep Disk | grep GiB | awk -F ' ' '{print $3}')
echo $tmp_disk | grep '\.'
if [ $? -eq 0 ]; then
Disk_size2=$(echo $tmp_disk | awk -F '.' '{print $1}')
else
Disk_size2=$tmp_disk
fi
[ $Disk_size2 -lt $((Disk_size + 5)) ] && [ $Disk_size2 -gt $((Disk_size - 5)) ]
CHECK_RESULT $?
fi
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09 10:52:41
# @License : Mulan PSL v2
# @Desc : Query MEM configure test-lshw -c
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
lshw -c memory
CHECK_RESULT $?
lshw -c memory | grep "bank" -A 5 | grep "description:"
CHECK_RESULT $?
lshw -c memory | grep "bank" -A 5 | grep "vendor"
CHECK_RESULT $?
if [[ "$(dmidecode -s system-product-name)" =~ "KVM" ]]; then
lshw -c memory | grep "bank" -A 5 | grep "size"
CHECK_RESULT $?
else
lshw -c memory | grep "bank" -A 8 | grep "size"
CHECK_RESULT $?
fi
if [[ "$(dmidecode -s system-product-name)" =~ "KVM" ]]; then
test $(lshw -c memory | grep "bank" | wc -l) -eq 1
CHECK_RESULT $?
fi
if [[ "$(dmidecode -s system-product-name)" =~ "KVM" ]]; then
test $(lshw -c memory | grep bank -A 10 | grep size | wc -l) -eq 1
CHECK_RESULT $?
fi
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : test ssh
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "testuser1:" && userdel -rf testuser1
useradd testuser1
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
sed -i 's/#%wheel/%wheel/g' /etc/sudoers
usermod -aG wheel testuser1
passwd testuser1 <<EOF
${LOCAL_PASSWD}
${LOCAL_PASSWD}
EOF
password="${LOCAL_PASSWD}"
expect <<EOF1
set timeout 15
log_file log
spawn ssh testuser1@127.0.0.1 pwd
expect {
"*(yes/no*" {
send "yes\r"
}
}
expect {
"assword:" {
send "${password}\r"
}
}
expect eof
EOF1
cat log | grep "/home/testuser1"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
userdel -rf testuser1
rm -rf log
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-cat
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
cat /etc/passwd | grep "root:x:0:0:root:/root:/bin/bash"
CHECK_RESULT $?
cat -n /etc/passwd | grep "root:x:0:0:root:/root:/bin/bash"
CHECK_RESULT $?
cat --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-cd
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
current_path=$(pwd)
ls example && rm -rf example
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
mkdir example
cd example
CHECK_RESULT $?
pwd | grep "example"
CHECK_RESULT $?
cd ..
CHECK_RESULT $?
pwd | grep $current_path
CHECK_RESULT $?
cd -
CHECK_RESULT $?
pwd | grep "example"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
cd ${current_path}
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-chmod
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls /tmp/test01 && rm -rf /tmp/test01
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
mkdir -p /tmp/test01/test02/test03
per01=$(ls -l /tmp | grep "test01" | awk -F ' ' '{print $1}')
per02=$(ls -l /tmp/test01 | grep "test02" | awk -F ' ' '{print $1}')
[ "$per01" == "drwxr-xr-x." ]
CHECK_RESULT $?
chmod 777 /tmp/test01
per03=$(ls -l /tmp | grep "test01" | awk -F ' ' '{print $1}')
per04=$(ls -l /tmp/test01 | grep "test02" | awk -F ' ' '{print $1}')
[ "$per03" == "drwxrwxrwx." ]
CHECK_RESULT $?
[ "$per02" == "$per04" ]
CHECK_RESULT $?
chmod -R 777 /tmp/test01
per05=$(ls -l /tmp/ | grep "test01" | awk -F ' ' '{print $1}')
per06=$(ls -l /tmp/test01 | grep "test02" | awk -F ' ' '{print $1}')
[ "$per05" == "drwxrwxrwx." ]
CHECK_RESULT $?
[ "$per06" == "drwxrwxrwx." ]
CHECK_RESULT $?
chmod --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf /tmp/test01
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-chown
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "test:" && userdel -rf test
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
useradd test
echo $LOCAL_PASSWD | passwd test --stdin
mkdir -p tmp/tmp01
[ $(ls -l tmp | tail -n 1 | awk -F ' ' '{print $3}') == "root" ]
CHECK_RESULT $?
[ $(ls -l tmp | tail -n 1 | awk -F ' ' '{print $4}') == "root" ]
CHECK_RESULT $?
chown -R test:test tmp
CHECK_RESULT $?
own_user02=$(ls -l tmp | tail -n 1 | awk -F ' ' '{print $3}')
own_group02=$(ls -l tmp | tail -n 1 | awk -F ' ' '{print $4}')
[ "$own_user02" == "test" ]
CHECK_RESULT $?
[ "$own_group02" == "test" ]
CHECK_RESULT $?
chown --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf tmp
userdel -rf test
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-cp
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
ls test1 || touch test1
ls /home/test1 && rm -rf /home/test1
cp test1 /home
ls /home/test1
CHECK_RESULT $?
ls test2/test3 || mkdir -p test2/test3
ls /home/test2 && rm -rf /home/test2
cp -r test2 /home
ls /home/test2
CHECK_RESULT $?
cp --help | grep "Usage"
CHECK_RESULT $?
ls /home/test4 && rm -rf /home/test4
cp -s test1 test4
CHECK_RESULT $?
ls -l test4 | grep "test4 -> test1"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf test1 test2 /home/test1 /home/test2 test4
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-27
# @License : Mulan PSL v2
# @Desc : test timedatectl command and date command
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
date
CHECK_RESULT $?
timedatectl | grep "Local time"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-dd
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
dd if=/dev/zero of=test bs=1M count=1000
CHECK_RESULT $?
dd --help | grep "Usage"
CHECK_RESULT $?
ls file && rm -rf file
echo "test" >file
dd if=file of=test1 bs=1M count=1000
CHECK_RESULT $?
LOG_INFO "End test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -f test test1 file
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-file
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
file /etc/passwd | grep "ASCII text"
CHECK_RESULT $?
file -d /etc/passwd 2>&1 | grep "ASCII text"
CHECK_RESULT $?
file --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-grep
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
grep -c id /proc/cpuinfo
CHECK_RESULT $?
grep -n id /proc/cpuinfo
CHECK_RESULT $?
ps -aux | grep auditd
CHECK_RESULT $?
grep --help | grep "Usage"
CHECK_RESULT $?
ls test && rm -rf test
echo 'abc' >test
grep -i 'A' test
CHECK_RESULT $?
grep -v 'A' test
CHECK_RESULT $?
grep -r 'ssh_config' /etc/ssh
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf test
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Create User Group test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/group | grep "testgroup:" && groupdel testgroup
cat /etc/group | grep "testgroup1:" && groupdel testgroup1
cat /etc/group | grep "testgroup2:" && groupdel testgroup2
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
groupadd testgroup
CHECK_RESULT $?
cat /etc/group | grep testgroup
CHECK_RESULT $?
groupadd -g 66 testgroup1
cat /etc/group | grep testgroup1 | grep 66
CHECK_RESULT $?
groupadd -g 66 -o testgroup2
cat /etc/group | grep testgroup2 | grep 66
CHECK_RESULT $?
cat /etc/group | grep testgroup2 | grep 66
CHECK_RESULT $?
groupadd --help
CHECK_RESULT $?
groupdel testgroup
CHECK_RESULT $?
groupdel testgroup1
CHECK_RESULT $?
groupdel testgroup2
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Modity User Group test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "testuser1:" && userdel -rf testuser1
useradd testuser1
cat /etc/group | grep "testgroup1:" && groupdel testgroup1
cat /etc/group | grep "testgroup2:" && groupdel testgroup2
groupadd testgroup1
groupmod -g 66 testgroup1
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
groupmod -g 88 testgroup1
CHECK_RESULT $?
cat /etc/group | grep testgroup1 | grep 88
CHECK_RESULT $?
groupmod -n testgroup2 testgroup1
CHECK_RESULT $?
cat /etc/group | grep testgroup2 | grep 88
CHECK_RESULT $?
cat /etc/group | grep testgroup1
CHECK_RESULT $? 1
usermod -a -G testgroup2 testuser1
CHECK_RESULT $?
cat /etc/group | grep testgroup2 | grep testuser1
CHECK_RESULT $?
groupmod --help
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
groupdel testgroup2
userdel -rf testuser1
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-ln
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls /home/Music && rm -rf /home/Music
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
ls Music || touch Music
ln -s Music /home
CHECK_RESULT $?
ls -l /home/Music | grep Music
CHECK_RESULT $?
ln --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf /home/Music Music
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Locale setting test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
localectl list-locales | grep "UTF-8"
CHECK_RESULT $?
localectl status | grep -i 'system locale'
CHECK_RESULT $?
now_LANG=$(localectl status | grep -i 'system locale' | awk -F ': ' '{print $2}')
localectl set-locale LANG=locale
localectl status | grep -i 'system locale' | awk -F "=" '{print$2}' | grep "locale"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
localectl set-locale $now_LANG
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : lujiajia
# @Contact : 763403775@qq.com
# @Date : 2020-4-9
# @License : Mulan PSL v2
# @Desc : Log View
# #############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start executing testcase."
ls /var/log
CHECK_RESULT $?
tail -f /var/log/messages >log 2>&1 &
row01=$(cat log | wc -l)
SLEEP_WAIT 1
useradd test1 && userdel -rf test1
SLEEP_WAIT 4
row02=$(cat log | wc -l)
[[ $row01 == ${row02} ]] && ((exec_result++))
grep audit /var/log/messages
CHECK_RESULT $?
LOG_INFO "Finish testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
pid=$(ps -ef | grep "tail" | grep -v grep | awk '{print $2}')
kill -9 ${pid}
rm -rf log
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test -ls
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
ls -a / | grep "\."
CHECK_RESULT $?
ls -l / | grep 'home' | grep 'drwxr\-xr\-x'
CHECK_RESULT $?
ls --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-mkdir
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls test1 && rm -rf test1
ls test2 && rm -rf test2
ls test3 && rm -rf test3
ls test5 && rm -rf test5
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
mkdir test1 test2
ls test1 && ls test2
CHECK_RESULT $?
mkdir -p test3/test4
ls test3/test4
CHECK_RESULT $?
mkdir -m 777 test5
ls -l | grep test5 | grep "drwxrwxrwx"
CHECK_RESULT $?
mkdir --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf test1 test2 test3 test5
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-mv
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls /home/test1 && rm -rf /home/test1
ls /home/test2 && rm -rf /home/test2
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
mkdir test1
mv test1 /home
ls /home/test1
CHECK_RESULT $?
mv /home/test1 /home/test2 && ls /home/test2
CHECK_RESULT $?
rm -rf /home/test2
mkdir test2 && mv -f test2 /home
ls /home/test2
CHECK_RESULT $?
mv --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf /home/test2
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : nmcli, ip link, route, ip, ethtool, ifconfig command test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
card_name=$(ip a | grep 255 | grep -v ' virbr' | grep -v 'lo ' | grep -v 'docker' | awk -F' ' '{print $NF}')
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
DNF_INSTALL net-tools
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
nmcli connection show | grep $card_name
CHECK_RESULT $?
ip link | grep $card_name
CHECK_RESULT $?
route | grep default
CHECK_RESULT $?
ethtool $card_name
CHECK_RESULT $?
ifconfig | grep $card_name
CHECK_RESULT $?
ip a show $card_name | grep 192.1.1.11 && ip addr del 192.1.1.11 dev $card_name
ip addr add 192.1.1.11 dev $card_name
CHECK_RESULT $?
ip a show $card_name | grep 192.1.1.11
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
ip addr del 192.1.1.11 dev $card_name
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-pwd
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
current_path=$(pwd)
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
cd /etc/kernel
pwd | grep "/etc/kernel"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
cd ${current_path}
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-rmdir
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls test1 && rm -rf test1
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
mkdir test1
rmdir test1 && ls test1
CHECK_RESULT $? 0 1
mkdir -p test1/test2
rmdir -p test1/test2 && ls test1
CHECK_RESULT $? 0 1
rmdir --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : View the services provided by the system
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
systemctl -t service | grep auditd
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "This test case does not require environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-4-9
# @License : Mulan PSL v2
# @Desc : Query boot information-dmesg
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
dmesg | less | grep -iE "Booting Linux on physical CPU|smpboot"
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Need't to restore the tet environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-6-18
# @License : Mulan PSL v2
# @Desc : Supports logging of Basic System Operation Information
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
rm -rf systemlog2
journalctl --system >systemlog2
logsize=$(grep -v ' No entries ' systemlog2 | wc -l)
test $((logsize)) -gt 1
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf systemlog2
LOG_INFO "End to restore the test environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-6-19
# @License : Mulan PSL v2
# @Desc : Supports logging of device information
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
rm -rf systemlog3
journalctl --unit systemd-udevd -all >systemlog3
logsize=$(grep -v ' No entries ' systemlog3 | wc -l)
test $((logsize)) -gt 1
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf systemlog3
LOG_INFO "End to restore the test environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-6-19
# @License : Mulan PSL v2
# @Desc : The system log is recorded in a fixed log file
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
grep Storage /etc/systemd/journald.conf | egrep "Storage=auto|Storage=persistent"
CHECK_RESULT $?
folder=$(ls /var/log/journal/)
cp -r /var/log/journal/$folder /var/log/journal/${folder}bak
rm -rf /var/log/journal/$folder
systemctl restart systemd-journald.service
if [ ! -d "/var/log/journal/$folder" ]; then
CHECK_RESULT 0 1
cp -r /var/log/journal/${folder}bak /var/log/journal/${folder}
fi
check_file=$(ls -la /var/log/journal/${folder} | grep "^-" | grep "journal" | wc -l)
CHECK_RESULT $check_file 1
journalctl --file /var/log/journal/${folder}/system.journal >systemlog1
logsize=$(grep -v ' No entries ' systemlog1 | wc -l)
test $((logsize)) -gt 1
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf /var/log/journal/${folder}bak
rm -rf systemlog1
LOG_INFO "End to restore the test environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : doraemon2020
# @Contact : xcl_job@163.com
# @Date : 2020-6-18
# @License : Mulan PSL v2
# @Desc : test syslog dump-logrotate
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
ls /var/log/messages
CHECK_RESULT $?
rm -rf /var/log/messages-*.gz
mv /etc/logrotate.d/rsyslog /etc/logrotate.d/rsyslog_bak
cat >/etc/logrotate.d/rsyslog <<eof
/var/log/messages
{
dateext
rotate 30
size +4096k
compress
dateformat -%Y%m%d%s
sharedscripts
postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
endscript
}
eof
logrotate -f /etc/logrotate.d/rsyslog
CHECK_RESULT $?
ls /var/log/messages-*.gz
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf /etc/logrotate.d/rsyslog
mv /etc/logrotate.d/rsyslog_bak /etc/logrotate.d/rsyslog
LOG_INFO "End to restore the test environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-6-19
# @License : Mulan PSL v2
# @Desc : Log View
# #############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "No params need to config."
}
function pre_test() {
LOG_INFO "No pkgs need to install."
}
function run_test() {
LOG_INFO "Start to run test."
ls /var/log
CHECK_RESULT $?
tail -f /var/log/messages >log 2>&1 &
log_line1=$(cat log | wc -l)
SLEEP_WAIT 1
useradd test1 && userdel -r test1
SLEEP_WAIT 4
log_line2=$(cat log | wc -l)
test $((log_line1)) -ne $((log_line2))
CHECK_RESULT $?
grep audit /var/log/messages
CHECK_RESULT $?
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
pid=$(ps -ef | grep "tail" | grep -v grep | awk '{print $2}')
kill -9 ${pid}
rm -rf log
LOG_INFO "End to restore the test environment."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-tar
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
current_path=$(pwd)
DNF_INSTALL tar
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
cd /tmp
mkdir /tmp/test
dd if=/dev/zero of=/tmp/test/test count=1 bs=512
tar -cf test.tar test
ls test.tar
CHECK_RESULT $?
tar -tvf test.tar | grep "test"
CHECK_RESULT $?
tar --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf /tmp/test /tmp/test.tar
DNF_REMOVE tar
cd ${current_path}
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : File system common command test-touch
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
ls test1 && rm -rf test1
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
touch test1
ls | grep "test1"
CHECK_RESULT $?
time01=$(ls -l test1 | awk -F ' ' '{print $8}')
SLEEP_WAIT 60
touch -m test1
time02=$(ls -l test1 | awk -F ' ' '{print $8}')
[ "$time01" != "$time02" ]
CHECK_RESULT $?
touch --help | grep "Usage"
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf test1
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-10
# @License : Mulan PSL v2
# @Desc : Umask default configuration check
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "This test case does not require environment preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
umask | grep 0022
CHECK_RESULT $?
umask 0037
CHECK_RESULT $?
umask | grep 0037
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
umask 0022
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Add User test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "testuser:" && userdel -rf testuser
cat /etc/passwd | grep "testuser1:" && userdel -rf testuser1
cat /etc/passwd | grep "testuser2:" && userdel -rf testuser2
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
useradd testuser
passwd testuser <<EOF
$LOCAL_PASSWD
$LOCAL_PASSWD
EOF
CHECK_RESULT $?
grep testuser /etc/passwd
CHECK_RESULT $?
useradd -e 2020-10-30 testuser1
CHECK_RESULT $?
chage -l testuser1 | grep 2020 | grep Oct | grep 30
CHECK_RESULT $?
chage -M 4 testuser1
CHECK_RESULT $?
chage -l testuser1 | grep Maximum | grep 4
CHECK_RESULT $?
useradd --help
CHECK_RESULT $?
echo testuser1:Administrator12#$ | chpasswd
CHECK_RESULT $?
ls /home/testuser2 || mkdir /home/testuser2
useradd testuser2 2>&1 | grep 'home directory already exists'
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
userdel -rf testuser
userdel -rf testuser1
userdel -rf testuser2
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : test -g -s -m and delete user
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "testuser1:" && userdel -rf testuser1
cat /etc/group | grep "test:" && groupdel test
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
groupadd test
gid=$(cat /etc/group | grep test | awk -F':' '{print $3}')
useradd -g $gid -s /sbin/nologin -m testuser1
CHECK_RESULT $?
su testuser1 | grep 'account is currently not available'
CHECK_RESULT $?
test $(cat /etc/passwd | grep testuser1 | awk -F ':' '{print $4}') -eq $gid
CHECK_RESULT $?
ls /home | grep testuser1
CHECK_RESULT $?
userdel -rf testuser1
CHECK_RESULT $?
ls /home | grep testuser1
CHECK_RESULT $? 1
cat /etc/passwd | grep testuser1
CHECK_RESULT $? 1
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
groupdel test
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : Modity User test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
cat /etc/passwd | grep "testuser1:" && userdel -rf testuser1
cat /etc/group | grep "testgroup1:" && groupdel testgroup1
useradd -u 555 testuser
groupmod -g 555 testuser
groupadd -g 72 testgroup1
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
usermod -u 666 testuser
CHECK_RESULT $?
grep testuser /etc/passwd | awk -F : '{print$3}' | grep 666
CHECK_RESULT $?
usermod -g 72 testuser
CHECK_RESULT $?
grep testuser /etc/passwd | awk -F : '{print$4}' | grep 72
CHECK_RESULT $?
usermod --help
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
userdel -rf testuser
groupdel testgroup1
groupdel testuser
LOG_INFO "Finish environment cleanup!"
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : xuchunlin
# @Contact : xcl_job@163.com
# @Date : 2020-04-09
# @License : Mulan PSL v2
# @Desc : install Software Group
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
yum group remove 'Network Servers' -y
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start testing..."
yum group list | grep 'Network Servers'
CHECK_RESULT $?
yum group info 'Network Servers' | grep ' ' >yum_list
yum group install 'Network Servers' -y
CHECK_RESULT $?
while read line; do
rpm -qa $line
CHECK_RESULT $?
done <yum_list
yum group install 'Network Servers' -y
CHECK_RESULT $?
yum group remove 'Network Servers' -y
CHECK_RESULT $?
LOG_INFO "Finish test!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf yum_list
LOG_INFO "Finish environment cleanup!"
}
main $@
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册