forked from redrsoe2100/os-autotest
create testsuite for src at rpm at
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .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 : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-13
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic at command functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试 at 命令基本功能"
|
||||
|
||||
# 检查是否已安装 at 包
|
||||
if ! dnf list installed at &>/dev/null; then
|
||||
LOG_INFO "环境未安装 at 包,将进行安装"
|
||||
if ! dnf list available at &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 at 包"
|
||||
exit 255
|
||||
fi
|
||||
dnf install -y at
|
||||
CHECK_RESULT $? 0 0 "安装 at 包失败"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "环境已安装 at 包,跳过安装步骤"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 测试 at 命令基本功能
|
||||
LOG_INFO "测试 at 命令是否支持 -m 参数"
|
||||
at -m now <<EOF
|
||||
echo "测试 at 命令"
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "at 命令不支持 -m 参数"
|
||||
|
||||
LOG_INFO "验证 at 任务是否成功加入队列"
|
||||
atq | grep -q "echo"
|
||||
CHECK_RESULT $? 0 0 "at 任务未成功加入队列"
|
||||
|
||||
#清理环境
|
||||
if [ $INSTALLED -eq 1 ]; then
|
||||
LOG_INFO "卸载临时安装的 at 包"
|
||||
dnf remove -y at
|
||||
CHECK_RESULT $? 0 0 "卸载 at 包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 at command basic functionality完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user