update testcase for testsuite texlive-simplebnf

This commit is contained in:
2026-04-16 21:29:18 +08:00
parent 7f9b8a6799
commit 12efd6c46f
2 changed files with 0 additions and 91 deletions

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-simplebnf",
"machine num": 1,
"cases": [
{
"name": "test_texlive-simplebnf_function_compile",
"desc": "Test compilation of BNF files"
}
]
}

View File

@@ -1,81 +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 compilation of BNF files
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-simplebnf
LOG_INFO "检查是否已安装texlive-simplebnf"
dnf list installed texlive-simplebnf > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-simplebnf已安装脚本结束后保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-simplebnf未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有texlive-simplebnf
LOG_INFO "检查yum源中是否有texlive-simplebnf"
dnf list available texlive-simplebnf > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-simplebnf退出"
exit 255
fi
# 安装texlive-simplebnf如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-simplebnf"
dnf install -y texlive-simplebnf > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-simplebnf失败"
fi
# 测试编译BNF文件
LOG_INFO "测试编译BNF文件"
TEST_FILE="test.bnf"
cat > "$TEST_FILE" <<EOF
%token A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
%token a b c d e f g h i j k l m n o p q r s t u v w x y z
%token num
expr ::= term ((PLUS | MINUS) term)*
term ::= factor ((MUL | DIV) factor)*
factor ::= NUM | LPAREN expr RPAREN
EOF
LOG_INFO "使用latex编译BNF文件"
latex "$TEST_FILE" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "编译BNF文件失败"
# 清理测试文件
rm -f "$TEST_FILE" "$TEST_FILE.aux" "$TEST_FILE.log"
# 卸载texlive-simplebnf如果脚本开始时未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-simplebnf"
dnf remove -y texlive-simplebnf > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-simplebnf失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"