提交 c2c469f6 编写于 作者: M mamingshuai

update openharmony 1.0.1

上级 9d2c8093
### 该问题是怎么引起的?
### 重现步骤
### 报错信息
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)
*.pyc
/extension/
\ No newline at end of file
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite_lite.gni") import("//test/xts/tools/lite/build/suite_lite.gni")
deploy_suite("xdevice"){ deploy_suite("xdevice") {
suite_name = "acts" suite_name = "acts,hits,ssts"
}
}
文件模式从 100755 更改为 100644
# XDevice<a name="EN-US_TOPIC_0000001083129731"></a>
- [Introduction](#section15701932113019)
- [Directory Structure](#section1791423143211)
- [Constraints](#section118067583303)
- [Usage](#section2036431583)
- [Repositories Involved](#section260848241)
## Introduction<a name="section15701932113019"></a>
XDevice, a core module of the OpenHarmony test framework, provides services on which test case execution depends.
XDevice consists of the following sub-modules:
- **command**: enables command-based interactions between users and the test platform. It parses and processes user commands.
- **config**: sets test framework configurations and provides different configuration options for the serial port connection and USB connection modes.
- **driver**: functions as a test case executor, which defines main test steps, such as test case distribution, execution, and result collection.
- **report**: parses test results and generates test reports.
- **scheduler**: schedules various test case executors in the test framework.
- **environment**: configures the test framework environment, enabling device discovery and device management.
- **testkit**: provides test tools to implement JSON parsing, network file mounting, etc.
- **resource**: provides the device connection configuration file and report template definitions.
- **adapter**: adapts the test framework to open-source software.
## Directory Structure<a name="section1791423143211"></a>
```
xdevice
├── config # XDevice configuration
│ ├── user_config.xml # XDevice environment configuration
├── resource # XDevice resources
│ ├── tools # Burning tools
├── src # Source code
│ ├── xdevice
├── extension # XDevice extension
│ ├── src # Source code of the extension
│ └── setup.py # Installation script of the extension
```
## Constraints<a name="section118067583303"></a>
The environment requirements for using this module are as follows:
- Python version: 3.7.5 or later
- pySerial version: 3.3 or later
- Paramiko version: 2.7.1 or later
- RSA version: 4.0 or later
## Usage<a name="section2036431583"></a>
- **Installing XDevice**
1. Go to the installation directory of XDevice.
2. Open the console window and run the following command:
```
python setup.py install
```
- **Installing the extension**
1. Go to the installation directory of the XDevice extension.
2. Open the console and run the following command:
```
python setup.py install
```
- **Modifying the user\_config.xml file**
Configure information about your environment in the **user\_config.xml** file.
**1. Configure the environment.**
- For devices that support hdc connection, refer to the following note to configure the environment.
>![](figures/icon-note.gif) **NOTE:**
>**ip/port**: IP address and port of a remote device. By default, the parameter is left blank, indicating that the local device \(IP address: 127.0.0.1; port: the one used for hdc startup\) is used as the test device.
>**sn**: SN of the test devices specified for command execution. If this parameter is set to **SN1**, only device SN1 can execute the subsequent **run** commands. In this case, other devices are set as **Ignored** and not involved in the command execution. You can run the **list devices** command and check the value of **Allocation** to view the **sn** values. You can set multiple SNs and separate each two of them with a semicolon \(;\).
- For devices that support serial port connection, refer to the following note to configure the environment.
>![](figures/icon-note.gif) **NOTE:**
>**type**: device connection mode. The **com** mode indicates that the device is connected through the serial port.
>**label**: device type, for example, **wifiiot**
>**serial**: serial port
>- **serial/com**: serial port for local connection, for example, **COM20**
>- **serial/type**: serial port type. The value can be **cmd** \(serial port for test case execution\) or **deploy** \(serial port for system upgrade\).
> For the open-source project, the **cmd** and **deploy** serial ports are the same, and their **com** values are the same too.
>**serial/baud\_rate, data\_bits, stop\_bits** and **timeout**: serial port parameters. You can use the default values.
**2. Set the test case directory.**
**dir**: test case directory
**3. Mount the NFS.**
>![](figures/icon-note.gif) **NOTE:**
>**server**: NFS mounting configuration. Set the value to **NfsServer**.
>**server/ip**: IP address of the mounting environment
>**server/port**: port number of the mounting environment
>**server/username**: user name for logging in to the server
>**server/password**: password for logging in to the server
>**server/dir**: external mount path
>**server/remote**: whether the NFS server and the XDevice executor are deployed on different devices. If yes, set this parameter to **true**. Otherwise, set it to **false**.
- **Specify the task type.**
- **Start the test framework.**
- **Execute test commands.**
Test framework commands can be classified into three groups: **help**, **list**, and **run**. Among them, **run** commands are most commonly used in the instruction sequence.
**help**
Queries help information about test framework commands.
```
help:
Use help to get information.
usage:
run: Display a list of supported run commands.
list: Display a list of supported devices and task records.
Examples:
help run
help list
```
>![](figures/icon-note.gif) **NOTE:**
>**help run**: displays the description of **run** commands.
>**help list**: displays the description of **list** commands.
**list**
Displays device information and related task information.
```
list:
Display device list and task records.
usage:
list
list history
list <id>
Introduction:
list: Display the device list.
list history: Display historical records of a series of tasks.
list <id>: Display historical records of tasks with the specified IDs.
Examples:
list
list history
list 6e****90
```
>![](figures/icon-note.gif) **NOTE:**
>**list**: displays device information.
>**list history**: displays historical task information.
>**list <id\>**: displays historical information about tasks with specified IDs.
**run**
Executes test tasks.
```
run:
Execute the selected test cases.
The command execution process includes use case compilation, execution, and result collection.
usage: run [-l TESTLIST [TESTLIST ...] | -tf TESTFILE
[TESTFILE ...]] [-tc TESTCASE] [-c CONFIG] [-sn DEVICE_SN]
[-rp REPORT_PATH [REPORT_PATH ...]]
[-respath RESOURCE_PATH [RESOURCE_PATH ...]]
[-tcpath TESTCASES_PATH [TESTCASES_PATH ...]]
[-ta TESTARGS [TESTARGS ...]] [-pt]
[-env TEST_ENVIRONMENT [TEST_ENVIRONMENT ...]]
[-e EXECTYPE] [-t [TESTTYPE [TESTTYPE ...]]]
[-td TESTDRIVER] [-tl TESTLEVEL] [-bv BUILD_VARIANT]
[-cov COVERAGE] [--retry RETRY] [--session SESSION]
[--dryrun] [--reboot-per-module] [--check-device]
[--repeat REPEAT]
action task
Specify tests to run.
positional arguments:
action Specify the action to do.
task Specify the task name, such as ssts, acts, and hits.
```
>![](figures/icon-note.gif) **NOTE:**
>The structure of a basic **run** command is as follows:
>```
>run [task name] -l module1;moudle2
>```
>**task name**: task type. This parameter is optional. Generally, the value is **ssts**, **acts**, or **hits**.
>**-l**: test cases to execute. Use semicolons \(;\) to separate each two test cases.
>**module**: module to test. Generally, there is a **.json** file of the module in the **testcases** directory.
>In addition, other parameters can be attached to this command as constraints. Common parameters are as follows:
>**-sn**: specifies the devices for test case execution. If this parameter is set to **SN1**, only device SN1 executes the test cases.
>**-c**: specifies a new **user\_config.xml** file.
>**-rp**: indicates the path where the report is generated. The default directory is **xxx/xdevice/reports**. Priority of a specified directory is higher than that of the default one.
>**-tcpath**: indicates the environment directory, which is **xxx/xdevice/testcases** by default. Priority of a specified directory is higher than that of the default one.
>**-respath**: indicates the test suite directory, which is **xxx/xdevice/resource** by default. Priority of a specified directory is higher than that of the default one.
>**--reboot-per-module**: restarts the device before test case execution.
- **View the execution result.**
After executing the **run** commands, the test framework displays the corresponding logs on the console, and generates the execution report in the directory specified by the **-rp** parameter. If the parameter is not set, the report will be generated in the default directory.
```
Structure of the report directory (the default or the specified one)
├── result # Test case execution results of the module
│ ├── module name.xml
│ ├── ...
├── log # Running logs of devices and tasks
│ ├── device 1.log
│ ├── ...
│ ├── task.log
├── summary_report.html # Visual report
├── summary_report.html # Statistical report
└── ...
```
## Repositories Involved<a name="section260848241"></a>
test\_xdevice
test\_xdevice\_extension
# xdevice组件<a name="ZH-CN_TOPIC_0000001083129731"></a>
- [简介](#section15701932113019)
- [目录](#section1791423143211)
- [约束](#section118067583303)
- [使用](#section2036431583)
- [相关仓](#section260848241)
## 简介<a name="section15701932113019"></a>
xdevice是OpenHarmony中为测试框架的核心组件,提供用例执行所依赖的相关服务。
xdevice主要包括以下几个主要模块:
- command,用户与测试平台命令行交互模块,提供用户输入命令解析,命令处理。
- config,测试框架配置模块,提供测试平台串口连接方式和USB连接方式的不同配置选项。
- driver,测试用例执行器,提供测试用例分发,执行,结果收集等主要测试步骤定义。
- report,测试报告模块,提供测试结果解析和测试报告生成。
- scheduler,测试框架调度模块,提供不同类型的测试执行器调度的调度功能。
- environment,测试框架的环境配置模块,提供设备发现,设备管理的功能。
- testkit,测试框架工具模块,提供json解析,网络文件挂载等操作。
- resource,测试框架资源模块,提供设备连接配置文件和报告模板定义。
- adapter,测试框架适配开源软件的模块。
## 目录<a name="section1791423143211"></a>
```
xdevice
├── config # xdevice组件配置
│ ├── user_config.xml # xdevice环境配置
├── resource # xdevice组件资源
│ ├── tools # 版本烧录工具
├── src # 组件源码目录
│ ├── xdevice
├── extension # xdevice扩展模块
│ ├── src # 扩展模块源码
│ └── setup.py # xdevice扩展模块安装脚本
```
## 约束<a name="section118067583303"></a>
运行环境要求:
- python版本\>=3.7.5
- pyserial\>=3.3
- paramiko\>=2.7.1
- rsa\>=4.0
## 使用<a name="section2036431583"></a>
- **安装xdevice**
1. 打开xdevice安装目录。
2. 打开控制台,执行如下命令:
```
python setup.py install
```
- **安装extension**
1. 打开extension安装目录。
2. 打开控制台,执行如下命令:
```
python setup.py install
```
- **修改user\_config.xml**
user\_config.xml是框架提供的用户配置文件,用户可以根据自身环境信息配置相关内容,具体介绍如下:
**1、environment环境相关配置:**
- 设备类型一
>![](figures/icon-note.gif) **说明:**
>ip/port: 表示远程设备地址,默认情况为空,表示使用本地设备,ip地址为127.0.0.1,port为本机hdc启动端口号;
>​sn: 过滤执行测试设备,若设置为SN1,则表示只有设备SN1能够支持后续run命令执行,其他设备分配状态设置为Ignored,不参与命令执行,可通过list devices命令中Allocation字段来查看sn设置,可配置多个sn,中间以;隔开;
- 设备类型二
>![](figures/icon-note.gif) **说明:**
>type: 设备连接方式,com表示连接方式是串口
>label: 表示设备种类,如wifiiot
>serial: 表示一个串口定义
>serial/com 表示本地连接的串口,如COM20 serial/type 表示串口类型,cmd是命令串口,deploy是刷机串口,社区版本cmd和deploy使用同一个串口,com值相同
>serial/baud\_rate、data\_bits、stop\_bits、timeout: 为串口波特率等串口参数 ,一般采用默认值即可。
**2、测试用例目录设置**
dir: 指定测试用例目录。
**3、nfs挂载**
>![](figures/icon-note.gif) **说明:**
>server: nfs挂载配置,label取值为NfsServer。
>server/ip: 挂载环境IP地址。
>server/port: 挂载环境端口。
>server/username: 登录用户名。
>server/password: 登录用户密码。
>server/dir: 对应挂载的外部路径。
>server/remote: nfs服务器与xDevice执行机不在同一台机器时,remote配置为true,否则为false。
- **选定任务类型**
- **启动框架**
- **执行指令**
框架指令可以分为三组:help、list、run。在指令序列中,以run为最常用的执行指令。
**1、help**
输入help指令可以查询框架指令帮助信息。
```
help:
use help to get information.
usage:
run: Display a list of supported run command.
list: Display a list of supported device and task record.
Examples:
help run
help list
```
>![](figures/icon-note.gif) **说明:**
>help run:展示run指令相关说明
>help list:展示 list指令相关说明
**2、list**
list指令用来展示设备和相关的任务信息
```
list:
This command is used to display device list and task record.
usage:
list
list history
list <id>
Introduction:
list: display device list
list history: display history record of a serial of tasks
list <id>: display history record about task what contains specific id
Examples:
list
list history
list 6e****90
```
>![](figures/icon-note.gif) **说明:**
>list: 展示设备信息
>list history: 展示任务历史信息
>list <id\>: 展示特定id的任务其历史信息
**3、run**
run指令主要用于执行测试任务
```
run:
This command is used to execute the selected testcases.
It includes a series of processes such as use case compilation, execution, and result collection.
usage: run [-l TESTLIST [TESTLIST ...] | -tf TESTFILE
[TESTFILE ...]] [-tc TESTCASE] [-c CONFIG] [-sn DEVICE_SN]
[-rp REPORT_PATH [REPORT_PATH ...]]
[-respath RESOURCE_PATH [RESOURCE_PATH ...]]
[-tcpath TESTCASES_PATH [TESTCASES_PATH ...]]
[-ta TESTARGS [TESTARGS ...]] [-pt]
[-env TEST_ENVIRONMENT [TEST_ENVIRONMENT ...]]
[-e EXECTYPE] [-t [TESTTYPE [TESTTYPE ...]]]
[-td TESTDRIVER] [-tl TESTLEVEL] [-bv BUILD_VARIANT]
[-cov COVERAGE] [--retry RETRY] [--session SESSION]
[--dryrun] [--reboot-per-module] [--check-device]
[--repeat REPEAT]
action task
Specify tests to run.
positional arguments:
action Specify action
task Specify task name,such as "ssts", "acts", "hits"
```
>![](figures/icon-note.gif) **说明:**
>一个基本的run指令结构如下:
>```
>run [task name] -l module1;moudle2
>```
>task name:任务类型。一般为ssts、acts、hits。非必选项
>-l :指定执行测试用例,多个测试用例,中间用;隔开
>module:被测试的模块。一般在testcases目录下存在对应的\\.json文件
>此外,其他参数可以作为约束条件,附加到这个基本指令之上使用。常用的如:
>-sn: 过滤执行测试设备,若设置为SN1,则表示只有设备SN1执行用例
>-c: 重新指定user\_config.xml。
>-rp: 报告生成路径。默认为xxx/xdevice/reports目录。指定目录后,优先级:指定目录\>xxx/xdevice/reports目录。
>-tcpath:环境目录,默认为xxx/xdevice/testcases目录。指定目录后,优先级:指定目录\>xxx/xdevice/testcases目录
>-respath:测试套目录,默认为xxx/xdevice/resource目录。指定目录后,优先级:指定目录\>xxx/xdevice/resource目录
>--reboot-per-module: 执行前先重启设备
- **查看执行结果**
框架执行run指令,控制台会输出对应的log打印,还会生成对应的执行结果报告。如果使用了-rp参数指定报告路径,那么报告就会生成在指定的路径下。否则报告会存放在默认目录。
```
当前报告目录(默认目录/指定目录)
├── result(模块执行结果存放目录)
│ ├── <模块名>.xml
│ ├── ... ...
├── log (设备和任务运行log存放目录)
│ ├── <设备1>.log
│ ├── ... ...
│ ├── <任务>.log
├── summary_report.html(测试任务可视化报告)
├── summary_report.html(测试任务数据化报告)
└── ... ...
```
## 相关仓<a name="section260848241"></a>
test\_xdevice
test\_xdevice\_extension
Copyright (c) 2021 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.
***************************************************************
Copyright (C) 2011 The Android Open Source Project
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
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.
\ No newline at end of file
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2021 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.
#
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2013 The Android Open Source Project
# 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.
#
from dataclasses import dataclass
__all__ = ["UsbConst", "AppConst"]
@dataclass
class UsbConst:
connector = "adb"
connector_type = "usb-adb"
push = "adb push"
pull = "adb pull"
shell = "adb shell"
server_port = "ANDROID_ADB_SERVER_PORT"
kill_server = "adb kill-server"
start_server = "adb start-server"
reboot = "adb reboot"
@dataclass
class AppConst:
entry_app = "Entry.apk"
app_ext = ".apk"
app_name = "APK"
wifi_app = "xDeviceService-wifi.apk"
{ {
"description": "Config for acts test suites", "description": "Config for acts test suites",
"kits": [ "kits": [
{ {
"type": "QueryKit", "type": "QueryKit",
"server": "NfsServer", "server": "NfsServer",
"mount": [ "mount": [
{ {
"source": "resource/tools/query.bin", "source": "resource/tools/query.bin",
"target": "/test_root/tools" "target": "/test_root/tools"
} }
], ],
"query" : "/test_root/tools/query.bin" "query" : "/test_root/tools/query.bin"
} },
] {
} "type": "RootFsKit",
"command": "./bin/checksum /bin",
"hash_file_name": "checksum.hash",
"device_label": "ipcamera"
}
]
}
{
"description": "Config for hits test suites",
"kits": [
{
"type": "QueryKit",
"server": "NfsServer",
"mount": [
{
"source": "resource/tools/query.bin",
"target": "/test_root/tools"
}
],
"query" : "/test_root/tools/query.bin"
}
]
}
{
"description": "Runs a STS plan from a pre-existing STS installation",
"kits": [
{
"type": "QueryKit",
"server": "NfsServer",
"mount": [
{
"source": "resource/tools/query.bin",
"target": "/test_root/tools"
}
],
"query" : "/test_root/tools/query.bin",
"properties": {
"version": "",
"spt": ""
}
}
]
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2020 Huawei Device Co., Ltd. <!-- Copyright (c) 2020 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<user_config> <user_config>
<environment> <environment>
<support_device> <device type="com"
<device_lite>true</device_lite> label="wifiiot">
</support_device> <serial>
<device type="com" label="wifiiot"> <com></com>
<serial> <type>cmd</type>
<com></com> <baud_rate>115200</baud_rate>
<type>cmd</type> <data_bits>8</data_bits>
<baund_rate>115200</baund_rate> <stop_bits>1</stop_bits>
<data_bits>8</data_bits> <timeout>20</timeout>
<stop_bits>1</stop_bits> </serial>
<timeout>20</timeout> <serial>
</serial> <com></com>
<serial> <type>deploy</type>
<com></com> <baud_rate>115200</baud_rate>
<type>deploy</type> </serial>
<baund_rate>115200</baund_rate> </device>
</serial> <device type="com"
</device> label="ipcamera">
<device type="com" label="ipcamera"> <serial>
<serial> <com></com>
<com></com> <type>cmd</type>
<type>cmd</type> <baud_rate>115200</baud_rate>
<baund_rate>115200</baund_rate> <data_bits>8</data_bits>
<data_bits>8</data_bits> <stop_bits>1</stop_bits>
<stop_bits>1</stop_bits> <timeout>1</timeout>
<timeout>1</timeout> </serial>
</serial> </device>
</device> <device type="com"
<device type="com" label="ipcamera"> label="ipcamera">
<ip></ip> <ip></ip>
<port></port> <port></port>
</device> </device>
</environment> </environment>
<testcases> <testcases>
<dir></dir> <dir></dir>
<server label="NfsServer"> <server label="NfsServer">
<ip></ip> <ip></ip>
<port></port> <port></port>
<dir></dir> <dir></dir>
<username></username> <username></username>
<password></password> <password></password>
<remote></remote> <remote></remote>
</server> </server>
</testcases> </testcases>
<resource> <resource>
<dir></dir> <dir></dir>
</resource> </resource>
</user_config> <loglevel>INFO</loglevel>
\ No newline at end of file </user_config>
# 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("//test/xts/tools/lite/build/suite_lite.gni")
deploy_suite("xdevice") {
suite_name = "acts"
}
详见:https://gitee.com/openharmony/docs/blob/master/readme/测试子系统README.md
see: https://gitee.com/openharmony/docs/blob/master/docs-en/readme/testing-subsystem.md
@rem Copyright (c) 2020-2021 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@echo off @echo off
set BASE_DIR=%~dp0 set BASE_DIR=%~dp0
set PYTHON=python set PYTHON=python
...@@ -6,12 +19,14 @@ cd /d %BASE_DIR% ...@@ -6,12 +19,14 @@ cd /d %BASE_DIR%
(where %PYTHON% | findstr %PYTHON%) >nul 2>&1 || ( (where %PYTHON% | findstr %PYTHON%) >nul 2>&1 || (
@echo "Python3.7 or higher version required!" @echo "Python3.7 or higher version required!"
pause
goto:eof goto:eof
) )
python -c "import sys; exit(1) if sys.version_info.major < 3 or sys.version_info.minor < 7 else exit(0)" python -c "import sys; exit(1) if sys.version_info.major < 3 or sys.version_info.minor < 7 else exit(0)"
@if errorlevel 1 ( @if errorlevel 1 (
@echo "Python3.7 or higher version required!" @echo "Python3.7 or higher version required!"
pause
goto:eof goto:eof
) )
...@@ -32,4 +47,10 @@ for %%a in (%TOOLS%/*.egg) do ( ...@@ -32,4 +47,10 @@ for %%a in (%TOOLS%/*.egg) do (
@echo "Error occurs to install %%a!" @echo "Error occurs to install %%a!"
) )
) )
for %%a in (%TOOLS%/*.tar.gz) do (
python -m easy_install --user %TOOLS%/%%a
@if errorlevel 1 (
@echo "Error occurs to install %%a!"
)
)
python -m xdevice %* python -m xdevice %*
#!/usr/bin/env sh #!/usr/bin/env sh
# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved. #
# Copyright (c) 2020-2021 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.
#
error() error()
{ {
...@@ -31,4 +44,12 @@ do ...@@ -31,4 +44,12 @@ do
$PYTHON -m easy_install --user "$f" || echo "Error occurs to install $f!" $PYTHON -m easy_install --user "$f" || echo "Error occurs to install $f!"
done done
for f in "$TOOLS"/*.tar.gz
do
if [ ! -e "$f" ]; then
error "Can not find xdevice package!"
fi
$PYTHON -m easy_install --user "$f" || echo "Error occurs to install $f!"
done
$PYTHON -m xdevice "$@" $PYTHON -m xdevice "$@"
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
from setuptools import setup from setuptools import setup
INSTALL_REQUIRES = []
def main(): def main():
setup(name='xdevice', setup(name='xdevice',
description='xdevice test framework', description='xdevice test framework',
url='', url='',
package_dir={'': 'src'}, package_dir={'': 'src', 'adapter': 'adapter'},
packages=['xdevice', packages=['xdevice',
'xdevice._core', 'xdevice._core',
'xdevice._core.build', 'xdevice._core.build',
...@@ -33,7 +35,8 @@ def main(): ...@@ -33,7 +35,8 @@ def main():
'xdevice._core.environment', 'xdevice._core.environment',
'xdevice._core.executor', 'xdevice._core.executor',
'xdevice._core.report', 'xdevice._core.report',
'xdevice._core.testkit' 'xdevice._core.testkit',
'adapter.xdevice_adapter',
], ],
package_data={ package_data={
'xdevice._core': [ 'xdevice._core': [
...@@ -49,6 +52,7 @@ def main(): ...@@ -49,6 +52,7 @@ def main():
] ]
}, },
zip_safe=False, zip_safe=False,
install_requires=INSTALL_REQUIRES,
) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -30,6 +30,7 @@ from _core.interface import LifeCycle ...@@ -30,6 +30,7 @@ from _core.interface import LifeCycle
from _core.interface import IShellReceiver from _core.interface import IShellReceiver
from _core.interface import ITestKit from _core.interface import ITestKit
from _core.interface import IListener from _core.interface import IListener
from _core.interface import IReporter
from _core.exception import ParamError from _core.exception import ParamError
from _core.exception import DeviceError from _core.exception import DeviceError
from _core.exception import LiteDeviceError from _core.exception import LiteDeviceError
...@@ -40,7 +41,9 @@ from _core.constants import DeviceLabelType ...@@ -40,7 +41,9 @@ from _core.constants import DeviceLabelType
from _core.constants import ManagerType from _core.constants import ManagerType
from _core.constants import DeviceOsType from _core.constants import DeviceOsType
from _core.constants import ProductForm from _core.constants import ProductForm
from _core.constants import TestType
from _core.constants import CKit from _core.constants import CKit
from _core.constants import ConfigConst
from _core.config.config_manager import UserConfigManager from _core.config.config_manager import UserConfigManager
from _core.config.resource_manager import ResourceManager from _core.config.resource_manager import ResourceManager
from _core.executor.listener import CaseResult from _core.executor.listener import CaseResult
...@@ -57,11 +60,17 @@ from _core.utils import get_device_log_file ...@@ -57,11 +60,17 @@ from _core.utils import get_device_log_file
from _core.utils import get_kit_instances from _core.utils import get_kit_instances
from _core.utils import get_config_value from _core.utils import get_config_value
from _core.utils import exec_cmd from _core.utils import exec_cmd
from _core.utils import check_device_name
from _core.utils import do_module_kit_setup
from _core.utils import do_module_kit_teardown
from _core.environment.manager_env import DeviceSelectionOption from _core.environment.manager_env import DeviceSelectionOption
from _core.environment.manager_env import EnvironmentManager from _core.environment.manager_env import EnvironmentManager
from _core.executor.scheduler import Scheduler from _core.executor.scheduler import Scheduler
from _core.report.suite_reporter import SuiteReporter from _core.report.suite_reporter import SuiteReporter
from _core.report.suite_reporter import ResultCode from _core.report.suite_reporter import ResultCode
from _core.report.reporter_helper import ExecInfo
from _core.report.result_reporter import ResultReporter
from _core.report.__main__ import main_report
from _core.command.console import Console from _core.command.console import Console
__all__ = [ __all__ = [
...@@ -78,6 +87,7 @@ __all__ = [ ...@@ -78,6 +87,7 @@ __all__ = [
"IShellReceiver", "IShellReceiver",
"ITestKit", "ITestKit",
"IListener", "IListener",
"IReporter",
"ParamError", "ParamError",
"DeviceError", "DeviceError",
"LiteDeviceError", "LiteDeviceError",
...@@ -88,7 +98,9 @@ __all__ = [ ...@@ -88,7 +98,9 @@ __all__ = [
"ManagerType", "ManagerType",
"DeviceOsType", "DeviceOsType",
"ProductForm", "ProductForm",
"TestType",
"CKit", "CKit",
"ConfigConst",
"UserConfigManager", "UserConfigManager",
"ResourceManager", "ResourceManager",
"CaseResult", "CaseResult",
...@@ -109,13 +121,20 @@ __all__ = [ ...@@ -109,13 +121,20 @@ __all__ = [
"get_device_log_file", "get_device_log_file",
"get_kit_instances", "get_kit_instances",
"get_config_value", "get_config_value",
"exec_cmd" "exec_cmd",
"check_device_name",
"do_module_kit_setup",
"do_module_kit_teardown",
"ExecInfo",
"ResultReporter",
"main_report"
] ]
def _load_external_plugins(): def _load_external_plugins():
plugins = [Plugin.SCHEDULER, Plugin.DRIVER, Plugin.DEVICE, Plugin.LOG, plugins = [Plugin.SCHEDULER, Plugin.DRIVER, Plugin.DEVICE, Plugin.LOG,
Plugin.PARSER, Plugin.LISTENER, Plugin.TEST_KIT, Plugin.MANAGER] Plugin.PARSER, Plugin.LISTENER, Plugin.TEST_KIT, Plugin.MANAGER,
Plugin.REPORTER]
for plugin_group in plugins: for plugin_group in plugins:
for entry_point in pkg_resources.iter_entry_points(group=plugin_group): for entry_point in pkg_resources.iter_entry_points(group=plugin_group):
entry_point.load() entry_point.load()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -22,6 +22,9 @@ from dataclasses import dataclass ...@@ -22,6 +22,9 @@ from dataclasses import dataclass
from _core.exception import ParamError from _core.exception import ParamError
from _core.logger import platform_logger from _core.logger import platform_logger
from _core.utils import get_local_ip
from xdevice_adapter.constants import UsbConst
__all__ = ["UserConfigManager"] __all__ = ["UserConfigManager"]
LOG = platform_logger("ConfigManager") LOG = platform_logger("ConfigManager")
...@@ -35,37 +38,42 @@ class ConfigFileConst(object): ...@@ -35,37 +38,42 @@ class ConfigFileConst(object):
class UserConfigManager(object): class UserConfigManager(object):
def __init__(self, config_file="", env=""): def __init__(self, config_file="", env=""):
from xdevice import Variables from xdevice import Variables
if config_file:
pass
try: try:
if env: if env:
self.config_content = ET.fromstring(env) self.config_content = ET.fromstring(env)
else: else:
user_path = os.path.join(Variables.exec_dir, "config") if config_file:
top_user_path = os.path.join(Variables.top_dir, "config") self.file_path = config_file
config_path = os.path.join(Variables.res_dir, "config") else:
paths = [user_path, top_user_path, config_path] user_path = os.path.join(Variables.exec_dir, "config")
top_user_path = os.path.join(Variables.top_dir, "config")
for path in paths: config_path = os.path.join(Variables.res_dir, "config")
if os.path.exists(os.path.abspath(os.path.join( paths = [user_path, top_user_path, config_path]
path, ConfigFileConst.userconfig_filepath))):
self.file_path = os.path.abspath(os.path.join( for path in paths:
path, ConfigFileConst.userconfig_filepath)) if os.path.exists(os.path.abspath(os.path.join(
break path, ConfigFileConst.userconfig_filepath))):
self.file_path = os.path.abspath(os.path.join(
path, ConfigFileConst.userconfig_filepath))
break
LOG.debug("user config path: %s" % self.file_path)
if os.path.exists(self.file_path): if os.path.exists(self.file_path):
tree = ET.parse(self.file_path) tree = ET.parse(self.file_path)
self.config_content = tree.getroot() self.config_content = tree.getroot()
else: else:
raise ParamError("config file not found") raise ParamError("%s not found" % self.file_path,
error_no="00115")
except SyntaxError as error: except SyntaxError as error:
if env: if env:
raise ParamError( raise ParamError(
"Parse environment parameter fail! Error: %s" % error.args) "Parse environment parameter fail! Error: %s" % error.args,
error_no="00115")
else: else:
raise ParamError( raise ParamError(
"Parse %s fail! Error: %s" % (self.file_path, error.args)) "Parse %s fail! Error: %s" % (self.file_path, error.args),
error_no="00115")
def get_user_config_list(self, tag_name): def get_user_config_list(self, tag_name):
data_dic = {} data_dic = {}
...@@ -94,18 +102,10 @@ class UserConfigManager(object): ...@@ -94,18 +102,10 @@ class UserConfigManager(object):
return [] return []
return config_list return config_list
def get_sn_list(self): def get_sn_list(self, input_string):
sn_select_list = [] sn_select_list = []
data_dic = {} if input_string:
for node in self.config_content.findall("environment/device"): sn_select_list = self._handle_str(input_string)
if node.attrib["type"] != "usb-hdc":
continue
for sub in node:
data_dic[sub.tag] = sub.text if sub.text else ""
sn_config = data_dic.get("sn", "")
if sn_config:
sn_select_list = self._handle_str(sn_config)
break
return sn_select_list return sn_select_list
def get_remote_config(self): def get_remote_config(self):
...@@ -114,17 +114,18 @@ class UserConfigManager(object): ...@@ -114,17 +114,18 @@ class UserConfigManager(object):
if "ip" in data_dic.keys() and "port" in data_dic.keys(): if "ip" in data_dic.keys() and "port" in data_dic.keys():
remote_ip = data_dic.get("ip", "") remote_ip = data_dic.get("ip", "")
remote_adb_port = data_dic.get("port", "") remote_port = data_dic.get("port", "")
else: else:
remote_ip = "" remote_ip = ""
remote_adb_port = "" remote_port = ""
if (not remote_ip) or (not remote_adb_port): if (not remote_ip) or (not remote_port):
remote_ip = "" remote_ip = ""
remote_adb_port = "" remote_port = ""
if remote_ip == get_local_ip():
remote_ip = "127.0.0.1"
remote_dic["ip"] = remote_ip remote_dic["ip"] = remote_ip
remote_dic["port"] = remote_adb_port remote_dic["port"] = remote_port
return remote_dic return remote_dic
def get_testcases_dir_config(self): def get_testcases_dir_config(self):
...@@ -161,7 +162,7 @@ class UserConfigManager(object): ...@@ -161,7 +162,7 @@ class UserConfigManager(object):
devices = [] devices = []
for node in self.config_content.findall(target_name): for node in self.config_content.findall(target_name):
if node.attrib["type"] != "com": if node.attrib["type"] != "com" and node.attrib["type"] != "agent":
continue continue
device = [node.attrib] device = [node.attrib]
...@@ -172,6 +173,8 @@ class UserConfigManager(object): ...@@ -172,6 +173,8 @@ class UserConfigManager(object):
if sub.text is not None and sub.tag != "serial": if sub.text is not None and sub.tag != "serial":
data_dic[sub.tag] = sub.text data_dic[sub.tag] = sub.text
if data_dic: if data_dic:
if data_dic.get("ip", "") == get_local_ip():
data_dic["ip"] = "127.0.0.1"
device.append(data_dic) device.append(data_dic)
devices.append(device) devices.append(device)
continue continue
...@@ -189,18 +192,21 @@ class UserConfigManager(object): ...@@ -189,18 +192,21 @@ class UserConfigManager(object):
return devices return devices
def get_device(self, target_name): def get_device(self, target_name):
data_dic = {}
for node in self.config_content.findall(target_name): for node in self.config_content.findall(target_name):
if node.attrib["type"] != "usb-hdc": data_dic = {}
if node.attrib["type"] != "usb-hdc" and \
node.attrib["type"] != UsbConst.connector_type:
continue continue
data_dic["usb_type"] = node.attrib["type"]
for sub in node: for sub in node:
if sub.text is None: if sub.text is None:
data_dic[sub.tag] = "" data_dic[sub.tag] = ""
else: else:
data_dic[sub.tag] = sub.text data_dic[sub.tag] = sub.text
break if data_dic.get("ip", "") == get_local_ip():
return data_dic data_dic["ip"] = "127.0.0.1"
return data_dic
return None
def get_testcases_dir(self): def get_testcases_dir(self):
from xdevice import Variables from xdevice import Variables
...@@ -226,3 +232,15 @@ class UserConfigManager(object): ...@@ -226,3 +232,15 @@ class UserConfigManager(object):
return os.path.abspath( return os.path.abspath(
os.path.join(Variables.exec_dir, "resource")) os.path.join(Variables.exec_dir, "resource"))
def get_log_level(self):
data_dic = {}
node = self.config_content.find("loglevel")
if node is not None:
if node.find("console") is None and node.find("file") is None:
# neither loglevel/console nor loglevel/file exists
data_dic.update({"console": str(node.text).strip()})
else:
for child in node:
data_dic.update({child.tag: str(child.text).strip()})
return data_dic
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -110,9 +110,7 @@ class ResourceManager(object): ...@@ -110,9 +110,7 @@ class ResourceManager(object):
src = os.path.join(resource_dir, push_value[0:pos].strip()) src = os.path.join(resource_dir, push_value[0:pos].strip())
dst = push_value[pos + len(find_key):len(push_value)].strip() dst = push_value[pos + len(find_key):len(push_value)].strip()
LOG.info("create_dir: dst = %s" % (dst))
device.execute_shell_command("mkdir -p %s" % dst) device.execute_shell_command("mkdir -p %s" % dst)
LOG.info("push_file: src = %s, dst = %s" % (src, dst))
device.push_file(src, dst) device.push_file(src, dst)
elif item["name"] == "pull": elif item["name"] == "pull":
push_value = item["value"] push_value = item["value"]
...@@ -122,16 +120,13 @@ class ResourceManager(object): ...@@ -122,16 +120,13 @@ class ResourceManager(object):
src = os.path.join(resource_dir, push_value[0:pos].strip()) src = os.path.join(resource_dir, push_value[0:pos].strip())
dst = push_value[pos + len(find_key):len(push_value)].strip() dst = push_value[pos + len(find_key):len(push_value)].strip()
LOG.info("pull_file: src = %s, dst = %s" % (src, dst))
device.pull_file(src, dst) device.pull_file(src, dst)
elif item["name"] == "shell": elif item["name"] == "shell":
command = item["value"].strip() command = item["value"].strip()
LOG.info("shell = %s", command)
device.execute_shell_command(command) device.execute_shell_command(command)
else: else:
command = "".join((item["name"], " ", item["value"])) command = "".join((item["name"], " ", item["value"]))
command = command.strip() command = command.strip()
LOG.info("others = %s", command)
device.execute_command(command) device.execute_command(command)
@staticmethod @staticmethod
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -22,7 +22,8 @@ __all__ = ["DeviceOsType", "ProductForm", "TestType", "TestExecType", ...@@ -22,7 +22,8 @@ __all__ = ["DeviceOsType", "ProductForm", "TestType", "TestExecType",
"DeviceTestType", "HostTestType", "HostDrivenTestType", "DeviceTestType", "HostTestType", "HostDrivenTestType",
"SchedulerType", "ListenerType", "ToolCommandType", "SchedulerType", "ListenerType", "ToolCommandType",
"TEST_DRIVER_SET", "LogType", "ParserType", "CKit", "ComType", "TEST_DRIVER_SET", "LogType", "ParserType", "CKit", "ComType",
"DeviceLabelType", "DeviceLiteKernel", "GTestConst", "ManagerType"] "DeviceLabelType", "DeviceLiteKernel", "GTestConst", "ManagerType",
"ModeType", "ConfigConst"]
@dataclass @dataclass
...@@ -40,9 +41,10 @@ class ProductForm(object): ...@@ -40,9 +41,10 @@ class ProductForm(object):
ProductForm enumeration ProductForm enumeration
""" """
phone = "phone" phone = "phone"
car = "car" car = "ivi"
television = "tv" television = "tv"
watch = "watch" watch = "watch"
tablet = 'tablet'
@dataclass @dataclass
...@@ -57,6 +59,7 @@ class TestType(object): ...@@ -57,6 +59,7 @@ class TestType(object):
sec = "security" sec = "security"
reli = "reliability" reli = "reliability"
dst = "distributedtest" dst = "distributedtest"
benchmark = "benchmark"
all = "ALL" all = "ALL"
...@@ -76,8 +79,9 @@ class DeviceLabelType(object): ...@@ -76,8 +79,9 @@ class DeviceLabelType(object):
""" """
wifiiot = "wifiiot" wifiiot = "wifiiot"
ipcamera = "ipcamera" ipcamera = "ipcamera"
watch = "watch" watch_gt = "watchGT"
phone = "phone" phone = "phone"
watch = "watch"
@dataclass @dataclass
...@@ -124,10 +128,12 @@ class DeviceTestType(object): ...@@ -124,10 +128,12 @@ class DeviceTestType(object):
hap_test = "HapTest" hap_test = "HapTest"
junit_test = "JUnitTest" junit_test = "JUnitTest"
jsunit_test = "JSUnitTest" jsunit_test = "JSUnitTest"
jsunit_test_lite = "JSUnitTestLite"
ctest_lite = "CTestLite" ctest_lite = "CTestLite"
cpp_test_lite = "CppTestLite" cpp_test_lite = "CppTestLite"
lite_cpp_test = "LiteUnitTest" lite_cpp_test = "LiteUnitTest"
open_source_test = "OpenSourceTest" open_source_test = "OpenSourceTest"
build_only_test = "BuildOnlyTestLite"
@dataclass @dataclass
...@@ -190,6 +196,8 @@ class ParserType: ...@@ -190,6 +196,8 @@ class ParserType:
cpp_test_lite = "CppTestLite" cpp_test_lite = "CppTestLite"
cpp_test_list_lite = "CppTestListLite" cpp_test_list_lite = "CppTestListLite"
open_source_test = "OpenSourceTest" open_source_test = "OpenSourceTest"
build_only_test = "BuildOnlyTestLite"
jsuit_test_lite = "JSUnitTestLite"
@dataclass @dataclass
...@@ -210,7 +218,7 @@ class ToolCommandType(object): ...@@ -210,7 +218,7 @@ class ToolCommandType(object):
@dataclass @dataclass
class CKit: class CKit:
push = "PushKit" push = "PushKit"
install = "ApkInstallKit" liteinstall = "LiteAppInstallKit"
command = "CommandKit" command = "CommandKit"
config = "ConfigKit" config = "ConfigKit"
wifi = "WIFIKit" wifi = "WIFIKit"
...@@ -222,9 +230,55 @@ class CKit: ...@@ -222,9 +230,55 @@ class CKit:
liteuikit = 'LiteUiKit' liteuikit = 'LiteUiKit'
rootfs = "RootFsKit" rootfs = "RootFsKit"
query = "QueryKit" query = "QueryKit"
liteshell = "LiteShellKit"
app_install = "AppInstallKit"
@dataclass @dataclass
class GTestConst(object): class GTestConst(object):
exec_para_filter = "--gtest_filter" exec_para_filter = "--gtest_filter"
exec_para_level = "--gtest_testsize" exec_para_level = "--gtest_testsize"
@dataclass
class ModeType(object):
decc = "decc"
factory = "factory"
developer = "developer"
@dataclass
class ConfigConst(object):
action = "action"
task = "task"
testlist = "testlist"
testfile = "testfile"
testcase = "testcase"
device_sn = "device_sn"
report_path = "report_path"
resource_path = "resource_path"
testcases_path = "testcases_path"
testargs = "testargs"
pass_through = "pass_through"
test_environment = "test_environment"
exectype = "exectype"
testtype = "testtype"
testdriver = "testdriver"
retry = "retry"
session = "session"
dry_run = "dry_run"
reboot_per_module = "reboot_per_module"
check_device = "check_device"
configfile = "config"
repeat = "repeat"
# Runtime Constant
history_report_path = "history_report_path"
product_info = "product_info"
task_state = "task_state"
recover_state = "recover_state"
need_kit_setup = "need_kit_setup"
task_kits = "task_kits"
module_kits = "module_kits"
spt = "spt"
version = "version"
文件模式从 100755 更改为 100644
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -21,9 +21,12 @@ import os ...@@ -21,9 +21,12 @@ import os
import sys import sys
from _core.constants import HostDrivenTestType from _core.constants import HostDrivenTestType
from _core.constants import TestExecType
from _core.constants import ModeType
from _core.constants import DeviceLabelType from _core.constants import DeviceLabelType
from _core.driver.drivers_lite import init_remote_server from _core.driver.drivers_lite import init_remote_server
from _core.exception import DeviceError from _core.exception import DeviceError
from _core.exception import LiteDeviceError
from _core.exception import ParamError from _core.exception import ParamError
from _core.exception import ReportException from _core.exception import ReportException
from _core.exception import ExecuteTerminate from _core.exception import ExecuteTerminate
...@@ -32,64 +35,18 @@ from _core.logger import platform_logger ...@@ -32,64 +35,18 @@ from _core.logger import platform_logger
from _core.plugin import Plugin from _core.plugin import Plugin
from _core.testkit.json_parser import JsonParser from _core.testkit.json_parser import JsonParser
from _core.utils import get_config_value from _core.utils import get_config_value
from _core.utils import do_module_kit_setup
from _core.utils import do_module_kit_teardown
from _core.utils import get_filename_extension
from _core.utils import get_file_absolute_path
from _core.utils import get_kit_instances from _core.utils import get_kit_instances
from _core.utils import check_result_report from _core.utils import check_result_report
from _core.utils import check_mode
from _core.report.suite_reporter import SuiteReporter from _core.report.suite_reporter import SuiteReporter
LOG = platform_logger("DeviceTest") LOG = platform_logger("DeviceTest")
PY_SUFFIX = ".py"
PYD_SUFFIX = ".pyd"
def start_task(test_file, configs, device, logger):
from xdevice import Variables
# insert& devicetest path for loading devicetest module
devicetest_module = os.path.join(Variables.modules_dir, "_devicetest")
if os.path.exists(devicetest_module):
sys.path.insert(1, devicetest_module)
if configs["testcases_path"]:
sys.path.insert(1, configs["testcases_path"])
from _devicetest.devicetest.main import DeviceTest
device_test = DeviceTest(test_list=test_file, configs=configs,
devices=[device], log=logger)
device_test.run()
def set_up_env(request, source):
if not source.endswith(".json"):
source = "%s.json" % source
json_config = JsonParser(source)
test_args = get_config_value('xml-output', json_config.get_driver())
kits = get_kit_instances(json_config, request.config.resource_path,
request.config.testcases_path)
kits_copy = copy.deepcopy(kits)
from xdevice import Scheduler
for kit in kits:
if not Scheduler.is_execute:
raise ExecuteTerminate()
kit.__setup__(request.config.device, request=request)
return test_args, kits, kits_copy
def get_file_list(module_path):
file_list = []
if not file_list:
for test_file in os.listdir(module_path):
if test_file.endswith(".py") or test_file.endswith(".pyd"):
file_list.append(os.path.join(
module_path, test_file))
return file_list
else:
filter_file_list = []
for test_file in file_list:
if (test_file.endswith(".pyd") or test_file.endswith(".py")) and \
os.path.exists(os.path.join(module_path, test_file)):
filter_file_list.append(os.path.join(
module_path, test_file))
return filter_file_list
@Plugin(type=Plugin.DRIVER, id=HostDrivenTestType.device_test) @Plugin(type=Plugin.DRIVER, id=HostDrivenTestType.device_test)
...@@ -111,125 +68,197 @@ class DeviceTestDriver(IDriver): ...@@ -111,125 +68,197 @@ class DeviceTestDriver(IDriver):
pass pass
def __check_config__(self, config=None): def __check_config__(self, config=None):
del config pass
self.py_file = ""
def __init_nfs_server__(self, request=None): def __init_nfs_server__(self, request=None):
return init_remote_server(self, request) return init_remote_server(self, request)
def __execute__(self, request): def __execute__(self, request):
kits, source = self._parse_request(request) try:
# set self.config
self.config = request.config
self.config.tmp_id = str(request.uuid)
self.config.tmp_folder = os.path.join(self.config.report_path,
"temp")
self.config.devices = request.get_devices()
if request.get("exectype") == TestExecType.device_test and \
not self.config.devices:
LOG.error("no device", error_no="00104")
raise ParamError("Load Error[00104]", error_no="00104")
# get source, json config and kits
if request.get_config_file():
source = request.get_config_file()
LOG.debug("Test config file path: %s" % source)
else:
source = request.get_source_string()
LOG.debug("Test String: %s" % source)
if not source:
LOG.error("no config file found for '%s'" %
request.get_source_file(), error_no="00102")
raise ParamError("Load Error(00102)", error_no="00102")
json_config = JsonParser(source)
kits = get_kit_instances(json_config, request.config.resource_path,
request.config.testcases_path)
# create tmp folder
test_name = request.get_module_name()
tmp_sub_folder = self._create_tmp_folder(request)
self.result = "%s.xml" % os.path.join(tmp_sub_folder, test_name)
# set configs keys
configs = self._set_configs(json_config, kits, request,
tmp_sub_folder)
# get test list
test_list = self._get_test_list(json_config, request, source)
if not test_list:
raise ParamError("no test list to run")
self._run_devicetest(configs, test_list)
except (ReportException, ModuleNotFoundError, ExecuteTerminate,
SyntaxError, ValueError, AttributeError, TypeError,
KeyboardInterrupt, ParamError, DeviceError, LiteDeviceError) \
as exception:
error_no = getattr(exception, "error_no", "00000")
LOG.exception(exception, exc_info=False, error_no=error_no)
self.error_message = exception
finally:
self._handle_finally(request)
def _get_test_list(self, json_config, request, source):
test_list = get_config_value('py_file', json_config.get_driver(),
is_list=True)
if str(request.root.source.source_file).endswith(PYD_SUFFIX) or \
str(request.root.source.source_file).endswith(PY_SUFFIX):
test_list = [request.root.source.source_file]
if not test_list and os.path.exists(source):
test_list = _get_dict_test_list(os.path.dirname(source))
# check test list
testcase = request.get("testcase")
testcase_list = []
if testcase:
testcase_list = str(testcase).split(";")
checked_test_list = []
for index, test in enumerate(test_list):
if not os.path.exists(test):
try:
absolute_file = get_file_absolute_path(test, [
self.config.resource_path, self.config.testcases_path])
except ParamError as error:
LOG.error(error, error_no=error.error_no)
continue
else:
absolute_file = test
file_name = get_filename_extension(absolute_file)[0]
if not testcase_list or file_name in testcase_list:
checked_test_list.append(absolute_file)
else:
LOG.info("test '%s' is ignored", absolute_file)
if checked_test_list:
LOG.info("test list: {}".format(checked_test_list))
else:
LOG.error("no test list found", error_no="00109")
raise ParamError("Load Error(00109)", error_no="00109")
return checked_test_list
def _set_configs(self, json_config, kits, request, tmp_sub_folder):
configs = dict() configs = dict()
configs["testargs"] = self.config.testargs or "" configs["testargs"] = self.config.testargs or {}
configs["testcases_path"] = self.config.testcases_path or "" configs["testcases_path"] = self.config.testcases_path or ""
configs["request"] = request configs["request"] = request
configs["test_name"] = request.get_module_name()
try: configs["report_path"] = tmp_sub_folder
if self.config.device and self.config.device.label == \ configs["execute"] = get_config_value(
DeviceLabelType.ipcamera: 'execute', json_config.get_driver(), False)
for device in self.config.devices:
do_module_kit_setup(request, kits)
if device.label == DeviceLabelType.ipcamera:
# add extra keys to configs for ipcamera device
self.__init_nfs_server__(request=request) self.__init_nfs_server__(request=request)
_, kits, kits_copy = set_up_env(request, source)
configs["linux_host"] = self.linux_host configs["linux_host"] = self.linux_host
configs["linux_directory"] = self.linux_directory configs["linux_directory"] = self.linux_directory
configs["kits"] = kits_copy configs["kits"] = kits
self.run_module(request, configs, source)
elif self.config.device and self.config.device.label == \
DeviceLabelType.watch:
self.run_module(request, configs, source)
elif self.config.device and self.config.device.label == \
DeviceLabelType.phone:
self.run_module(request, configs, source)
except (ReportException, ModuleNotFoundError, ExecuteTerminate,
SyntaxError, ValueError, AttributeError, TypeError,
KeyboardInterrupt, ParamError) as exception:
LOG.exception(exception)
self.error_message = exception
finally: return configs
self._handle_finally(kits, request)
def _handle_finally(self, kits, request): def _handle_finally(self, request):
from xdevice import Scheduler from xdevice import Scheduler
for kit in kits:
kit.__teardown__(request.config.device) # do kit teardown
if self.config.device.label == \ do_module_kit_teardown(request)
DeviceLabelType.ipcamera or self.config.device.label == \
DeviceLabelType.watch: # close device connect
self.config.device.close() for device in self.config.devices:
if device.label == DeviceLabelType.ipcamera or device.label == \
DeviceLabelType.watch_gt:
device.close()
if device.label == DeviceLabelType.phone:
device.close()
# check result report
report_name = request.root.source.test_name if \ report_name = request.root.source.test_name if \
not request.root.source.test_name.startswith("{") \ not request.root.source.test_name.startswith("{") \
else "report" else "report"
if Scheduler.mode != "decc": module_name = request.get_module_name()
if Scheduler.mode != ModeType.decc:
self.result = check_result_report( self.result = check_result_report(
request.config.report_path, self.result, self.error_message, request.config.report_path, self.result, self.error_message,
report_name) report_name, module_name)
else: else:
tmp_list = copy.copy(SuiteReporter.get_report_result()) tmp_list = copy.copy(SuiteReporter.get_report_result())
if os.path.dirname(self.result) not in \ if self.result not in [report_path for report_path, _ in tmp_list]:
[report_path for report_path, _ in tmp_list]:
if not self.error_message: if not self.error_message:
self.error_message = "An unknown exception occurred " \ self.error_message = "Case not execute[01205]"
"during the execution case"
self.result = check_result_report( self.result = check_result_report(
request.config.report_path, self.result, request.config.report_path, self.result,
self.error_message, report_name) self.error_message, report_name, module_name)
def _parse_request(self, request): def _create_tmp_folder(self, request):
from xdevice import Variables
kits = []
self.config = request.config
self.config.device = request.config.environment.devices[0]
if not self.config.device:
raise DeviceError("no device..........................")
current_dir = request.config.resource_path if \
request.config.resource_path else Variables.exec_dir
if request.root.source.source_file.strip():
source = os.path.join(current_dir,
request.root.source.source_file.strip())
LOG.debug("Testfile FilePath: %s" % source)
else:
source = request.root.source.source_string.strip()
self.config.tmp_folder = os.path.join(self.config.report_path,
"temp")
self.config.tmp_id = str(request.uuid)
return kits, source
def run_module(self, request, configs, source):
json_config = JsonParser(source)
if request.root.source.source_file.strip(): if request.root.source.source_file.strip():
folder_name = "task_%s_%s" % (self.config.tmp_id, folder_name = "task_%s_%s" % (self.config.tmp_id,
request.root.source.test_name) request.root.source.test_name)
tmp_sub_folder = os.path.join(self.config.tmp_folder, folder_name)
os.makedirs(tmp_sub_folder, exist_ok=True)
configs["report_path"] = tmp_sub_folder
self.result = "%s.xml" % os.path.join(tmp_sub_folder, "report")
module_path = os.path.dirname(source)
file_list = get_config_value('py_file', json_config.get_driver(),
is_list=True)
if not file_list:
file_list = get_file_list(module_path)
else: else:
folder_name = "task_%s_report" % self.config.tmp_id folder_name = "task_%s_report" % self.config.tmp_id
tmp_sub_folder = os.path.join(self.config.tmp_folder,
folder_name)
self.result = "%s.xml" % os.path.join(tmp_sub_folder, "report")
json_config = JsonParser(source)
file_list = get_config_value('py_file', json_config.get_driver(),
is_list=True)
configs["test_name"] = request.root.source.test_name
configs["execute"] = get_config_value('execute',
json_config.get_driver(), False)
tmp_sub_folder = os.path.join(self.config.tmp_folder, folder_name)
os.makedirs(tmp_sub_folder, exist_ok=True) os.makedirs(tmp_sub_folder, exist_ok=True)
self._run_devicetest(configs, file_list) return tmp_sub_folder
def _run_devicetest(self, configs, test_list):
from xdevice import Variables
def _run_devicetest(self, configs, test_file): # insert paths for loading _devicetest module and testcases
start_task(test_file, configs, self.config.device, LOG) devicetest_module = os.path.join(Variables.modules_dir, "_devicetest")
if os.path.exists(devicetest_module):
sys.path.insert(1, devicetest_module)
if configs["testcases_path"]:
sys.path.insert(1, configs["testcases_path"])
# run devicetest
from _devicetest.devicetest.main import DeviceTest
device_test = DeviceTest(test_list=test_list, configs=configs,
devices=self.config.devices, log=LOG)
device_test.run()
def __result__(self): def __result__(self):
if check_mode(ModeType.decc):
return self.result
return self.result if os.path.exists(self.result) else "" return self.result if os.path.exists(self.result) else ""
def _get_dict_test_list(module_path):
test_list = []
for root, _, files in os.walk(module_path):
for _file in files:
if _file.endswith(".py") or _file.endswith(".pyd"):
test_list.append(os.path.join(root, _file))
return test_list
文件模式从 100755 更改为 100644
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -16,19 +16,17 @@ ...@@ -16,19 +16,17 @@
# limitations under the License. # limitations under the License.
# #
import sys
from dataclasses import dataclass from dataclasses import dataclass
from _core.config.config_manager import UserConfigManager from _core.config.config_manager import UserConfigManager
from _core.exception import DeviceError
from _core.exception import ParamError
from _core.logger import platform_logger from _core.logger import platform_logger
from _core.logger import change_logger_level
from _core.plugin import Plugin from _core.plugin import Plugin
from _core.plugin import get_plugin from _core.plugin import get_plugin
from _core.utils import convert_serial from _core.utils import convert_serial
__all__ = ["EnvironmentManager", "DeviceSelectionOption", __all__ = ["EnvironmentManager", "DeviceSelectionOption",
"DeviceAllocationState"] "DeviceAllocationState", "Environment"]
LOG = platform_logger("ManagerEnv") LOG = platform_logger("ManagerEnv")
...@@ -61,7 +59,7 @@ class Environment(object): ...@@ -61,7 +59,7 @@ class Environment(object):
def add_device(self, device): def add_device(self, device):
if device.label == "phone": if device.label == "phone":
self.phone += 1 self.phone += 1
device.device_id = "phone%s" % str(self.phone) device.device_id = "Phone%s" % str(self.phone)
self.devices.append(device) self.devices.append(device)
...@@ -82,44 +80,39 @@ class EnvironmentManager(object): ...@@ -82,44 +80,39 @@ class EnvironmentManager(object):
cls.__instance = super(EnvironmentManager, cls).__new__(cls) cls.__instance = super(EnvironmentManager, cls).__new__(cls)
return cls.__instance return cls.__instance
def __init__(self, environment=""): def __init__(self, environment="", user_config_file=""):
if EnvironmentManager.__init_flag: if EnvironmentManager.__init_flag:
return return
self.manager_device = None self.managers = {}
self.manager_lite = None self.env_start(environment, user_config_file)
self._get_device_manager(environment)
EnvironmentManager.__init_flag = True EnvironmentManager.__init_flag = True
def _get_device_manager(self, environment=""): def env_start(self, environment="", user_config_file=""):
try:
result = UserConfigManager(env=environment).get_user_config( log_level_dict = UserConfigManager(
"environment/support_device") config_file=user_config_file, env=environment).get_log_level()
except ParamError as error:
LOG.exception("ParamError: %s" % error.args, exc_info=False) if log_level_dict:
if not environment: # change log level when load or reset EnvironmentManager object
sys.exit(0) change_logger_level(log_level_dict)
else:
raise error manager_plugins = get_plugin(Plugin.MANAGER)
if result.get("device") == "true": for manager_plugin in manager_plugins:
managers_device = get_plugin(plugin_type=Plugin.MANAGER, try:
plugin_id="device") manager_instance = manager_plugin.__class__()
if managers_device: manager_instance.init_environment(environment,
self.manager_device = managers_device[0] user_config_file)
self.manager_device.init_environment(environment) self.managers[manager_instance.__class__.__name__] = \
if result.get("device_lite") == "true": manager_instance
managers_lite = get_plugin(plugin_type=Plugin.MANAGER, except Exception as error:
plugin_id="device_lite") LOG.debug(error)
if managers_lite:
self.manager_lite = managers_lite[0]
self.manager_lite.init_environment(environment)
def env_stop(self): def env_stop(self):
if self.manager_device: for manager in self.managers.values():
self.manager_device.env_stop() manager.env_stop()
self.manager_device = None manager.devices_list = []
if self.manager_lite: self.managers = {}
self.manager_lite.devices_list = []
self.manager_lite = None
EnvironmentManager.__init_flag = False EnvironmentManager.__init_flag = False
def apply_environment(self, device_options): def apply_environment(self, device_options):
...@@ -128,61 +121,72 @@ class EnvironmentManager(object): ...@@ -128,61 +121,72 @@ class EnvironmentManager(object):
device = self.apply_device(device_option) device = self.apply_device(device_option)
if device is not None: if device is not None:
environment.add_device(device) environment.add_device(device)
device.extend_value = device_option.extend_value
LOG.debug("device %s: extend value: %s", device.device_sn,
device.extend_value)
return environment return environment
def release_environment(self, environment): def release_environment(self, environment):
for device in environment.devices: for device in environment.devices:
device.extend_value = {}
self.release_device(device) self.release_device(device)
def apply_device(self, device_option, timeout=10): def apply_device(self, device_option, timeout=10):
for manager_type, manager in self.managers.items():
if not device_option.label or device_option.label == "phone": support_labels = getattr(manager, "support_labels", [])
device_manager = self.manager_device if not support_labels:
else: continue
device_manager = self.manager_lite if device_option.label is None:
if manager_type != "ManagerDevice":
if device_manager: continue
return device_manager.apply_device(device_option, timeout) else:
if support_labels and \
device_option.label not in support_labels:
continue
device = manager.apply_device(device_option, timeout)
if device:
return device
else: else:
raise DeviceError( return None
"%s is not supported, please check %s and "
"environment config user_config.xml" %
(str(device_option.test_driver), device_option.source_file))
def check_device_exist(self, device_options): def check_device_exist(self, device_options):
""" """
Check if there are matched devices which can be allocated or available. Check if there are matched devices which can be allocated or available.
""" """
devices = []
for device_option in device_options: for device_option in device_options:
device_exist = False for manager_type, manager in self.managers.items():
if self.manager_device: support_labels = getattr(manager, "support_labels", [])
for device in self.manager_device.devices_list: if device_option.label is None:
if device_option.matches(device, False): if manager_type != "ManagerDevice":
device_exist = True continue
if self.manager_lite: else:
for device in self.manager_lite.devices_list: if support_labels and \
device_option.label not in support_labels:
continue
for device in manager.devices_list:
if device.device_sn in devices:
continue
if device_option.matches(device, False): if device_option.matches(device, False):
device_exist = True devices.append(device.device_sn)
if not device_exist: break
else:
continue
break
else:
return False return False
return True return True
def release_device(self, device): def release_device(self, device):
if self.manager_device and \ for manager in self.managers.values():
device in self.manager_device.devices_list: if device in manager.devices_list:
self.manager_device.release_device(device) manager.release_device(device)
elif self.manager_lite and \
device in self.manager_lite.devices_list:
self.manager_lite.release_device(device)
def list_devices(self): def list_devices(self):
LOG.info("list devices.") LOG.info("list devices.")
if self.manager_device: for manager in self.managers.values():
self.manager_device.list_devices() manager.list_devices()
if self.manager_lite:
self.manager_lite.list_devices()
class DeviceSelectionOption(object): class DeviceSelectionOption(object):
...@@ -195,18 +199,24 @@ class DeviceSelectionOption(object): ...@@ -195,18 +199,24 @@ class DeviceSelectionOption(object):
self.label = label self.label = label
self.test_driver = test_source.test_type self.test_driver = test_source.test_type
self.source_file = "" self.source_file = ""
self.extend_value = {}
def get_label(self): def get_label(self):
return self.label return self.label
def matches(self, device, allocate=True): def matches(self, device, allocate=True):
if not getattr(device, "task_state", True):
return False
if allocate and device.device_allocation_state != \ if allocate and device.device_allocation_state != \
DeviceAllocationState.available: DeviceAllocationState.available:
return False return False
if not allocate and device.device_allocation_state == \ if not allocate:
DeviceAllocationState.ignored: if device.device_allocation_state != \
return False DeviceAllocationState.available and \
device.device_allocation_state != \
DeviceAllocationState.allocated:
return False
if len(self.device_sn) != 0 and device.device_sn not in self.device_sn: if len(self.device_sn) != 0 and device.device_sn not in self.device_sn:
return False return False
...@@ -222,3 +232,4 @@ class DeviceAllocationState: ...@@ -222,3 +232,4 @@ class DeviceAllocationState:
ignored = "Ignored" ignored = "Ignored"
available = "Available" available = "Available"
allocated = "Allocated" allocated = "Allocated"
unusable = "Unusable"
此差异已折叠。
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# coding=utf-8 # coding=utf-8
# #
# Copyright (c) 2020 Huawei Device Co., Ltd. # Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -55,8 +55,8 @@ def main_report(): ...@@ -55,8 +55,8 @@ def main_report():
task_info.device_name = "None" task_info.device_name = "None"
task_info.test_time = time.strftime(ReportConstant.time_format, task_info.test_time = time.strftime(ReportConstant.time_format,
time.localtime()) time.localtime())
result_report = ResultReporter(report_path, task_info) result_report = ResultReporter()
result_report.generate_reports() result_report.__generate_reports__(report_path, task_info=task_info)
if __name__ == "__main__": if __name__ == "__main__":
......
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册