From 376d5fc81d6cdad43a968f058cfcea5073d040d0 Mon Sep 17 00:00:00 2001 From: linyangshi Date: Mon, 1 Aug 2022 13:23:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9E=97=E6=B4=8B?= =?UTF-8?q?=E4=BB=95=E6=B5=8B=E8=AF=95=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 6148 bytes documents/.DS_Store | Bin 0 -> 6148 bytes ...3-\346\236\227\346\264\213\344\273\225.md" | 6 +- suite2cases/itstool.json | 8 +++ testcases/.DS_Store | Bin 0 -> 6148 bytes testcases/itstool/common/IT-keep-entities.xml | 7 ++ testcases/itstool/common/Translate1.po | 46 +++++++++++++ testcases/itstool/common/Translate1.xml | 39 +++++++++++ testcases/itstool/common/dtd.xml | 7 ++ .../elementwithintextlocalitsSpanXml.xml | 7 ++ testcases/itstool/common/join.cs.mo | Bin 0 -> 923 bytes testcases/itstool/common/join.xml | 19 ++++++ testcases/itstool/common/test | 0 testcases/itstool/common/test.mo | Bin 0 -> 303 bytes testcases/itstool/common/test.xml | 0 testcases/itstool/oe_test_itstool_1.sh | 64 ++++++++++++++++++ 16 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 .DS_Store create mode 100644 documents/.DS_Store mode change 100755 => 100644 "documents/\346\226\207\346\234\254\346\265\213\350\257\225\347\224\250\344\276\213-\346\236\227\346\264\213\344\273\225.md" create mode 100644 suite2cases/itstool.json create mode 100644 testcases/.DS_Store create mode 100644 testcases/itstool/common/IT-keep-entities.xml create mode 100644 testcases/itstool/common/Translate1.po create mode 100644 testcases/itstool/common/Translate1.xml create mode 100644 testcases/itstool/common/dtd.xml create mode 100644 testcases/itstool/common/elementwithintextlocalitsSpanXml.xml create mode 100644 testcases/itstool/common/join.cs.mo create mode 100644 testcases/itstool/common/join.xml create mode 100644 testcases/itstool/common/test create mode 100644 testcases/itstool/common/test.mo create mode 100644 testcases/itstool/common/test.xml create mode 100644 testcases/itstool/oe_test_itstool_1.sh diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c13dad646e5352dc7b473612af6430063995152c GIT binary patch literal 6148 zcmeHKO>fgc5S?v9YZD>mK&u{C;u?t%N=(JY3gr)A1P4ID#uiw(-YRy;!HVP~AO8pO zOZt2IW_OE7lT@4vqC3*g+uhl*^`5o69wHLsS^9veM?@YPW9K&98sj*(72C2iJ3yhI zaY7lDR8y7AS5~_Tr+`!7UsHhhu1_f`dQUU@ZU0uMNud%%eV`%j)vJ{2dW`evjQIC-?) zv3LRB(OJXnb2KdrRenH}GrLrQcaAeFqaieiG0yn>`o;gpwe#O^nnz$C99_Zwi=nxZ z{nyRhE-Bz^?iKtx_J8N=4-Ub96kNgo&%Qo?)g@+^xEm2~s<%7G>)uoW9B-$9Q(&V4 zd_G7t#?WGGP#+y|xrFs%)Jt|d4}S`00=1`&Y?lL|Dc!j>4qq+?#%b)m)9ph+iT ziw|MnENq1$^xN@#sh5)o4La`>a0)Cdux*AtzW<+XuK$;l+{h{56!@H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0&1 \| grep "Usage: lunit"或者 ntfscat -h 2>&1 \| grep "Usage: lunit" 2、-v,--version:显示lunit的版本信息 执行命令:ntfscat --version 2>&1 \| grep "lunit" 或者 ntfscat -V 2>&1 \| grep "lunit" 3、-p,--path,设定lua的位置 执行命令:lunit -p /usr/bin/lunit 或者 lunit -path /usr/bin/lunit 4、-i --interpreter 设置lunit解释器 lunit -i /usr/bin/lua 或者 lunit --interpreter /usr/bin/lua 5、-r,--runner 设置lunit的执行模式 执行命令:lunit -r lunit 或者 lunit -runner lunit 6、-t,--test 使用lunit测试lua文件 执行命令 lunit -t test.lua 或者 lunit --test test.lua 7、只读取测试文件 执行命令:lunit --loadonly test.lua 8、指定lunit的cpath 执行命令 lunit --cpath /usr/bin/lunit 9、 不强制加载/usr/bin/lunit*.lua. 执行命令: lunit --dontforce test.lua| 1、输出lunit的帮助信息 2、输出lunit的版本信息 3、命令执行成功 4、命令执行成功 5、命令执行成功 6、显示测试结果 7、显示结果 8、命令执行成功 9、显示结果| 是 | | -| itstool | oe_test_itstool_1 | 单元测试 | 功能测试 | itstool提取xml中的its规则,这里验证itstool命令的参数用法 | 1 | 安装二进制包itstool: dnf install -y "itstool gettext|itstool命令用法:1、-h,--help:显示itstool的帮助信息 执行命令:itstool --help \| grep "Usage"或者 itstool -h\| grep "Usage" 2、-v,--version:显示版本信息 执行命令:itstool -v \| grep "itstool" \| grep "itstool" 或者 itstool --version \| grep "itstool" 3、-d,--load-dtd:使用外部dtd解析xml 执行命令:从github下载官方测试xml命名为dtd.xml,执行itstool -d dtd.xml 或者 itstool --load-dtd dtd.xml 4、-i --its:使用外部its规则解析xml 执行命令:从github下载官方测试xml elementwithintextlocalitsSpanXml.xml,执行 itstool -i elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml或 itstool --its=elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml 5、-j --join:将二进制文件加入xml中,执行 itstool -j join.xml join.cs.mo > test.xml && cat test.xml 6、-k --keep-entities:保持实体引用解析xml 执行命令:从github下载官方测试xml keep-entities.xml 执行 itstool -k keep-entities.xml 7、-l --lang:itstool -l 'll' -m join.cs.mo -o test Translate1.xml 8、-m --merge:将二进制文件与xml结合提取its 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml > test && cat test \| grep its 9、-n,--nobuitins 不使用内置的its规则 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml > test && cat test \| grep rules 10、-o,--output 将itstool命令的结果输出到指定文件 执行命令:itstool -o test Translate1.xml|1、输出itstool的帮助信息 2、输出itstool的版本信息 3、输出使用外部dtd后的xml解析信息 4、输出使用外部its解析后的xml信息 5、输出加入二进制规则后的xml 6、输出xml,不引用实体 7、显性设定输出的语言标签 8、输出its规则 9、不使用内置its规则,而是使用二进制文件中的its规则输出its 10、输出文件,文件内容是xml提取出的its规则|是 | | - |itstool|oe_test_itstool_2|单元测试|功能测试|itstool提取xml中的its规则,这里验证itstool命令的参数用法|1|安装二进制包itstool: dnf install -y "itstool gettext|1、-p,--param 将ITS参数名重新设置 执行命令:itstool -p msgid id Translate1.xml 或itstool --param=msgid id Translate1.xml\| grep id 2、--path 可以找到its的额外路径 itstool --path=IT-externalRef1.txt IT-externalRef1.xml \|grep ref 3、-s,--strict 当PO文件包含损坏的XML时,显示错误 执行命令:itstool -s broken.xml 或 itstool --strict broken.xml 4、-t,--test 生成测试一致性输出 执行命令:itstool -t translate Translate1.xml 或 itstool --test=translate Translate.xml 5、无参数 提取xml文件中包含的its规则 itstool Translate.xml| 1、输出设定的带特定参数名的its 2、输出带引用的its规则 3、输出错误 4、输出测试结果 5、输出its规则|是|| \ No newline at end of file +| lua-lunit | oe_test_lunit_1 | 单元测试 | 功能测试 | lua脚本的单元测试工具包 ,这里验证lunit命令的参数用法 | 1 | 安装二进制包lua-lunit: dnf install -y lua-lunit| lua-lunit命令的用法:
1、-h,-h--help:显示lunit的帮助信息 执行命令:lunit --help 2>&1 \| grep "Usage: lunit"或者 ntfscat -h 2>&1 \| grep "Usage: lunit"
2、-v,--version:显示lunit的版本信息 执行命令:ntfscat --version 2>&1 \| grep "lunit" 或者 ntfscat -V 2>&1 \| grep "lunit"
3、-p,--path,设定lua的位置 执行命令:lunit -p /usr/bin/lunit 或者 lunit -path /usr/bin/lunit
4、-i --interpreter 设置lunit解释器 lunit -i /usr/bin/lua 或者 lunit --interpreter /usr/bin/lua
5、-r,--runner 设置lunit的执行模式 执行命令:lunit -r lunit 或者 lunit -runner lunit
6、-t,--test 使用lunit测试lua文件 执行命令 lunit -t test.lua 或者 lunit --test test.lua
7、--loadonly 只读取测试文件 执行命令:lunit --loadonly test.lua
8、--cpath 指定lunit的cpath 执行命令 lunit --cpath /usr/bin/lunit
9、--dontforce 不强制加载/usr/bin/lunit*.lua. 执行命令: lunit --dontforce test.lua
10、无参数,执行lua测试脚本 执行命令:lunit test.lua| 1、输出lunit的帮助信息
2、输出lunit的版本信息
3、命令执行成功
4、命令执行成功
5、命令执行成功
6、显示测试结果
7、显示结果
8、命令执行成功
9、显示结果
10、显示结果| 是 | | +| itstool | oe_test_itstool_1 | 单元测试 | 功能测试 | itstool提取xml中的its规则,这里验证itstool命令的参数用法 | 1 | 安装二进制包itstool: dnf install -y "itstool gettext|itstool命令用法:
1、-h,--help:显示itstool的帮助信息 执行命令:itstool --help \| grep "Usage"或者 itstool -h\| grep "Usage"
2、-v,--version:显示版本信息 执行命令:itstool -v \| grep "itstool" \| grep "itstool" 或者 itstool --version \| grep "itstool"
3、-d,--load-dtd:使用外部dtd解析xml 执行命令:从github下载官方测试xml命名为dtd.xml,执行itstool -d dtd.xml 或者 itstool --load-dtd dtd.xml
4、-i --its:使用外部its规则解析xml 执行命令:从github下载官方测试xml elementwithintextlocalitsSpanXml.xml,执行 itstool -i elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml或 itstool --its=elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml
5、-j --join:将二进制文件加入xml中,执行 itstool -j join.xml join.cs.mo > test.xml && cat test.xml
6、-k --keep-entities:保持实体引用解析xml 执行命令:从github下载官方测试xml keep-entities.xml 执行 itstool -k keep-entities.xml 或者 itstool --keep-entities keep-entities.xml
7、-l --lang:显性设置语言标签 执行命令:itstool -l 'll' -m join.cs.mo -o test Translate1.xml
8、-m --merge:将二进制文件与xml结合提取its 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml -o && cat test \| grep its 或者 itstool -n -lang='ll' -m test.mo Translate1.xml -o test && cat test \| grep its
9、-n,--nobuitins 不使用内置的its规则 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml -o test && cat test \| grep rules 或者 itstool --no-builtins -l 'll' -m test.mo Translate1.xml -o test && cat test \| grep rules
10、-o,--output 将itstool命令的结果输出到指定文件 执行命令:itstool -o test Translate1.xml | cat test 或者 itstool --output test Translate1.xml | cat test|1、输出itstool的帮助信息
2、输出itstool的版本信息
3、输出使用外部dtd后的xml解析信息
4、输出使用外部its解析后的xml信息
5、输出加入二进制规则后的xml
6、输出xml,不引用实体
7、显性设定输出的语言标签
8、输出its规则
9、不使用内置its规则,而是使用二进制文件中的its规则输出its
10、输出文件,文件内容是xml提取出的its规则|是 | | + |itstool|oe_test_itstool_2|单元测试|功能测试|itstool提取xml中的its规则,这里验证itstool命令的参数用法|1|安装二进制包itstool: dnf install -y "itstool gettext|1、-p,--param 将ITS参数名重新设置 执行命令:itstool -p msgid id Translate1.xml 或itstool --param=msgid id Translate1.xml\| grep id
2、--path 可以找到its的额外路径 itstool --path=IT-externalRef1.txt IT-externalRef1.xml \|grep ref
3、-s,--strict 当PO文件包含损坏的XML时,显示错误 执行命令:itstool -s broken.xml 或 itstool --strict broken.xml
4、-t,--test 生成测试一致性输出 执行命令:itstool -t translate Translate1.xml 或 itstool --test=translate Translate.xml
5、无参数 提取xml文件中包含的its规则 执行命令:itstool Translate.xml| 1、输出设定的带特定参数名的its
2、输出带引用的its规则
3、输出错误
4、输出测试结果
5、输出its规则|是|| \ No newline at end of file diff --git a/suite2cases/itstool.json b/suite2cases/itstool.json new file mode 100644 index 00000000..57c62668 --- /dev/null +++ b/suite2cases/itstool.json @@ -0,0 +1,8 @@ +{ + "path": "$OET_PATH/testcases/cli-test/itstool", + "cases": [ + { + "name": "oe_test_itstool_1" + } + ] +} diff --git a/testcases/.DS_Store b/testcases/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..db7ded529785c1c7464a2951cb8aa64a8ab17b08 GIT binary patch literal 6148 zcmeHK%}T>S5Z>*NO({YT3Oz1(Em+&yAH0NGU%-eSRBA(u4aRI~(pD&iob`o#5}(JJ z-Hr4|PlAffgxPO*b|zuIgq;jyjCZDkBgTr1F$)wim51RI!F|*%Nf}E9kgIzW)Hospb7Q9qi7o&Mw+ zR~J(HZZhw?m)>yREAE}jAnJR;aH0ad!4O<-uDoC%=N&l>2BC^|^oEtU^1Whdv8Xm% zWl?Q6mSwSMHY;UOuQis-ytRLDcyiu*@E-&Dtcm3C#VOe}n7|86Rx+A7lfak3JyF+dCu1BL-S z9|S0(Z7|lTjt&@93jm0}kxF2Wy#&SxgSNp~BkX{19SW#JxoI)D4hOq1ezw6_qYh`> zG#}hNnVSxUtEa>Lg>q-y)<`2UKn$!ikk-p0*8j7w`~USIS`h=pz`tUEXSz yx|JN(S^;_oih_Qz#*Yw~s8S5RSc*%aO295~0%#kIHG&0%egqT^G!O$n%D_8u!HM4h literal 0 HcmV?d00001 diff --git a/testcases/itstool/common/IT-keep-entities.xml b/testcases/itstool/common/IT-keep-entities.xml new file mode 100644 index 00000000..bb87ea85 --- /dev/null +++ b/testcases/itstool/common/IT-keep-entities.xml @@ -0,0 +1,7 @@ + + + + + The history of Leonard “Bones” McCoy + + diff --git a/testcases/itstool/common/Translate1.po b/testcases/itstool/common/Translate1.po new file mode 100644 index 00000000..810664a8 --- /dev/null +++ b/testcases/itstool/common/Translate1.po @@ -0,0 +1,46 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2022-07-27 17:34+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. (itstool) path: body/par +#: Translate1.xml:14 +msgid "Texte avec une image : \"Description." +msgstr "" + +#. (itstool) path: body/par@title +#: Translate1.xml:15 +msgid "Texte" +msgstr "" + +#. (itstool) path: body/par +#: Translate1.xml:15 +msgid "C'est le premier paragraphe. Il contient du texte <_:verbatim-1/>." +msgstr "" + +#. (itstool) path: 封面/汇集 +#: Translate1.xml:20 +msgid "Le Seigneur des Anneaux" +msgstr "" + +#. (itstool) path: 封面/标题 +#: Translate1.xml:21 +msgid "Le retour du Roi" +msgstr "" + +#. (itstool) path: 章节/头注 +#: Translate1.xml:25 +msgid "Minas Tirith" +msgstr "" + +#. (itstool) path: 章节/段落识别 +#: Translate1.xml:26 +msgid "<_:姓名-1/> regarda depuis l'abri du manteau de <_:姓名-2/>." +msgstr "" + diff --git a/testcases/itstool/common/Translate1.xml b/testcases/itstool/common/Translate1.xml new file mode 100644 index 00000000..72b30fe1 --- /dev/null +++ b/testcases/itstool/common/Translate1.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + Texte avec une image : Description d'image. + C'est le premier paragraphe. Il contient du texte un-translatable + code with an image: Image description. + + + + Le Seigneur des Anneaux + Le retour du Roi + J.R.R. Tolkein + + + Minas Tirith + Pippin regarda depuis l'abri du manteau de Gandalf. + + + + + + + + + + + + + diff --git a/testcases/itstool/common/dtd.xml b/testcases/itstool/common/dtd.xml new file mode 100644 index 00000000..bb87ea85 --- /dev/null +++ b/testcases/itstool/common/dtd.xml @@ -0,0 +1,7 @@ + + + + + The history of Leonard “Bones” McCoy + + diff --git a/testcases/itstool/common/elementwithintextlocalitsSpanXml.xml b/testcases/itstool/common/elementwithintextlocalitsSpanXml.xml new file mode 100644 index 00000000..0368a9c9 --- /dev/null +++ b/testcases/itstool/common/elementwithintextlocalitsSpanXml.xml @@ -0,0 +1,7 @@ + + + Text with bold. + + \ No newline at end of file diff --git a/testcases/itstool/common/join.cs.mo b/testcases/itstool/common/join.cs.mo new file mode 100644 index 0000000000000000000000000000000000000000..43f49b62fd8f06f158be7e6d702451bb6acd33ec GIT binary patch literal 923 zcmZvaKW`H;7{(7Me-xMy1ELHb0D+K`O8`+FA!^kIRF%@Ggic7vy?dLx+?{Rtd{NpD zfW**|p%P0679{uvu%waTOE9qV5mDks-E} z39V6DQ>6Ui7PB-Ixz4B>s=QTMUR-V;l~%9% zm3bvCo`H8aHA=BGw6#ftp0F?$rXc(Db@v&cIr6!RHpuX{3{{lKUchG76I=1RiuDO2 zk}4|0c=U~JX*1d#2)r;Za5zJYTz^k%?=jbYV+WZUe<$hENwK$`ZXPxFe?N{c2Qsna z9i~#1$MBEdGh#v;?nieeMfCnf%iRW)8ieAw34_$M{UW`Zl2=jRT10U7Dkoc EKi1F??EnA( literal 0 HcmV?d00001 diff --git a/testcases/itstool/common/join.xml b/testcases/itstool/common/join.xml new file mode 100644 index 00000000..e0152c80 --- /dev/null +++ b/testcases/itstool/common/join.xml @@ -0,0 +1,19 @@ + + + + + This is a plain message. + This message uses a prefix. + This message is in another namespace. + + This message is in a holder element. + + + This message has a block footnote. + + + This message has some inline markup. + + \ No newline at end of file diff --git a/testcases/itstool/common/test b/testcases/itstool/common/test new file mode 100644 index 00000000..e69de29b diff --git a/testcases/itstool/common/test.mo b/testcases/itstool/common/test.mo new file mode 100644 index 0000000000000000000000000000000000000000..53aa5683acbb80dd5ea81b6a9256f037f1dd4c79 GIT binary patch literal 303 zcmYMuy-ve06b0ZSm@+amcwhq;*n%llt;Q`8b{yrW5^N?l!6?|3V-P$Dug6=kbG^_b zebYVCJwL}s-xJ6II02{N5S)XU6#Rl~5Ig@Vy?fPN!1)$$v>%PL1eJ7oPuC1>SXJk; zNJ@z-{bAw}XDVod9vH2#kT|30P7;xyJ<5V5T#W%YUfFR_!FhsKE$679f}t4`H0KMN zWfiOIIaF=`u6m6dt=)c)neE)x*q)&D$%JI`2iJyCT>t<8 literal 0 HcmV?d00001 diff --git a/testcases/itstool/common/test.xml b/testcases/itstool/common/test.xml new file mode 100644 index 00000000..e69de29b diff --git a/testcases/itstool/oe_test_itstool_1.sh b/testcases/itstool/oe_test_itstool_1.sh new file mode 100644 index 00000000..794b106e --- /dev/null +++ b/testcases/itstool/oe_test_itstool_1.sh @@ -0,0 +1,64 @@ +#!/usr/bin/bash + +# Copyright (c) 2021. Huawei Technologies Co.,Ltd.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 detaitest -f. + +# ############################################# +# @Author : linyangshi +# @Contact : 1042036289@qq.com +# @Date : 2022/07/26 +# @License : Mulan PSL v2 +# @Desc : Test itstool function:--help,--version, +# ############################################# + +source "../common/common_lib.sh" +function pre_test() { + LOG_INFO "Start environmental preparation." + DNF_INSTALL "itstool" + cd common + LOG_INFO "End of environmental preparation!" +} + +function run_test() { + LOG_INFO "Start testing..." + itstool --version | grep "itstool" && itstool -v | grep "itstool" + CHECK_RESULT $? 0 0 "itstool --version or -v failed" + itstool --help | grep "Usage" && itstool -h | grep "Usage" + CHECK_RESULT $? 0 0 "itstool --help or -h failed" + itstool -d dtd.xml && itstool --load-dtd dtd.xml + CHECK_RESULT $? 0 0 "itstool --load-dtd or -d failed" + itstool -i elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml + CHECK_RESULT $? 0 0 "itstool -i failed" + itstool --its=elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml + CHECK_RESULT $? 0 0 "itstool --its failed" + itstool -j join.xml join.cs.mo > test.xml && cat test.xml + CHECK_RESULT $? 0 0 "itstool -j failed" + itstool --join join.xml join.cs.mo > test.xml && cat test.xml + CHECK_RESULT $? 0 0 "itstool --join failed" + itstool -k keep-entities.xml && itstool --keep-entities keep-entities.xml + CHECK_RESULT $? 0 0 "itstool -k or --keep-entities failed" + itstool -l 'll' -m test.mo -o test.xml Translate1.xml | cat test.xml + CHECK_RESULT %? 0 0 "itstool -l failed" + itstool -n --lang='ll' -m test.mo -o test.xml Translate1.xml | cat test.xml + CHECK_RESULT $? 0 0 "itstool --lang failed" + itstool -n -l 'll' -m test.mo Translate1.xml -o test && cat test | grep rules + CHECK_RESULT $? 0 0 "itstool -n failed" + itstool --no-builtins -l 'll' -m test.mo Translate1.xml -o test && cat test | grep rules + CHECK_RESULT $? 0 0 "itstool --no-builtins failed" + itstool -o test Translate1.xml | cat test && itstool --output test Translate1.xml | cat test + CHECK_RESULT $? 0 0 "itstool -o or --output failed" + LOG_INFO "Finish test!" +} + +function post_test() { + LOG_INFO "start environment cleanup." + LOG_INFO "Finish environment cleanup!" +} + +main "$@" -- Gitee From 2ca339bebcbc78760eeface378463e7de804bf1b Mon Sep 17 00:00:00 2001 From: linyangshi Date: Tue, 2 Aug 2022 11:19:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0oe=5Ftest=5Fitstool=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3-\346\236\227\346\264\213\344\273\225.md" | 2 +- testcases/itstool/oe_test_itstool_2.sh | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 testcases/itstool/oe_test_itstool_2.sh diff --git "a/documents/\346\226\207\346\234\254\346\265\213\350\257\225\347\224\250\344\276\213-\346\236\227\346\264\213\344\273\225.md" "b/documents/\346\226\207\346\234\254\346\265\213\350\257\225\347\224\250\344\276\213-\346\236\227\346\264\213\344\273\225.md" index 33d8a22c..a73c18c0 100644 --- "a/documents/\346\226\207\346\234\254\346\265\213\350\257\225\347\224\250\344\276\213-\346\236\227\346\264\213\344\273\225.md" +++ "b/documents/\346\226\207\346\234\254\346\265\213\350\257\225\347\224\250\344\276\213-\346\236\227\346\264\213\344\273\225.md" @@ -2,4 +2,4 @@ | ------- | ----------------------- | -------- | -------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ---------- | ---- | | lua-lunit | oe_test_lunit_1 | 单元测试 | 功能测试 | lua脚本的单元测试工具包 ,这里验证lunit命令的参数用法 | 1 | 安装二进制包lua-lunit: dnf install -y lua-lunit| lua-lunit命令的用法:
1、-h,-h--help:显示lunit的帮助信息 执行命令:lunit --help 2>&1 \| grep "Usage: lunit"或者 ntfscat -h 2>&1 \| grep "Usage: lunit"
2、-v,--version:显示lunit的版本信息 执行命令:ntfscat --version 2>&1 \| grep "lunit" 或者 ntfscat -V 2>&1 \| grep "lunit"
3、-p,--path,设定lua的位置 执行命令:lunit -p /usr/bin/lunit 或者 lunit -path /usr/bin/lunit
4、-i --interpreter 设置lunit解释器 lunit -i /usr/bin/lua 或者 lunit --interpreter /usr/bin/lua
5、-r,--runner 设置lunit的执行模式 执行命令:lunit -r lunit 或者 lunit -runner lunit
6、-t,--test 使用lunit测试lua文件 执行命令 lunit -t test.lua 或者 lunit --test test.lua
7、--loadonly 只读取测试文件 执行命令:lunit --loadonly test.lua
8、--cpath 指定lunit的cpath 执行命令 lunit --cpath /usr/bin/lunit
9、--dontforce 不强制加载/usr/bin/lunit*.lua. 执行命令: lunit --dontforce test.lua
10、无参数,执行lua测试脚本 执行命令:lunit test.lua| 1、输出lunit的帮助信息
2、输出lunit的版本信息
3、命令执行成功
4、命令执行成功
5、命令执行成功
6、显示测试结果
7、显示结果
8、命令执行成功
9、显示结果
10、显示结果| 是 | | | itstool | oe_test_itstool_1 | 单元测试 | 功能测试 | itstool提取xml中的its规则,这里验证itstool命令的参数用法 | 1 | 安装二进制包itstool: dnf install -y "itstool gettext|itstool命令用法:
1、-h,--help:显示itstool的帮助信息 执行命令:itstool --help \| grep "Usage"或者 itstool -h\| grep "Usage"
2、-v,--version:显示版本信息 执行命令:itstool -v \| grep "itstool" \| grep "itstool" 或者 itstool --version \| grep "itstool"
3、-d,--load-dtd:使用外部dtd解析xml 执行命令:从github下载官方测试xml命名为dtd.xml,执行itstool -d dtd.xml 或者 itstool --load-dtd dtd.xml
4、-i --its:使用外部its规则解析xml 执行命令:从github下载官方测试xml elementwithintextlocalitsSpanXml.xml,执行 itstool -i elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml或 itstool --its=elementwithintextlocalitsSpanXml.xml elementwithintextlocalitsSpanXml.xml
5、-j --join:将二进制文件加入xml中,执行 itstool -j join.xml join.cs.mo > test.xml && cat test.xml
6、-k --keep-entities:保持实体引用解析xml 执行命令:从github下载官方测试xml keep-entities.xml 执行 itstool -k keep-entities.xml 或者 itstool --keep-entities keep-entities.xml
7、-l --lang:显性设置语言标签 执行命令:itstool -l 'll' -m join.cs.mo -o test Translate1.xml
8、-m --merge:将二进制文件与xml结合提取its 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml -o && cat test \| grep its 或者 itstool -n -lang='ll' -m test.mo Translate1.xml -o test && cat test \| grep its
9、-n,--nobuitins 不使用内置的its规则 执行命令:itstool -n -l 'll' -m test.mo Translate1.xml -o test && cat test \| grep rules 或者 itstool --no-builtins -l 'll' -m test.mo Translate1.xml -o test && cat test \| grep rules
10、-o,--output 将itstool命令的结果输出到指定文件 执行命令:itstool -o test Translate1.xml | cat test 或者 itstool --output test Translate1.xml | cat test|1、输出itstool的帮助信息
2、输出itstool的版本信息
3、输出使用外部dtd后的xml解析信息
4、输出使用外部its解析后的xml信息
5、输出加入二进制规则后的xml
6、输出xml,不引用实体
7、显性设定输出的语言标签
8、输出its规则
9、不使用内置its规则,而是使用二进制文件中的its规则输出its
10、输出文件,文件内容是xml提取出的its规则|是 | | - |itstool|oe_test_itstool_2|单元测试|功能测试|itstool提取xml中的its规则,这里验证itstool命令的参数用法|1|安装二进制包itstool: dnf install -y "itstool gettext|1、-p,--param 将ITS参数名重新设置 执行命令:itstool -p msgid id Translate1.xml 或itstool --param=msgid id Translate1.xml\| grep id
2、--path 可以找到its的额外路径 itstool --path=IT-externalRef1.txt IT-externalRef1.xml \|grep ref
3、-s,--strict 当PO文件包含损坏的XML时,显示错误 执行命令:itstool -s broken.xml 或 itstool --strict broken.xml
4、-t,--test 生成测试一致性输出 执行命令:itstool -t translate Translate1.xml 或 itstool --test=translate Translate.xml
5、无参数 提取xml文件中包含的its规则 执行命令:itstool Translate.xml| 1、输出设定的带特定参数名的its
2、输出带引用的its规则
3、输出错误
4、输出测试结果
5、输出its规则|是|| \ No newline at end of file + |itstool|oe_test_itstool_2|单元测试|功能测试|itstool提取xml中的its规则,这里验证itstool命令的参数用法|1|安装二进制包itstool: dnf install -y "itstool gettext|1、-p,--param 将ITS参数名重新设置 执行命令:itstool -p msgid id Translate1.xml|grep id 或itstool --param=msgid id Translate1.xml\| grep id
2、--path 可以找到its的额外路径 itstool --path=IT-externalRef1.txt IT-externalRef1.xml \|grep ref
3、-s,--strict 当PO文件包含损坏的XML时,显示错误 执行命令:itstool -s broken.xml 或 itstool --strict broken.xml
4、-t,--test 生成测试一致性输出 执行命令:itstool -t translate Translate1.xml 或 itstool --test=translate Translate.xml
5、无参数 提取xml文件中包含的its规则 执行命令:itstool Translate.xml| 1、输出设定的带特定参数名的its
2、输出带引用的its规则
3、输出错误
4、输出测试结果
5、输出its规则|是|| \ No newline at end of file diff --git a/testcases/itstool/oe_test_itstool_2.sh b/testcases/itstool/oe_test_itstool_2.sh new file mode 100644 index 00000000..4265c063 --- /dev/null +++ b/testcases/itstool/oe_test_itstool_2.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash + +# Copyright (c) 2021. Huawei Technologies Co.,Ltd.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 detaitest -f. + +# ############################################# +# @Author : linyangshi +# @Contact : 1042036289@qq.com +# @Date : 2022/08/01 +# @License : Mulan PSL v2 +# @Desc : Test itstool function:--help,--version, +# ############################################# + +source "../common/common_lib.sh" +function pre_test() { + LOG_INFO "Start environmental preparation." + DNF_INSTALL "itstool" + cd common + LOG_INFO "End of environmental preparation!" +} + +function run_test() { + LOG_INFO "Start testing..." + itstool -p msgid id Translate1.xml|grep id && itstool -param=msgid id Translate1.xml|grep id + CHECK_RESULT $? 0 0 "itstool -p or --param failed" + itstool --path=IT-externalRef1.txt IT-externalRef1.xml |grep ref + CHECK_RESULT $? 0 0 "itstool --path failed" + itstool -s broken.xml && itstool --strict broken.xml + CHECK_RESULT $? 1 0 "itstool --strct or -s failed" + itstool -t translate Translate1.xml && itstool --test=translate Translate1.xml + CHECK_RESULT $? 0 0 "itstool -t or --test failed" + itstool Translate1.xml + CHECK_RESULT $? 0 0 "itstool failed to extract the its" + LOG_INFO "Finish test!" +} + +function post_test() { + LOG_INFO "start environment cleanup." + LOG_INFO "Finish environment cleanup!" +} + +main "$@" -- Gitee From 71080f5d11398b7913bba18b63e1bbf5880f6003 Mon Sep 17 00:00:00 2001 From: linyangshi Date: Tue, 2 Aug 2022 11:31:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0suit2case=20itstool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suite2cases/itstool.json | 3 +++ testcases/.DS_Store | Bin 6148 -> 6148 bytes 2 files changed, 3 insertions(+) diff --git a/suite2cases/itstool.json b/suite2cases/itstool.json index 57c62668..4e32ac81 100644 --- a/suite2cases/itstool.json +++ b/suite2cases/itstool.json @@ -3,6 +3,9 @@ "cases": [ { "name": "oe_test_itstool_1" + }, + { + "name": "oe_test_itstool_2" } ] } diff --git a/testcases/.DS_Store b/testcases/.DS_Store index db7ded529785c1c7464a2951cb8aa64a8ab17b08..3fbe14d8179400383ff2207769a1124718b6e0db 100644 GIT binary patch delta 20 bcmZoMXffE(#msJGV4