From 0870f1486068bf2f8cbc7b29e9b41be076c22167 Mon Sep 17 00:00:00 2001 From: sdu-xinglindu <1783674677@qq.com> Date: Sun, 28 May 2023 13:34:06 +0800 Subject: [PATCH] basesystem --- basesystem/testcase/basesystem.sh | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 basesystem/testcase/basesystem.sh diff --git a/basesystem/testcase/basesystem.sh b/basesystem/testcase/basesystem.sh new file mode 100755 index 0000000..beb025b --- /dev/null +++ b/basesystem/testcase/basesystem.sh @@ -0,0 +1,73 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230528-133112-970226717 +# @用例名称: basesystem +# @用例级别: 3 +# @用例标签: +# @用例类型: 功能 +############################################################################### +[ -z "$TST_TS_TOPDIR" ] && { + TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" + export TST_TS_TOPDIR +} +source "${TST_TS_TOPDIR}/tst_common/lib/common.sh" || exit 1 +############################################################################### + +g_tmpdir="$(mktemp -d)" + + +tc_setup() { + msg "this is tc_setup" + # @预置条件:系统正常运行,且已安装 basesystem + assert_true dnf install -y basesystem + + return 0 +} + + + +do_test() { + msg "this is do_test" + + # @测试步骤:1 使用 uname 命令检查系统内核版本 + # @预期结果:1 确保系统内核版本正确显示 + assert_true uname -r + + # @测试步骤:2 使用 hostname 命令检查主机名 + # @预期结果:2 确保主机名正确显示 + assert_true hostname + + # @测试步骤:3 使用 date 命令检查当前日期和时间 + # @预期结果:3 确保当前日期和时间正确显示 + assert_true date + + # @测试步骤:4 使用 whoami 命令检查当前登录用户 + # @预期结果:4 确保当前登录用户正确显示 + assert_true whoami + + # @测试步骤:5 使用 df 命令检查磁盘空间 + # @预期结果:5 确保磁盘空间正确显示 + assert_true df -h + + # @测试步骤:6 使用 uptime 命令检查系统运行时间 + # @预期结果:6 确保系统运行时间正确显示 + assert_true uptime + + # @测试步骤:7 使用 top 命令查看系统负载和进程状态 + # @预期结果:7 确保 top 命令正常运行,并能正确显示系统负载和进程状态 + assert_true top -n 1 + + return 0 +} + + + +tc_teardown() { + msg "this is tc_teardown" + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### -- Gitee