diff --git a/README_zh.md b/README_zh.md index aac0d301a262117da9d8e2a579f8489dddda63a2..90fdc1c5f92764e84066dba6405d82de6d5c5937 100755 --- a/README_zh.md +++ b/README_zh.md @@ -878,6 +878,16 @@ reports/platform_log_xxxx_xx_xx_xx_xx_xx.log reports/latest ``` +##### 安装 +1. 安装测试框架 +./install.sh + +2. 更新环境变量 +source ~/.bashrc + +3. 启用测试框架 +ohtest + ### 涉及仓 [test\_xdevice](https://gitee.com/openharmony/test_xdevice/blob/master/README_zh.md) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..490d515275117966c2cb91e0be37115025223e54 --- /dev/null +++ b/install.sh @@ -0,0 +1,28 @@ +#! /bin/bash +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +sudo cp ohtest /usr/bin/ + +if cat ~/.bashrc | grep "DEVTESTDIR" > /dev/null +then + echo "DEVTESTDIR exist" +fi + +sed -i "/DEVTESTDIR/d" ~/.bashrc + +testdir=$(cd $(dirname $0);pwd) +testparam="export DEVTESTDIR="$testdir +echo $testparam >> ~/.bashrc \ No newline at end of file diff --git a/ohtest b/ohtest new file mode 100755 index 0000000000000000000000000000000000000000..a1b32fcb569a7990392573d32a488738aa6b46b8 --- /dev/null +++ b/ohtest @@ -0,0 +1,32 @@ +#!/usr/bin/python +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys + +print(os.getcwd()) + +if "DEVTESTDIR" in os.environ: + homedir = os.environ["DEVTESTDIR"] + os.chdir(homedir) + print(os.getcwd()) + cmd = "./start.sh" + for index in range (1, len(sys.argv)): + cmd += " " + sys.argv[index] + print(cmd) + os.system(cmd) +else: + print("no DEVTESTDIR!!") \ No newline at end of file diff --git a/src/core/command/display.py b/src/core/command/display.py index 8ce6bcc09439cfdb5ba5b2f61bdcbd0efedc37ee..aa74b4b08510b7fdc16494f971ad0dc629f6ef4d 100755 --- a/src/core/command/display.py +++ b/src/core/command/display.py @@ -104,8 +104,8 @@ usage: run [-p PRODUCTFORM] [-tc TESTCASE] [-tl TESTLEVEL] [-repeat NUMBER] - [-thl] - [-thr HISCOMMAND-INDEX] + [-hl] + [-rh HISCOMMAND-INDEX] [-retry] optional arguments: @@ -122,10 +122,10 @@ optional arguments: -tc TESTCASE, --testcase TESTCASE Specify test case -tl TESTLEVEL, --testlevel TESTLEVEL - -repeat NUMBER, --repeat NUMBER + --repeat NUMBER -hl, --hisotrylist -rh INDEX, --runhistory INDEX - -retry + --retry Examples: run -t UT @@ -137,14 +137,14 @@ Examples: AAFwkBaseTest.* run -t UT -ss aafwk -tm base_test -ts base_test -tc \ AAFwkBaseTest.object_test_001 - run -t UT -ss aafwk -tm base_test -repeat 3 + run -t UT -ss aafwk -tm base_test --repeat 3 run -t MST ... run -t ALL ... run -hl run -rh 1 - run -retry + run --retry run -t ACTS -ss arkui,ability -ts ActsAceEtsTest;ActsAceEtsStTest;ActsApiTest """ diff --git a/src/core/command/run.py b/src/core/command/run.py index 2aafa04d781b3cbbcfb056ac6c567d08e26cbfab..bc078c2207a116ca0c00ebececb3534ddd4cade9 100755 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -100,7 +100,8 @@ class Run(object): "command": command, "options": options } - if not ("-thl" in options.current_raw_cmd or "-thr" in options.current_raw_cmd): + if not ("-hl" in options.current_raw_cmd or "-rh" in options.current_raw_cmd \ + or "--retry" in options.current_raw_cmd): need_record_history = True #打印历史记录