update testcase for testsuite texlive-simplebnf
This commit is contained in:
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user