From 94307ab89cf156daeacb9170c867edb7b8806f95 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 28 May 2023 16:48:00 +0800 Subject: [PATCH] add file-test.sh --- .gitmodules | 3 +++ my_file/testcase/file-test.sh | 43 +++++++++++++++++++++++++++++++++++ my_file/tst_common | 1 + 3 files changed, 47 insertions(+) create mode 100755 my_file/testcase/file-test.sh create mode 160000 my_file/tst_common diff --git a/.gitmodules b/.gitmodules index 1140553..5b6968e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "mariadb/tst_common"] path = mariadb/tst_common url = https://gitee.com/opencloudos-stream/test-suite-base.git +[submodule "my_file/tst_common"] + path = my_file/tst_common + url = https://gitee.com/opencloudos-stream/test-suite-base.git diff --git a/my_file/testcase/file-test.sh b/my_file/testcase/file-test.sh new file mode 100755 index 0000000..a4a7444 --- /dev/null +++ b/my_file/testcase/file-test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230528-162446-471121300 +# @用例名称: 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" + assert_true yum install -y file + return 0 +} + +do_test() { + msg "this is do_test" + + assert_true touch a.txt + echo "test" >> a.txt + assert_true file -b a.txt + + return 0 +} + +tc_teardown() { + msg "this is tc_teardown" + rm a.txt + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +############################################################################### diff --git a/my_file/tst_common b/my_file/tst_common new file mode 160000 index 0000000..6a4bfa4 --- /dev/null +++ b/my_file/tst_common @@ -0,0 +1 @@ +Subproject commit 6a4bfa4dc8d07271d3a10b7e0518b4e899235c31 -- Gitee