diff --git a/glibc/testcase/glibc-test.sh b/glibc/testcase/glibc-test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea2910c8ab29ae3b3564c737bf4f40de9547eda6 --- /dev/null +++ b/glibc/testcase/glibc-test.sh @@ -0,0 +1,58 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230525-154056-556766079 +# @用例名称: glibc-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" + # @预置条件:glibc已提前安装 + + assert_true command -v printf + assert_true command -v malloc + return 0 +} + +do_test() { + msg "this is do_test" + + # @测试步骤1:测试printf函数 + # @预期结果1:printf函数能正确输出字符串 + assert_true printf "Hello, World!\n" + + # @测试步骤2:测试动态内存分配函数malloc + # @预期结果2:malloc函数能成功分配内存 + ptr=$(malloc 100) + assert_true [ $? -eq 0 ] + unset ptr + + + + + return 0 +} + + + +tc_teardown() { + msg "this is tc_teardown" + + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + + +############################################################################### +tst_main "$@" +###############################################################################