From 124100f957ebd0f27e2161ab252475542516b650 Mon Sep 17 00:00:00 2001 From: wangshi Date: Thu, 8 Sep 2022 15:43:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1=EF=BC=8C=E4=BF=AE=E6=94=B9retry=E4=B8=8D?= =?UTF-8?q?=E8=AE=A1=E5=85=A5history,=202,=20=E4=BF=AE=E6=94=B9=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=9A=84=E9=81=97=E6=BC=8F,=203,=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangshi --- README_zh.md | 10 ++++++++++ install.sh | 14 ++++++++++++++ ohtest | 17 +++++++++++++++++ src/core/command/display.py | 12 ++++++------ src/core/command/run.py | 3 ++- 5 files changed, 49 insertions(+), 7 deletions(-) create mode 100755 install.sh create mode 100755 ohtest diff --git a/README_zh.md b/README_zh.md index aac0d30..90fdc1c 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 0000000..6470acd --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +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 0000000..027bd14 --- /dev/null +++ b/ohtest @@ -0,0 +1,17 @@ +#!/usr/bin/python +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 8ce6bcc..aa74b4b 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 2aafa04..bc078c2 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 #打印历史记录 -- Gitee From 6e2f776bca9479e0f1ca0763c1e8f71e58347814 Mon Sep 17 00:00:00 2001 From: wangshi Date: Thu, 8 Sep 2022 16:20:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangshi --- install.sh | 14 ++++++++++++++ ohtest | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/install.sh b/install.sh index 6470acd..c725980 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,18 @@ #! /bin/bash +# +# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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/ diff --git a/ohtest b/ohtest index 027bd14..93e1bc6 100755 --- a/ohtest +++ b/ohtest @@ -1,4 +1,19 @@ #!/usr/bin/python +# +# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 -- Gitee From 04aede5109f7a19002925e08553a3af4cb92db71 Mon Sep 17 00:00:00 2001 From: wangshi Date: Fri, 9 Sep 2022 14:31:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangshi --- install.sh | 2 +- ohtest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index c725980..490d515 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #! /bin/bash # -# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. +# 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 diff --git a/ohtest b/ohtest index 93e1bc6..a1b32fc 100755 --- a/ohtest +++ b/ohtest @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. +# 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 -- Gitee