From 5e1d8c322fc6d1e6cd81e1715c20520d4213cac6 Mon Sep 17 00:00:00 2001 From: bessiewang Date: Thu, 25 May 2023 18:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Efile-test=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=EF=BC=8C=E9=AA=8C=E8=AF=81file=20-b=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file/testcase/file-test.sh | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 file/testcase/file-test.sh diff --git a/file/testcase/file-test.sh b/file/testcase/file-test.sh new file mode 100755 index 0000000..8f44d7f --- /dev/null +++ b/file/testcase/file-test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230525-180317-666143046 +# @用例名称: file-test +# @用例级别: 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" + # @预置条件: 系统正常运行,且已安装file软件包 + assert_true yum install -y file + return 0 +} + +do_test() { + msg "this is do_test" + + # @测试步骤:1: 测试file -b命令 + touch a.txt + echo "test" >>a.txt + assert_true file -b a.txt + # @预期结果:1: 命令正常 + + return 0 +} + +tc_teardown() { + msg "this is tc_teardown" + rm a.txt + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### -- Gitee