diff --git a/docs/system_base/docbook-utils/tc_service_docbook-utils_fun001.yaml b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun001.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a213718a7aff8af979d6b3c8831056a322d88472 --- /dev/null +++ b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun001.yaml @@ -0,0 +1,28 @@ +作者: xufei +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,docbook-utils +用例描述: jw命令基本功能测试 +修改人: xufei + +前置条件: +- 安装docbook-utils软件包 +- 复制测试目录./tests/system_base/docbook-utils/common为doc + +测试步骤: +- 使用简写参数组合执行jw命令,验证HTML文件生成 +- 使用全写参数组合执行jw命令,验证HTML文件生成 +- 使用-n -c参数执行jw命令,验证texi文件生成 +- 使用--nostd -c参数执行jw命令,验证texi文件生成 +- 使用-l参数执行jw命令,验证texi文件生成 +- 使用--dcl参数执行jw命令,验证texi文件生成 +- 使用-s参数执行jw命令,验证HTML文件生成 +- 使用--sgmlbase参数执行jw命令,验证HTML文件生成 +- 使用-u -c参数执行jw命令,验证HTML文件生成 +- 使用--nochunks -c参数执行jw命令,验证HTML文件生成 + +期望结果: +- 所有jw命令执行成功 +- 每次执行后都能生成对应的输出文件(.htm、.html或.texi) diff --git a/docs/system_base/docbook-utils/tc_service_docbook-utils_fun002.yaml b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun002.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3a9624701a062ed86c62f8d3bd126629728c8332 --- /dev/null +++ b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun002.yaml @@ -0,0 +1,31 @@ +作者: xufei +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,docbook-utils +用例描述: jw命令警告、错误和版本信息功能测试 +修改人: xufei + +前置条件: +- 安装docbook-utils软件包 +- 复制测试目录./tests/system_base/docbook-utils/common为doc + +测试步骤: +- 使用-w参数执行jw命令,验证警告列表输出 +- 使用--warning参数执行jw命令,验证警告列表输出 +- 使用-e参数执行jw命令,验证错误列表输出 +- 使用--error参数执行jw命令,验证错误列表输出 +- 使用-h参数执行jw命令,验证帮助信息 +- 使用--help参数执行jw命令,验证帮助信息 +- 使用-V参数传递变量执行jw命令,验证HTML文件生成 +- 使用--version参数执行jw命令,验证版本信息 +- 使用-v参数执行jw命令,验证版本信息 + +期望结果: +- 所有jw命令执行成功 +- -w和--warning参数执行后输出中包含"xml"字符串 +- -e和--error参数执行后输出中包含"no-idref"字符串 +- -h和--help参数执行后输出中包含"Usage: jw [] "字符串 +- -V参数执行后生成t1.html文件 +- --version和-v参数执行后输出中包含"jw version"字符串 diff --git a/docs/system_base/docbook-utils/tc_service_docbook-utils_fun003.yaml b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun003.yaml new file mode 100644 index 0000000000000000000000000000000000000000..60a8e3d16e9368032d0bd833d83b033c6ca7a1e9 --- /dev/null +++ b/docs/system_base/docbook-utils/tc_service_docbook-utils_fun003.yaml @@ -0,0 +1,26 @@ +作者: xufei +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,docbook-utils +用例描述: sgmldiff命令功能测试 +修改人: xufei + +前置条件: +- 安装docbook-utils软件包 +- 复制测试目录./tests/system_base/docbook-utils/common为doc + +测试步骤: +- 使用-a -s -c参数组合执行sgmldiff命令,验证差异输出 +- 使用--attributes --statistics --context参数组合执行sgmldiff命令,验证差异输出 +- 使用-h参数执行sgmldiff命令,验证帮助信息 +- 使用--help参数执行sgmldiff命令,验证帮助信息 +- 使用-v参数执行sgmldiff命令,验证版本信息 +- 使用--version参数执行sgmldiff命令,验证版本信息 + +期望结果: +- 所有sgmldiff命令执行成功 +- -a -s -c和--attributes --statistics --context参数执行后输出中包含"Hello World"字符串 +- -h和--help参数执行后输出中包含"Usage: sgmldiff [options]"字符串 +- -v和--version参数执行后输出中包含"sgmldiff v"字符串 diff --git a/tests/system_base/docbook-utils/common/helloworld.sgml b/tests/system_base/docbook-utils/common/helloworld.sgml new file mode 100644 index 0000000000000000000000000000000000000000..4b968353eadefc2b8dcffb80fe01f25835b71dd7 --- /dev/null +++ b/tests/system_base/docbook-utils/common/helloworld.sgml @@ -0,0 +1,11 @@ + +
+ +Hello World! +ABC + +Hello World! +Hello + +
+ diff --git a/tests/system_base/docbook-utils/tc_service_docbook-utils_fun001.py b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun001.py new file mode 100644 index 0000000000000000000000000000000000000000..79904a30c0f29d2c573827166cd33fbd4274cd69 --- /dev/null +++ b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun001.py @@ -0,0 +1,71 @@ +""" +@File: tc_service_docbook-utils_fun001.py +@Time: 2026/2/27 15:30:20 +@Author: xufei +@Version: 1.0 +@Contact: xufei@inspur.com +@License: Mulan PSL v2 +@Modify: xufei +""" +import subprocess +import time + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_service_docbook-utils_fun001.yaml for details + + :avocado: tags=P1,noarch,local,docbook-utils + """ + PARAM_DIC = {"pkg_name": "docbook-utils"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd('cp -r ./tests/system_base/docbook-utils/common doc') + + def test(self): + code, result = self.cmd( + 'jw -f docbook -b html -d none -p /usr/bin/jade -c doc/helloworld.sgml -o ./doc -i parajw doc/helloworld.sgml && test -f ./doc/t1.htm') + self.assertFalse(code, "Check jw -f -b -d -p -c -o -i failed") + + code, result = self.cmd( + 'jw --frontend docbook --backend html --dsl none --parser /usr/bin/jade --cat doc/helloworld.sgml --output doc/doc1 --include parajw doc/helloworld.sgml && test -f doc/doc1/t1.htm') + self.assertFalse(code, "Check jw --frontend --backend --dsl --parser --cat --output --include failed") + + self.cmd('echo aaa > doc/1.txt') + code, result = self.cmd('jw -n -c doc/1.txt doc/1.txt -b texi && test -f 1.texi') + self.assertFalse(code, "Check jw -n -c failed") + + self.cmd('echo aaa > doc/2.txt') + code, result = self.cmd('jw --nostd -c doc/2.txt doc/2.txt -b texi && test -f 2.texi') + self.assertFalse(code, "Check jw --nostd -c failed") + + self.cmd('echo aaa > doc/3.txt') + code, result = self.cmd('jw -l doc/3.txt -b texi doc/3.txt && test -f 3.texi') + self.assertFalse(code, "Check jw -l failed") + + self.cmd('echo aaa > doc/4.txt') + code, result = self.cmd('jw --dcl doc/4.txt -b texi doc/4.txt && test -f 4.texi') + self.assertFalse(code, "Check jw --dcl failed") + + self.cmd('rm -rf t1.html') + code, result = self.cmd('jw -s /usr/share/sgml/ doc/helloworld.sgml && test -f ./t1.html') + self.assertFalse(code, "Check jw -s failed") + + self.cmd('rm -rf t1.html') + code, result = self.cmd('jw --sgmlbase /usr/share/sgml/ doc/helloworld.sgml && test -f ./t1.html') + self.assertFalse(code, "Check jw --sgmlbase failed") + + code, result = self.cmd('jw -u -c ./doc/helloworld.sgml doc/helloworld.sgml && test -f ./helloworld.html') + self.assertFalse(code, "Check jw -u -c failed") + + self.cmd('rm -rf helloworld.html') + code, result = self.cmd('jw --nochunks -c doc/helloworld.sgml doc/helloworld.sgml && test -f ./helloworld.html') + self.assertFalse(code, "Check jw --nochunks -c failed") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd("rm -rf doc t1.html helloworld.html *.texi db2texi.refs") + diff --git a/tests/system_base/docbook-utils/tc_service_docbook-utils_fun002.py b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun002.py new file mode 100644 index 0000000000000000000000000000000000000000..b4ecb37d80b8a3ccb5cc9caf9d63ea2aebe35e76 --- /dev/null +++ b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun002.py @@ -0,0 +1,60 @@ +""" +@File: tc_service_docbook-utils_fun002.py +@Time: 2026/2/27 15:30:20 +@Author: xufei +@Version: 1.0 +@Contact: xufei@inspur.com +@License: Mulan PSL v2 +@Modify: xufei +""" +import subprocess +import time + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_service_docbook-utils_fun002.yaml for details + + :avocado: tags=P1,noarch,local,docbook-utils + """ + PARAM_DIC = {"pkg_name": "docbook-utils"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd('cp -r ./tests/system_base/docbook-utils/common doc') + + def test(self): + code, result = self.cmd('jw -w list | grep "xml"') + self.assertFalse(code, "Check jw -w failed") + + code, result = self.cmd('jw --warning list | grep "xml"') + self.assertFalse(code, "Check jw --warning failed") + + code, result = self.cmd('jw -e list | grep "no-idref"') + self.assertFalse(code, "Check jw -e failed") + + code, result = self.cmd('jw --error list | grep "no-idref"') + self.assertFalse(code, "Check jw --error failed") + + code, result = self.cmd('jw -h | fgrep "Usage: jw [] "') + self.assertFalse(code, "Check jw -h failed") + + code, result = self.cmd('jw --help | fgrep "Usage: jw [] "') + self.assertFalse(code, "Check jw --help failed") + + code, result = self.cmd('jw -V name=1 doc/helloworld.sgml && test -f ./t1.html') + self.assertFalse(code, "Check jw -V name failed") + + code, result = self.cmd('jw --version | grep "jw version [[:digit:]]"') + self.assertFalse(code, "Check jw --version failed") + + code, result = self.cmd('jw -v | grep "jw version [[:digit:]]"') + self.assertFalse(code, "Check jw -v failed") + + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd("rm -rf doc t1.html") + diff --git a/tests/system_base/docbook-utils/tc_service_docbook-utils_fun003.py b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun003.py new file mode 100644 index 0000000000000000000000000000000000000000..82a0c991a9fc69ceb4f308607e00ea27a30de5d3 --- /dev/null +++ b/tests/system_base/docbook-utils/tc_service_docbook-utils_fun003.py @@ -0,0 +1,53 @@ +""" +@File: tc_service_docbook-utils_fun003.py +@Time: 2026/2/27 15:30:20 +@Author: xufei +@Version: 1.0 +@Contact: xufei@inspur.com +@License: Mulan PSL v2 +@Modify: xufei +""" +import subprocess +import time + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_service_docbook-utils_fun003.yaml for details + + :avocado: tags=P1,noarch,local,docbook-utils + """ + PARAM_DIC = {"pkg_name": "docbook-utils"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd('cp -r ./tests/system_base/docbook-utils/common doc') + + def test(self): + code, result = self.cmd( + 'sgmldiff -a -s -c textpos doc/helloworld.sgml doc/helloworld1.sgml | grep "Hello World"') + self.assertFalse(code, "Check sgmldiff -a -s -c failed") + + code, result = self.cmd( + 'sgmldiff --attributes --statistics --context textpos doc/helloworld.sgml doc/helloworld1.sgml | grep "Hello World"') + self.assertFalse(code, "Check sgmldiff --attributes --statistics --context failed") + + code, result = self.cmd('sgmldiff -h 2>&1 | fgrep "Usage: sgmldiff [options]"') + self.assertFalse(code, "Check sgmldiff -h failed") + + code, result = self.cmd('sgmldiff --help 2>&1 | fgrep "Usage: sgmldiff [options]"') + self.assertFalse(code, "Check sgmldiff --help failed") + + code, result = self.cmd('sgmldiff -v | grep "sgmldiff v[[:digit:]]"') + self.assertFalse(code, "Check sgmldiff -v failed") + + code, result = self.cmd('sgmldiff --version | grep "sgmldiff v[[:digit:]]"') + self.assertFalse(code, "Check sgmldiff --version failed") + + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + self.cmd("rm -rf doc") +