diff --git a/suite2cases/function_test/pkg_test/abrt/abrt-addon-ccpp.json b/suite2cases/function_test/pkg_test/abrt/abrt-addon-ccpp.json deleted file mode 100644 index fce18f2b0c7..00000000000 --- a/suite2cases/function_test/pkg_test/abrt/abrt-addon-ccpp.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp", - "machine num": 1, - "cases": [ - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-backtrace__d", - "desc": "测试使用 -d 参数指定问题目录" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-backtrace__v", - "desc": "测试使用 -v 参数启用详细输出" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-backtrace__v__d", - "desc": "测试同时使用 -v 和 -d 参数,启用详细输出并指定问题目录" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-c__v_d", - "desc": "测试使用 -v 和 -d 参数组合" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-c__d", - "desc": "测试使用 -d 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-ccpp-local_v", - "desc": "测试 abrt-action-analyze-ccpp-local 命令的 -v 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-vulnerability_no_args", - "desc": "测试不带任何参数的 abrt-action-analyze-vulnerability 命令" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-vulnerability_v", - "desc": "测试带 -v 参数的 abrt-action-analyze-vulnerability 命令" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-vulnerability_upper_v", - "desc": "测试带 -V 参数的 abrt-action-analyze-vulnerability 命令" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__v", - "desc": "测试 verbose 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__d", - "desc": "测试 problem directory 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__t_num_10", - "desc": "测试 kill gdb timeout 参数为 10 秒" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__v_d", - "desc": "测试 verbose 和 problem directory 参数组合" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__d_t_num_5", - "desc": "测试 problem directory 和 kill gdb timeout 参数组合为 5 秒" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__v__d", - "desc": "测试 verbose 和 directory 参数组合" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__d", - "desc": "测试 directory 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__r__d", - "desc": "测试 recursive 和 directory 参数组合" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-list-dsos__o", - "desc": "测试使用 -o 参数指定输出文件" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-list-dsos__m", - "desc": "测试使用 -m 参数指定进程 PID 映射文件" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-list-dsos__o__m", - "desc": "测试同时使用 -o 和 -m 参数" - }, - { - "name": "test_abrt-addon-ccpp_function_core_backtrace", - "desc": "测试生成核心回溯文件功能" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-analyze-ccpp-local_default", - "desc": "测试 abrt-action-analyze-ccpp-local 默认行为" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-backtrace__v_d_t_num_5", - "desc": "测试 verbose、directory 和 timeout 参数组合,timeout 为 5 秒" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__v", - "desc": "测试 verbose 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__r", - "desc": "测试 recursive 参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__d_DIR", - "desc": "测试指定问题目录参数" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__v__d_DIR", - "desc": "测试 verbose 和指定问题目录参数的组合" - }, - { - "name": "test_abrt-addon-ccpp_abrt-action-generate-core-backtrace__r__d_DIR", - "desc": "测试 recursive 和指定问题目录参数的组合" - }, - { - "name": "test_abrt-addon-ccpp_function_core_dump", - "desc": "测试核心转储功能" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__d.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__d.sh deleted file mode 100644 index fbad00e43a0..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__d.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试使用 -d 参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 abrt-addon-ccpp 和 abrt-action-analyze-c 的 -d 参数功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查 yum 源中是否存在 abrt-addon-ccpp 和 abrt-action-analyze-c 软件包" - dnf list available abrt-addon-ccpp abrt-action-analyze-c &>/dev/null - CHECK_RESULT $? 0 255 "yum 源中不存在 abrt-addon-ccpp 或 abrt-action-analyze-c 软件包" - - # 检查是否已安装软件包 - LOG_INFO "检查是否已安装 abrt-addon-ccpp 和 abrt-action-analyze-c" - rpm -q abrt-addon-ccpp abrt-action-analyze-c &>/dev/null - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "未安装软件包,开始安装" - dnf install -y abrt-addon-ccpp abrt-action-analyze-c - CHECK_RESULT $? 0 0 "安装软件包失败" - need_cleanup=1 - else - LOG_INFO "软件包已安装,无需重复安装" - need_cleanup=0 - fi - - # 测试 -d 参数功能 - LOG_INFO "测试 abrt-action-analyze-c -d 参数功能" - abrt-action-analyze-c -d &>/dev/null - CHECK_RESULT $? 0 255 "-d 参数不支持或不存在" - - # 清理环境 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "清理环境,卸载软件包" - dnf remove -y abrt-addon-ccpp abrt-action-analyze-c - CHECK_RESULT $? 0 0"卸载软件包失败" - fi - - LOG_INFO"测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__v_d.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__v_d.sh deleted file mode 100644 index 32d9ff0b16c..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-analyze-c__v_d.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试使用 -v 和 -d 参数组合 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 abrt-addon-ccpp 和 abrt-action-analyze-c 的 -v 和 -d 参数组合" - - # 检查软件包是否已安装 - LOG_INFO "检查 abrt-addon-ccpp 和 abrt-action-analyze-c 是否已安装" - if ! rpm -q abrt-addon-ccpp abrt-action-analyze-c &> /dev/null; then - LOG_INFO "软件包未安装,开始安装" - # 检查yum源中是否有软件包 - LOG_INFO "检查yum源中是否有 abrt-addon-ccpp 和 abrt-action-analyze-c" - if ! dnf list available abrt-addon-ccpp abrt-action-analyze-c &> /dev/null; then - LOG_ERROR "yum源中未找到 abrt-addon-ccpp 或 abrt-action-analyze-c" - exit 255 - fi - # 安装软件包 - dnf install -y abrt-addon-ccpp abrt-action-analyze-c - CHECK_RESULT $? 0 0 "安装 abrt-addon-ccpp 和 abrt-action-analyze-c 失败" - # 标记需要卸载 - NEED_UNINSTALL=1 - else - LOG_INFO "软件包已安装,无需重新安装" - NEED_UNINSTALL=0 - fi - - # 测试 -v 和 -d 参数组合 - LOG_INFO "测试 abrt-action-analyze-c -v -d" - abrt-action-analyze-c -v -d - CHECK_RESULT $? 0 0 "abrt-action-analyze-c -v -d 执行失败" - - # 清理环境 - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "卸载之前安装的软件包" - dnf remove -y abrt-addon-ccpp abrt-action-analyze-c - CHECK_RESULT $? 0 0 "卸载 abrt-addon-ccpp 和 abrt-action-analyze-c失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__m.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__m.sh deleted file mode 100644 index e30023efa1b..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__m.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试使用 -m 参数指定进程 PID 映射文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试使用 -m 参数指定进程 PID 映射文件" - - # 检查是否已安装abrt-addon-ccpp和abrt-action-list-dsos - LOG_INFO "检查abrt-addon-ccpp和abrt-action-list-dsos是否已安装" - if ! dnf list installed abrt-addon-ccpp &> /dev/null || ! dnf list installed abrt-action-list-dsos &> /dev/null; then - LOG_INFO "abrt-addon-ccpp或abrt-action-list-dsos未安装,将进行安装" - INSTALLED=false - else - LOG_INFO "abrt-addon-ccpp和abrt-action-list-dsos已安装" - INSTALLED=true - fi - - # 检查yum源中是否有abrt-addon-ccpp和abrt-action-list-dsos - LOG_INFO "检查yum源中是否有abrt-addon-ccpp和abrt-action-list-dsos" - if ! dnf list available abrt-addon-ccpp &> /dev/null || ! dnf list available abrt-action-list-dsos &> /dev/null; then - LOG_ERROR "yum源中缺少abrt-addon-ccpp或abrt-action-list-dsos" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装abrt-addon-ccpp和abrt-action-list-dsos" - dnf install -y abrt-addon-ccpp abrt-action-list-dsos - CHECK_RESULT $? 0 0 "安装abrt-addon-ccpp和abrt-action-list-dsos失败" - fi - - # 测试使用 -m 参数指定进程 PID 映射文件 - LOG_INFO "测试使用 -m 参数指定进程 PID 映射文件" - TEST_PID=$$ - TEMP_MAP_FILE=$(mktemp) - echo "$TEST_PID /path/to/binary" > "$TEMP_MAP_FILE" - abrt-action-list-dsos -m "$TEMP_MAP_FILE" &> /dev/null - CHECK_RESULT $? 0 0 "使用 -m 参数指定进程 PID 映射文件失败" - rm -f "$TEMP_MAP_FILE" - - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载abrt-addon-ccpp和abrt-action-list-dsos" - dnf remove -y ab rt-addon-cc pp abrt-act ion-lis t-dso s - CHECK_RESULT $? 0 0 "卸载ab rt-ad don-c cpp或abr t-ac tion-li st-d sos失败" - fi - - LOG_INFO "测试完成:测试使用 -m 参数指定进程 PID 映射文件" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o.sh deleted file mode 100644 index 153e70cd8a0..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试使用 -o 参数指定输出文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试使用 -o 参数指定输出文件" - - # 检查是否已安装abrt-addon-ccpp和abrt-action-list-dsos - LOG_INFO "检查是否已安装abrt-addon-ccpp和abrt-action-list-dsos" - if ! dnf list installed abrt-addon-ccpp abrt-action-list-dsos &>/dev/null; then - LOG_INFO "未安装abrt-addon-ccpp和abrt-action-list-dsos,将进行安装" - if ! dnf list available abrt-addon-ccpp abrt-action-list-dsos &>/dev/null; then - LOG_ERROR "yum源中未找到abrt-addon-ccpp或abrt-action-list-dsos软件包" - exit 255 - fi - dnf install -y abrt-addon-ccpp abrt-action-list-dsos - CHECK_RESULT $? 0 0 "安装abrt-addon-ccpp和abrt-action-list-dsos失败" - INSTALLED=true - else - LOG_INFO "abrt-addon-ccpp和abrt-action-list-dsos已安装" - INSTALLED=false - fi - - # 测试使用 -o 参数指定输出文件 - LOG_INFO "测试使用 -o 参数指定输出文件" - OUTPUT_FILE="/tmp/abrt_dsos_output.txt" - if [ ! -f "$OUTPUT_FILE" ]; then - touch "$OUTPUT_FILE" - fi - - # 执行命令并检查结果 - LOG_INFO "执行abrt-action-list-dsos -o $OUTPUT_FILE命令" - abrt-action-list-dsos -o "$OUTPUT_FILE" - CHECK_RESULT $? 0 0 "执行abrt-action-list-dsos命令失败" - - # 检查输出文件是否存在且非空 - LOG_INFO "检查输出文件是否存在且非空" - if [ -f "$OUTPUT_FILE" ] && [ -s "$OUTPUT_FILE" ]; then - LOG_INFO "输出文件创建成功且内容非空" - else - LOG_ERROR "输出文件未创建或内容为空" - exit 1 - fi - - # 清理环境 - LOG_INFO "清理环境,删除临时文件" - rm -f "$OUTPUT_FILE" - - # 如果脚本安装了软件包,则在结束时卸载 - if [ "$INSTALLED" = true ]; then - LOG_INFO "卸载abrt-addon-ccpp和abrt-action-list-dsos" - dnf remove -y abrt-addon-ccpp abrt-action-list-dsos - CHECK_RESULT $? 0 0 "卸载abrt-addon-ccpp和abrt-action-list-dsos失败" - fi - - LOG_INFO "测试完成:测试使用 -o 参数指定输出文件" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o__m.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o__m.sh deleted file mode 100644 index 0de2b1c4b2a..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_abrt-action-list-dsos__o__m.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试同时使用 -o 和 -m 参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装abrt-addon-ccpp和abrt-action-list-dsos - if rpm -q abrt-addon-ccpp abrt-action-list-dsos >/dev/null 2>&1; then - LOG_INFO "abrt-addon-ccpp和abrt-action-list-dsos已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "abrt-addon-ccpp和abrt-action-list-dsos未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在abrt-addon-ccpp和abrt-action-list-dsos - LOG_INFO "检查yum源中是否存在abrt-addon-ccpp和abrt-action-list-dsos" - if ! dnf list available abrt-addon-ccpp abrt-action-list-dsos >/dev/null 2>&1; then - LOG_ERROR "yum源中不存在abrt-addon-ccpp或abrt-action-list-dsos" - exit 255 - fi - - # 安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装abrt-addon-ccpp和abrt-action-list-dsos" - dnf install -y abrt-addon-ccpp abrt-action-list-dsos - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试同时使用-o和-m参数 - LOG_INFO "测试同时使用-o和-m参数" - output=$(abrt-action-list-dsos -o /tmp/output.txt -m /tmp/map.txt 2>&1) - CHECK_RESULT $? 0 0 "执行命令失败: $output" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件/tmp/output.txt和/tmp/map.txt是否存在" - [ -f /tmp/output.txt ] && [ -f /tmp/map.txt ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理临时文件 - LOG_INFO "清理临时文件/tmp/output.txt和/tmp/map.txt" - rm -f /tmp/output.txt /tmp/map.txt - - # 卸载软件包(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载abrt-addon-ccpp和abrt-action-list-dsos" - dnf remove -y abrt-addon-ccpp abrt-action-list-dsos - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_backtrace.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_backtrace.sh deleted file mode 100644 index 2eaf5b226b3..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_backtrace.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/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-29 -# @License : Mulan PSL v2 -# @Desc : 测试生成核心回溯文件功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试生成核心回溯文件功能" - - # 检查是否已安装abrt-addon-ccpp - LOG_INFO "检查abrt-addon-ccpp是否已安装" - if rpm -q abrt-addon-ccpp &>/dev/null; then - LOG_INFO "abrt-addon-ccpp已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "abrt-addon-ccpp未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有abrt-addon-ccpp软件包 - LOG_INFO "检查yum源中是否存在abrt-addon-ccpp软件包" - if ! dnf list available abrt-addon-ccpp &>/dev/null; then - LOG_ERROR "yum源中未找到abrt-addon-ccpp软件包" - exit 255 - fi - - # 若未安装则安装abrt-addon-ccpp - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装abrt-addon-ccpp" - dnf install -y abrt-addon-ccpp - CHECK_RESULT $? 0 0 "安装abrt-addon-ccpp失败" - fi - - # 测试生成核心回溯文件功能 - LOG_INFO "测试生成核心回溯文件功能" - abrt-cli list | grep "core_backtrace" - CHECK_RESULT $? 0 0 "生成核心回溯文件功能测试失败" - - # 清理环境:若脚本开始时未安装则卸载abrt-addon-ccpp - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载abrt-addon-ccpp" - dnf remove -y abrt-addon-ccpp - CHECK_RESULT $? 0 0 "卸载abrt-addon-ccpp失败" - fi - - LOG_INFO "测试生成核心回溯文件功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_dump.sh b/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_dump.sh deleted file mode 100644 index 4d140f27747..00000000000 --- a/testcases/function_test/pkg_test/abrt/abrt-addon-ccpp/test_abrt-addon-ccpp_function_core_dump.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/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-12-13 -# @License : Mulan PSL v2 -# @Desc : 测试核心转储功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试核心转储功能 - LOG_INFO "开始测试核心转储功能" - - # 检查是否已安装abrt-addon-ccpp - if dnf list installed abrt-addon-ccpp &>/dev/null; then - LOG_INFO "abrt-addon-ccpp已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "abrt-addon-ccpp未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有abrt-addon-ccpp软件包 - LOG_INFO "检查yum源中是否有abrt-addon-ccpp软件包" - if ! dnf list available abrt-addon-ccpp &>/dev/null; then - LOG_ERROR "yum源中未找到abrt-addon-ccpp软件包" - exit 255 - fi - - # 安装abrt-addon-ccpp - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装abrt-addon-ccpp" - dnf install -y abrt-addon-ccpp - CHECK_RESULT $? 0 0 "安装abrt-addon-ccpp失败" - fi - - # 测试核心转储功能是否正常工作 - LOG_INFO "测试核心转储功能是否正常工作" - echo "int main() { abort(); return 0; }" > test_core_dump.c - gcc test_core_dump.c -o test_core_dump - CHECK_RESULT $? 0 0 "编译测试程序失败" - - ./test_core_dump - CHECK_RESULT $? 134 0 "核心转储功能未正常工作" - - # 检查是否生成了核心转储文件 - LOG_INFO "检查是否生成了核心转储文件" - if ls /var/spool/abrt/*/coredump &>/dev/null; then - LOG_INFO "核心转储文件已生成" - else - LOG_ERROR "未找到核心转储文件" - exit 1 - fi - - # 清理测试程序及核心转储文件 - LOG_INFO "清理测试程序及核心转储文件" - rm -f test_core_dump.c test_core_dump - rm -rf /var/spool/abrt/*/coredump - - # 如果之前未安装,则卸载abrt-addon-ccpp - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载abrt-addon-ccpp" - dnf remove -y abrt-addon-ccpp - CHECK_RESULT $? 0 0 "卸载abrt-addon-ccpp失败" - fi - - LOG_INFO "测试核心转储功能完成" -} - -main "$@" \ No newline at end of file