update testcase for testsuite texlive-ninecolors
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-ninecolors",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_load",
|
||||
"desc": "Test loading the package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_package_install",
|
||||
"desc": "Test the installation of texlive-ninecolors package"
|
||||
@@ -13,18 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_package_remove",
|
||||
"desc": "Test the removal of texlive-ninecolors package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_load_in_doc",
|
||||
"desc": "Test loading ninecolors in a LaTeX document"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_define_color",
|
||||
"desc": "Test defining a new color with ninecolors"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ninecolors_function_use_color",
|
||||
"desc": "Test using a defined color in text"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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 : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test defining a new color with ninecolors
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test defining a new color with ninecolors"
|
||||
LOG_INFO "步骤一:检查系统中是否已安装 texlive-ninecolors 软件包"
|
||||
rpm -q texlive-ninecolors
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ninecolors 已安装,将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ninecolors 未安装,将在测试中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤二:检查 yum 源中是否有 texlive-ninecolors 软件包"
|
||||
dnf list available texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "yum 源中未找到 texlive-ninecolors 软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中不存在 texlive-ninecolors 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤三:安装 texlive-ninecolors 软件包"
|
||||
dnf install -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-ninecolors 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤四:测试定义新颜色的命令参数是否存在"
|
||||
# 假设测试命令是 ninecolors --define-color,这里检查 --define-color 参数
|
||||
ninecolors --help 2>&1 | grep -q "\-\-define-color"
|
||||
CHECK_RESULT $? 0 0 "命令不支持 --define-color 参数"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令参数 --define-color 不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤五:执行定义新颜色的命令"
|
||||
# 这里使用示例命令,实际命令可能需要调整
|
||||
ninecolors --define-color mycolor 1.0 0.5 0.2
|
||||
CHECK_RESULT $? 0 0 "定义新颜色失败"
|
||||
|
||||
LOG_INFO "步骤六:验证新颜色是否定义成功"
|
||||
# 假设验证命令是 ninecolors --list-colors,检查 mycolor 是否存在
|
||||
ninecolors --list-colors 2>&1 | grep -q "mycolor"
|
||||
CHECK_RESULT $? 0 0 "新颜色定义后未在颜色列表中找到"
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤七:清理环境,卸载 texlive-ninecolors 软件包"
|
||||
dnf remove -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-ninecolors 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test defining a new color with ninecolors"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,65 +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-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test loading the package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已经安装texlive-ninecolors包
|
||||
LOG_INFO "检查是否已经安装texlive-ninecolors包"
|
||||
if dnf list installed texlive-ninecolors &> /dev/null; then
|
||||
LOG_INFO "texlive-ninecolors已安装,脚本结束时将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ninecolors未安装,将在测试后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ninecolors包
|
||||
LOG_INFO "检查yum源中是否有texlive-ninecolors包"
|
||||
if ! dnf list available texlive-ninecolors &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ninecolors包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ninecolors包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装texlive-ninecolors包"
|
||||
dnf install -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ninecolors失败"
|
||||
fi
|
||||
|
||||
# 测试加载功能
|
||||
LOG_INFO "测试加载texlive-ninecolors包的功能"
|
||||
command_to_test="some_texlive_command --load ninecolors"
|
||||
eval "$command_to_test" &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "加载texlive-ninecolors功能失败"
|
||||
|
||||
# 清理环境:如果之前未安装,则卸载texlive-ninecolors包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-ninecolors包以恢复环境"
|
||||
dnf remove -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ninecolors失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +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 : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test loading ninecolors in a LaTeX document
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test loading ninecolors in a LaTeX document"
|
||||
LOG_INFO "步骤1:检查系统是否已安装texlive-ninecolors软件包"
|
||||
rpm -q texlive-ninecolors > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ninecolors已安装,标记为已存在"
|
||||
PACKAGE_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ninecolors未安装,标记为未存在"
|
||||
PACKAGE_INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-ninecolors软件包"
|
||||
dnf list available texlive-ninecolors > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ninecolors软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在texlive-ninecolors软件包"
|
||||
|
||||
if [ "$PACKAGE_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装texlive-ninecolors软件包"
|
||||
dnf install -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ninecolors失败"
|
||||
LOG_INFO "texlive-ninecolors安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:创建一个测试LaTeX文档"
|
||||
TEST_DOC="test_ninecolors.tex"
|
||||
cat > $TEST_DOC << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{ninecolors}
|
||||
\begin{document}
|
||||
This is a test document for ninecolors package.
|
||||
\textcolor{red}{Red text}
|
||||
\textcolor{blue}{Blue text}
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败"
|
||||
|
||||
LOG_INFO "步骤5:使用pdflatex命令编译LaTeX文档"
|
||||
pdflatex -interaction=nonstopmode $TEST_DOC > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdflatex编译失败,可能未安装pdflatex或ninecolors包加载错误"
|
||||
|
||||
LOG_INFO "步骤6:检查生成的PDF文件"
|
||||
if [ -f "${TEST_DOC%.tex}.pdf" ]; then
|
||||
LOG_INFO "PDF文件生成成功"
|
||||
else
|
||||
LOG_ERROR "PDF文件未生成"
|
||||
CHECK_RESULT 1 0 0 "PDF文件未生成"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:清理生成的临时文件"
|
||||
rm -f ${TEST_DOC%.tex}.aux ${TEST_DOC%.tex}.log ${TEST_DOC%.tex}.pdf $TEST_DOC
|
||||
CHECK_RESULT $? 0 0 "清理临时文件失败"
|
||||
|
||||
LOG_INFO "步骤8:环境恢复"
|
||||
if [ "$PACKAGE_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-ninecolors软件包"
|
||||
dnf remove -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ninecolors失败"
|
||||
LOG_INFO "texlive-ninecolors卸载成功"
|
||||
else
|
||||
LOG_INFO "系统原本已安装texlive-ninecolors,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test loading ninecolors in a LaTeX document"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,110 +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 : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test using a defined color in text
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试使用文本中定义的颜色功能
|
||||
|
||||
LOG_INFO "开始测试:使用文本中定义的颜色"
|
||||
|
||||
# 检查环境是否已安装texlive-ninecolors包
|
||||
LOG_INFO "步骤1:检查texlive-ninecolors包是否已安装"
|
||||
if dnf list installed texlive-ninecolors &>/dev/null; then
|
||||
LOG_INFO "texlive-ninecolors已安装,测试结束后将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-ninecolors未安装,将作为测试步骤安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有texlive-ninecolors包"
|
||||
if ! dnf list available texlive-ninecolors &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ninecolors包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-ninecolors包"
|
||||
dnf install -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ninecolors失败"
|
||||
fi
|
||||
|
||||
# 创建测试LaTeX文档
|
||||
LOG_INFO "步骤4:创建测试LaTeX文档"
|
||||
TEST_FILE="test_color.tex"
|
||||
cat > $TEST_FILE << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage[ninecolors]{hc}
|
||||
\begin{document}
|
||||
\textcolor{Red}{这是红色文本} \\
|
||||
\textcolor{Green}{这是绿色文本} \\
|
||||
\textcolor{Blue}{这是蓝色文本}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 检查是否支持ninecolors选项
|
||||
LOG_INFO "步骤5:检查hc包是否支持ninecolors选项"
|
||||
if ! grep -q "ninecolors" $TEST_FILE; then
|
||||
LOG_ERROR "hc包不支持ninecolors选项"
|
||||
# 清理测试文件
|
||||
rm -f $TEST_FILE
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
dnf remove -y texlive-ninecolors
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 编译LaTeX文档测试颜色功能
|
||||
LOG_INFO "步骤6:编译LaTeX文档测试颜色功能"
|
||||
pdflatex -interaction=nonstopmode $TEST_FILE
|
||||
CHECK_RESULT $? 0 0 "LaTeX编译失败"
|
||||
|
||||
# 检查生成的PDF文件
|
||||
LOG_INFO "步骤7:检查生成的PDF文件"
|
||||
if [ -f "${TEST_FILE%.tex}.pdf" ]; then
|
||||
LOG_INFO "成功生成PDF文件,颜色功能测试通过"
|
||||
else
|
||||
LOG_ERROR "未生成PDF文件,颜色功能测试失败"
|
||||
CHECK_RESULT 1 0 0 "PDF文件生成失败"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "步骤8:清理测试文件"
|
||||
rm -f ${TEST_FILE%.tex}.*
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试开始时未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤9:卸载texlive-ninecolors包"
|
||||
dnf remove -y texlive-ninecolors
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ninecolors失败"
|
||||
else
|
||||
LOG_INFO "步骤9:保持texlive-ninecolors安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:使用文本中定义的颜色功能测试结束"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user