From fcabc15cf060efa7799823cbf3963c915bca6acd Mon Sep 17 00:00:00 2001 From: suhangself Date: Tue, 26 Oct 2021 14:30:06 +0800 Subject: [PATCH] add rust&optipng cases --- suite2cases/optipng.json | 11 ++ suite2cases/rust.json | 23 ++++ testcases/cli-test/optipng/common/ini.png | Bin 0 -> 6797 bytes .../oe_test_optipng_01/oe_test_optipng_01.sh | 102 +++++++++++++++ .../oe_test_optipng_02/oe_test_optipng_02.sh | 86 +++++++++++++ testcases/cli-test/rust/common/hello.rs | 5 + testcases/cli-test/rust/common/lib.rs | 1 + testcases/cli-test/rust/common/main.rs | 4 + testcases/cli-test/rust/common/myhello.rs | 3 + testcases/cli-test/rust/common/pub.rs | 3 + testcases/cli-test/rust/common/test.rs | 3 + testcases/cli-test/rust/common/war.rs | 3 + .../rust/oe_test_cargo_01/oe_test_cargo_01.sh | 61 +++++++++ .../rust/oe_test_cargo_02/oe_test_cargo_02.sh | 71 +++++++++++ .../rust/oe_test_clippy/oe_test_clippy.sh | 51 ++++++++ .../cli-test/rust/oe_test_rls/oe_test_rls.sh | 43 +++++++ .../rust/oe_test_rust-gdb/oe_test_rust-gdb.sh | 44 +++++++ .../oe_test_rust-lldb/oe_test_rust-lldb.sh | 44 +++++++ .../rust/oe_test_rustc_01/oe_test_rustc_01.sh | 118 ++++++++++++++++++ .../rust/oe_test_rustc_02/oe_test_rustc_02.sh | 98 +++++++++++++++ .../rust/oe_test_rustc_03/oe_test_rustc_03.sh | 79 ++++++++++++ .../rust/oe_test_rustdoc/oe_test_rustdoc.sh | 94 ++++++++++++++ .../rust/oe_test_rustfmt/oe_test_rustfmt.sh | 49 ++++++++ 23 files changed, 996 insertions(+) create mode 100644 suite2cases/optipng.json create mode 100644 suite2cases/rust.json create mode 100644 testcases/cli-test/optipng/common/ini.png create mode 100644 testcases/cli-test/optipng/oe_test_optipng_01/oe_test_optipng_01.sh create mode 100644 testcases/cli-test/optipng/oe_test_optipng_02/oe_test_optipng_02.sh create mode 100644 testcases/cli-test/rust/common/hello.rs create mode 100644 testcases/cli-test/rust/common/lib.rs create mode 100644 testcases/cli-test/rust/common/main.rs create mode 100644 testcases/cli-test/rust/common/myhello.rs create mode 100644 testcases/cli-test/rust/common/pub.rs create mode 100644 testcases/cli-test/rust/common/test.rs create mode 100644 testcases/cli-test/rust/common/war.rs create mode 100644 testcases/cli-test/rust/oe_test_cargo_01/oe_test_cargo_01.sh create mode 100644 testcases/cli-test/rust/oe_test_cargo_02/oe_test_cargo_02.sh create mode 100644 testcases/cli-test/rust/oe_test_clippy/oe_test_clippy.sh create mode 100644 testcases/cli-test/rust/oe_test_rls/oe_test_rls.sh create mode 100644 testcases/cli-test/rust/oe_test_rust-gdb/oe_test_rust-gdb.sh create mode 100644 testcases/cli-test/rust/oe_test_rust-lldb/oe_test_rust-lldb.sh create mode 100644 testcases/cli-test/rust/oe_test_rustc_01/oe_test_rustc_01.sh create mode 100644 testcases/cli-test/rust/oe_test_rustc_02/oe_test_rustc_02.sh create mode 100644 testcases/cli-test/rust/oe_test_rustc_03/oe_test_rustc_03.sh create mode 100644 testcases/cli-test/rust/oe_test_rustdoc/oe_test_rustdoc.sh create mode 100644 testcases/cli-test/rust/oe_test_rustfmt/oe_test_rustfmt.sh diff --git a/suite2cases/optipng.json b/suite2cases/optipng.json new file mode 100644 index 000000000..ef099bc11 --- /dev/null +++ b/suite2cases/optipng.json @@ -0,0 +1,11 @@ +{ + "path": "$OET_PATH/testcases/cli-test/optipng", + "cases": [ + { + "name": "oe_test_optipng_01" + }, + { + "name": "oe_test_optipng_02" + } + ] +} \ No newline at end of file diff --git a/suite2cases/rust.json b/suite2cases/rust.json new file mode 100644 index 000000000..27f5555d1 --- /dev/null +++ b/suite2cases/rust.json @@ -0,0 +1,23 @@ +{ + "path": "$OET_PATH/testcases/cli-test/rust", + "cases": [ + { + "name": "oe_test_rustc_01" + }, + { + "name": "oe_test_rustc_02" + }, + { + "name": "oe_test_rustc_03" + }, + { + "name": "oe_test_rustdoc" + }, + { + "name": "oe_test_cargo_01" + }, + { + "name": "oe_test_cargo_02" + } + ] +} diff --git a/testcases/cli-test/optipng/common/ini.png b/testcases/cli-test/optipng/common/ini.png new file mode 100644 index 0000000000000000000000000000000000000000..9575b7d9ba9a7da62dbf26802747eb70dec5c433 GIT binary patch literal 6797 zcma)BWmFW8yIw%)4nY5?w#2I)pZxTI{*oa_oOW$~%JL`gGZV3Kz~S25rZ z#gEq00O_Ve;cU7!&CUzlC7nGVT0fxxvI`I%NT<{AD4P z-iR@BmsU-XR*N3g9Khod#usLKsldeAyY*@-;yYbr7HLXh5{0EZ<-Z7(eLxG8u>2oV z{{vLLR3sWS{XdW~U*6#3GJTTc{4a`uZcMwRHe_TDQb|ekq~t*u^oEa`ee%f(>vW48 z(}uZes18Y|Sg|TuNFo-762rX-nr!8!3NsAiY9A*Uc}d@dQjfKAP0medDp~X z4f~R`D*~6^N1H){r<}aqx58>rwx(y-NAEB$*Gq7sZdR(Bpbp2Kt~G*mLFOyN@8eUoe1;@HX}nRfZbASE|)A3N@e z<#?Ln5AS0;f^sGI-Bnw%>P6>|oO2s)UN30Fxwa|@v2hO11)D%-bd!{L3cpVs1hSI3 zIM~z2xl(JtHA~UZ2B{X?^}tAdO?Wk1?b>V2vu2L$bUCv-0$T=eD?Dsk4sC`oqd>~K z2RcNg;pJf1>*Rhs;oI1jAu4SSz5QO+AhuM&gTsr`!=Y~Dp`PHhlhq>Jzh1A50wWd@8&^=rD-(?JVc03^Z!6|N3B zEwzz)m*lWbK>Lih7i?kv-RmJno zsyM7}p}4Wpo3&R6^+pp>?VRsDQT!#BwMp`Zk{D#HM4S5eov?hIH*OkQjKTHl6~bO+ zQ%sv)d^VsN8=vgmwL0d-1U7#T2GS7DLv@_GSz9XYk1t1rtjvVr!mJh(|Vr^m@|NUaEb+Txmc2qc-1 zT?{qvPHLJWeC0Z|x>C_zr$Q95Ft3_lvHdRM=!Hv{(0-W%GMdsQB>Nbja9=N52J#Si zSi;{vUA0q$#5s&#nP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Ii^4yI-6jWKbNky<14~MjjP2S}P${5O} z@H}*w%vPo}V8uqG2hr8cSDZ9l@q=5U?@{+gL1UY5T$6@kHzKL+mNWO9Xz2QE2)IlT ziofB8;2oU_3d>x2v6kyNTPeT7_IA}fR7QT{Wh4-yn%wLuI@ccMlF>pG(3AFFM~{-L z{!Uv~h!|m#=joq{i6vxE9K|ofiw9Ucj)aclbOSFz^b!bSn#>DO?lW9bj(g3gw_(zs zg7f)3Qq7wf6Z0mf(tHb!{bj$foBZ{eJ#ZE0@0i3@n$+CuG-uy1>fo+*%q?4bY+#E|x8pG}<-*v%9sv*Vs+l8`d&?fzO% zRZplmObP$xpgox;`9yd4tNM0~n#NojLYY@1VHQtt!&&Wp!zReNjWEk6?fCr-!{@odO9j@cb2ft*1 z0&8=iAocQd9PEd&QS9&`+s(V|101lf87^}AN->9-)B@>d5%j}I1qb+&nCpr50Logc z(yd=wPNYI&zN-5JNGxQ5Zbp?~xR-|C_pACv7#|GJ$`qzJcurR_; zdsRPDpiX+a{OQ|WJ=Rx{N#E42ktvLvf5i8wvCE)h$@hZdVJ7M)SMcxcw(K&|iItGE zEWY0Q=zyyiJN7vc^+&`{o_J-QFPecKmL8g$^uLE-8}Q95*c^OmJGi1-KX{7V7@V5t zxc__ZrxvOG0^hG&V*vGHX^?6=OAEX1yxMy@?wIMV}4@fdb|zg$Y|6T>kI&Wx_LhKhXD!@3vIAO$r|xNUBYw~zhGv$wNf zJo;m)Ra2Gw6!*OY9fLy0Qj{6d_hkv+_J(E(_C7N{4Dk;Nb*%OZpADEdHj9GYh(zFu z71;KDj(Hb>?vDZln4Rb~5jNMxaIERT+l~`7b4|Wlog 2>&1 + CHECK_RESULT $? + grep "warning" Wlog + CHECK_RESULT $? 0 0 "Failed to set Linter option Warn" + rustc lib.rs --crate-type=lib -A missing-docs -o hello_A + CHECK_RESULT $? + ls |grep "hello_A" + CHECK_RESULT $? 0 0 "Failed to set Linter option Allow" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "start environment cleanup." + rm -rf $(ls | grep -v ".sh") + DNF_REMOVE + LOG_INFO "Finish environment cleanup!" +} + +main $@ \ No newline at end of file diff --git a/testcases/cli-test/rust/oe_test_rustc_03/oe_test_rustc_03.sh b/testcases/cli-test/rust/oe_test_rustc_03/oe_test_rustc_03.sh new file mode 100644 index 000000000..99f9a1ce0 --- /dev/null +++ b/testcases/cli-test/rust/oe_test_rustc_03/oe_test_rustc_03.sh @@ -0,0 +1,79 @@ +#!/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 details. + +# ############################################## +# @Author : suhang +# @Contact : suhangself@163.com +# @Date : 2021-09-22 +# @License : Mulan PSL v2 +# @Desc : Rust language tools rustc +# ############################################## + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment!" + DNF_INSTALL rust + cp ../common/lib.rs lib.rs + cp ../common/war.rs war.rs + cp ../common/hello.rs hello.rs + cp ../common/myhello.rs myhello.rs + cp ../common/main.rs main.rs + LOG_INFO "End to prepare the test environment!" +} + +function run_test() { + LOG_INFO "Start to run test." + rustc lib.rs --crate-type=lib -D missing-docs >Dlog 2>&1 + CHECK_RESULT $? 1 + grep "error" Dlog + CHECK_RESULT $? 0 0 "Failed to set Linter option Deny" + rustc lib.rs --crate-type=lib -F missing-docs >Flog 2>&1 + CHECK_RESULT $? 1 + grep "error" Flog + CHECK_RESULT $? 0 0 "Failed to set Linter option Forbit" + rustc war.rs --cap-lints warn >caplog 2>&1 + CHECK_RESULT $? + grep "warning" caplog + CHECK_RESULT $? 0 0 "Failed to set Linter level warning" + rustc -C opt-level=2 hello.rs -o hello_C + CHECK_RESULT $? + ls |grep "hello_C" + CHECK_RESULT $? 0 0 "Failed to output the hello_C file" + rustc -V |grep "rustc" + CHECK_RESULT $? 0 0 "Failed to output the version information" + rustc -v hello.rs -o hello_v + CHECK_RESULT $? + ls |grep "hello_v" + CHECK_RESULT $? 0 0 "Failed to output the hello_v file" + rustc -C help |grep "Available codegen options" + CHECK_RESULT $? + rustc -W help |grep "Available lint options" + CHECK_RESULT $? + rustc --crate-type staticlib myhello.rs + CHECK_RESULT $? + rustc --crate-type rlib myhello.rs + CHECK_RESULT $? + rustc -L. -l myhello main.rs + CHECK_RESULT $? + ./main |grep "Hello World!" + CHECK_RESULT $? 0 0 "Link library failed" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "start environment cleanup." + rm -rf $(ls | grep -v ".sh") + DNF_REMOVE + LOG_INFO "Finish environment cleanup!" +} + +main $@ \ No newline at end of file diff --git a/testcases/cli-test/rust/oe_test_rustdoc/oe_test_rustdoc.sh b/testcases/cli-test/rust/oe_test_rustdoc/oe_test_rustdoc.sh new file mode 100644 index 000000000..0b91f0f34 --- /dev/null +++ b/testcases/cli-test/rust/oe_test_rustdoc/oe_test_rustdoc.sh @@ -0,0 +1,94 @@ +#!/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 details. + +# ############################################## +# @Author : suhang +# @Contact : suhangself@163.com +# @Date : 2021-10-18 +# @License : Mulan PSL v2 +# @Desc : Rust language tools rustdoc +# ############################################## + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment!" + DNF_INSTALL rust + cp ../common/hello.rs hello.rs + cp ../common/test.rs test.rs + cp ../common/lib.rs lib.rs + cp ../common/war.rs war.rs + LOG_INFO "End to prepare the test environment!" +} + +function run_test() { + LOG_INFO "Start to run test." + rustdoc -h |grep -i "Options" + CHECK_RESULT $? 0 0 "Help information printing failed" + rustdoc -V |grep "rustdoc" + CHECK_RESULT $? 0 0 "Failed to output the version information" + rustdoc -v -V |grep -iE "binary|release|version" + CHECK_RESULT $? + rustdoc test.rs -o doc --crate-name mycrate + CHECK_RESULT $? + ls | grep "doc" + CHECK_RESULT $? + ls doc |grep "mycrate" + CHECK_RESULT $? 0 0 "Failed to specify the output path" + rustdoc test.rs -L doc/ + CHECK_RESULT $? + rustdoc hello.rs --cfg hello + ls doc |grep "hello" + CHECK_RESULT $? 0 0 "Failed to pass configuration parameters" + rustdoc test.rs --extern doc/ + CHECK_RESULT $? + rustdoc test.rs -C target_feature=+avx + CHECK_RESULT $? + rustdoc --document-private-items test.rs + CHECK_RESULT $? + rustdoc test.rs --test |grep -E "running|tests" + CHECK_RESULT $? 0 0 "Failed to run the test code" + rustdoc test.rs --html-in-header doc/hello/all.html + CHECK_RESULT $? + rustdoc test.rs --html-after-content doc/hello/all.html + CHECK_RESULT $? + rustdoc test.rs --html-after-content doc/hello/all.html + CHECK_RESULT $? + rustdoc test.rs --markdown-no-toc + CHECK_RESULT $? + rustdoc test.rs -e doc/dark.css + CHECK_RESULT $? + rustdoc lib.rs --crate-type=lib -W missing-docs >Wlog 2>&1 + grep "warning" Wlog + CHECK_RESULT $? 0 0 "Failed to set Linter option Warn" + rustdoc lib.rs --crate-type=lib -A missing-docs -o hello_A + ls |grep "hello_A" + CHECK_RESULT $? 0 0 "Failed to set Linter option Allow" + rustdoc lib.rs --crate-type=lib -D missing-docs >Dlog 2>&1 + grep "error" Dlog + CHECK_RESULT $? 0 0 "Failed to set Linter option Deny" + rustdoc lib.rs --crate-type=lib -F missing-docs >Flog 2>&1 + grep "error" Flog + CHECK_RESULT $? 0 0 "Failed to set Linter option Forbit" + rustdoc war.rs --cap-lints warn + CHECK_RESULT $? 0 0 "Failed to set Linter level warning" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "start environment cleanup." + rm -rf $(ls | grep -v ".sh") + DNF_REMOVE + LOG_INFO "Finish environment cleanup!" +} + +main $@ + diff --git a/testcases/cli-test/rust/oe_test_rustfmt/oe_test_rustfmt.sh b/testcases/cli-test/rust/oe_test_rustfmt/oe_test_rustfmt.sh new file mode 100644 index 000000000..5bd40aa15 --- /dev/null +++ b/testcases/cli-test/rust/oe_test_rustfmt/oe_test_rustfmt.sh @@ -0,0 +1,49 @@ +#!/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 details. + +# ############################################## +# @Author : suhang +# @Contact : suhangself@163.com +# @Date : 2021-10-19 +# @License : Mulan PSL v2 +# @Desc : Rust language tools rustfmt +# ############################################## + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment!" + DNF_INSTALL rustfmt + LOG_INFO "End to prepare the test environment!" +} + +function run_test() { + LOG_INFO "Start executing testcase!" + cargo-fmt -h | grep "USAGE" + CHECK_RESULT $? 0 0 "cargo-fmt Help information printing failed" + cargo-fmt --version |grep "rustfmt" + CHECK_RESULT $? 0 0 "Failed to output the version information of cargo-fmt" + cargo-fmt -v |grep "rustfmt" + CHECK_RESULT $? 0 0 "Failed to list details" + rustfmt -V |grep "rustfmt" + CHECK_RESULT $? 0 0 "Failed to output the version information of rustfmt" + rustfmt -h |grep "usage" + CHECK_RESULT $? 0 0 "rustfmt Help information printing failed" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "start environment cleanup." + DNF_REMOVE + LOG_INFO "Finish environment cleanup!" +} + +main $@