mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-26 17:30:31 +00:00
dcts仓库建设&分布式数据用例上仓.
Signed-off-by: songdawei <songdawei1@huawei.com>
This commit is contained in:
parent
3774bb9b02
commit
a7002ad540
30
BUILD.gn
Executable file
30
BUILD.gn
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
#import("//hit/build/suite.gni")
|
||||||
|
import("test_packages.gni")
|
||||||
|
ohos_test_suite("dcts") {
|
||||||
|
deps = selected_packages
|
||||||
|
}
|
||||||
|
|
||||||
|
ohos_test_suite("dcts_ivi") {
|
||||||
|
deps = selected_packages_ivi
|
||||||
|
}
|
||||||
|
|
||||||
|
ohos_test_suite("dcts_intellitv") {
|
||||||
|
deps = selected_packages_intellitv
|
||||||
|
}
|
||||||
|
|
||||||
|
ohos_test_suite("dcts_wearable") {
|
||||||
|
deps = selected_packages_wearable
|
||||||
|
}
|
177
LICENSE
Executable file
177
LICENSE
Executable file
@ -0,0 +1,177 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
64
OAT.xml
Executable file
64
OAT.xml
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="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.
|
||||||
|
-->
|
||||||
|
<!-- OAT(OSS Audit Tool) configuration guide:
|
||||||
|
basedir: Root dir, the basedir + project path is the real source file location.
|
||||||
|
licensefile:
|
||||||
|
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||||
|
|
||||||
|
tasklist(only for batch mode):
|
||||||
|
1. task: Define oat check thread, each task will start a new thread.
|
||||||
|
2. task name: Only an name, no practical effect.
|
||||||
|
3. task policy: Default policy for projects under this task, this field is required and the specified policy must defined in policylist.
|
||||||
|
4. task filter: Default filefilter for projects under this task, this field is required and the specified filefilter must defined in filefilterlist.
|
||||||
|
5. task project: Projects to be checked, the path field define the source root dir of the project.
|
||||||
|
|
||||||
|
|
||||||
|
policyList:
|
||||||
|
1. policy: All policyitems will be merged to default OAT.xml rules, the name of policy doesn't affect OAT check process.
|
||||||
|
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||||
|
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||||
|
3. policyitem type:
|
||||||
|
"compatibility" is used to check license compatibility in the specified path;
|
||||||
|
"license" is used to check source license header in the specified path;
|
||||||
|
"copyright" is used to check source copyright header in the specified path;
|
||||||
|
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||||
|
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||||
|
"filename" is used to check whether the specified file exists in the specified path(support projectroot in default OAT.xml), supported file names: LICENSE, README, README.OpenSource
|
||||||
|
|
||||||
|
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||||
|
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||||
|
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||||
|
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||||
|
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||||
|
|
||||||
|
Note:If the text contains special characters, please escape them according to the following rules:
|
||||||
|
" == >
|
||||||
|
& == >
|
||||||
|
' == >
|
||||||
|
< == >
|
||||||
|
> == >
|
||||||
|
-->
|
||||||
|
<configuration>
|
||||||
|
<oatconfig>
|
||||||
|
<filefilterlist>
|
||||||
|
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binaryFile" >
|
||||||
|
<filteritem type="filename" name="*.jpg" desc="all jpg file have check "/>
|
||||||
|
<filteritem type="filename" name="*.gif" desc="all gif file have check "/>
|
||||||
|
<filteritem type="filename" name="*.png" desc="all png file have check "/>
|
||||||
|
</filefilter>
|
||||||
|
</filefilterlist>
|
||||||
|
</oatconfig>
|
||||||
|
</configuration>
|
535
README.en.md
535
README.en.md
@ -1,36 +1,507 @@
|
|||||||
# xts_dcts
|
# XTS<a name="EN-US_TOPIC_0000001126156429"></a>
|
||||||
|
|
||||||
#### Description
|
- [Introduction](#section465982318513)
|
||||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
- [System Types](#section125090457443)
|
||||||
|
- [Directory Structure](#section161941989596)
|
||||||
#### Software Architecture
|
- [Constraints](#section119744591305)
|
||||||
Software architecture description
|
- [Usage Guidelines](#section137768191623)
|
||||||
|
- [Test Case Development Guidelines](#section3695134065513)
|
||||||
#### Installation
|
- [C-based Test Case Development and Compilation \(for the Mini System\)](#section198193336544)
|
||||||
|
- [C-based Test Case Execution \(for the Mini System\)](#section13820233175418)
|
||||||
1. xxxx
|
- [C++-based Test Case Development and Compilation \(for Standard and Small Systems\)](#section3822123311540)
|
||||||
2. xxxx
|
- [C++-based Test Case Execution \(for Standard and Small Systems\)](#section128222336544)
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Instructions
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Contribution
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create Feat_xxx branch
|
|
||||||
3. Commit your code
|
|
||||||
4. Create Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### Gitee Feature
|
## Introduction<a name="section465982318513"></a>
|
||||||
|
|
||||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
The X test suite \(XTS\) subsystem contains a set of OpenHarmony certification test suites, including the currently supported hardware abstract test suite \(HATS\).
|
||||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
This subsystem contains the HATS and **tools** software package.
|
||||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
|
||||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
- The **hats** directory stores the source code and configuration files of HATS test cases. The HATS helps device vendors detect the HAL software incompatibility as early as possible and ensures that the software is compatible to OpenHarmony during the entire development process.
|
||||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
- The **tools** software package stores the test case development framework related to **hats**.
|
||||||
|
|
||||||
|
## System Types<a name="section125090457443"></a>
|
||||||
|
|
||||||
|
OpenHarmony supports the following system types:
|
||||||
|
|
||||||
|
- Mini system
|
||||||
|
|
||||||
|
A mini system runs on the devices whose memory is greater than or equal to 128 KiB and that are equipped with MCU processors such as ARM Cortex-M and 32-bit RISC-V. This system provides multiple lightweight network protocols and graphics frameworks, and a wide range of read/write components for the IoT bus. Typical products include connection modules, sensors, and wearables for smart home.
|
||||||
|
|
||||||
|
- Small system
|
||||||
|
|
||||||
|
A small system runs on the devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as ARM Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, and routers, and event data recorders \(EDRs\) for smart travel.
|
||||||
|
|
||||||
|
- Standard system
|
||||||
|
|
||||||
|
A standard system runs on the devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as ARM Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays.
|
||||||
|
|
||||||
|
|
||||||
|
## Directory Structure<a name="section161941989596"></a>
|
||||||
|
|
||||||
|
```
|
||||||
|
/test/xts
|
||||||
|
├── hats # Test code
|
||||||
|
│ └── subsystem # Source code of subsystem test cases for the standard system
|
||||||
|
│ └── subsystem_lite # Source code of subsystems test cases for mini and small systems
|
||||||
|
│ └── BUILD.gn # Build configuration of test cases for the standard system
|
||||||
|
│ └── build_lite
|
||||||
|
│ └── BUILD.gn # Build configuration of test cases for mini and small systems
|
||||||
|
└── tools # Test tool code
|
||||||
|
```
|
||||||
|
|
||||||
|
## Constraints<a name="section119744591305"></a>
|
||||||
|
|
||||||
|
Test cases for the mini system must be developed based on C, and those for the small system must be developed based on C++.
|
||||||
|
|
||||||
|
## Usage Guidelines<a name="section137768191623"></a>
|
||||||
|
|
||||||
|
**Table 1** Test case levels
|
||||||
|
|
||||||
|
<a name="table12856113719456"></a>
|
||||||
|
<table><thead align="left"><tr id="row88561737114517"><th class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.2.4.1.1"><p id="p54711456452"><a name="p54711456452"></a><a name="p54711456452"></a>Level</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.283328332833285%" id="mcps1.2.4.1.2"><p id="p114834544518"><a name="p114834544518"></a><a name="p114834544518"></a>Definition</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.383338333833386%" id="mcps1.2.4.1.3"><p id="p348154574518"><a name="p348154574518"></a><a name="p348154574518"></a>Scope</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row78561137134514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p17481345124512"><a name="p17481345124512"></a><a name="p17481345124512"></a>Level0</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p1548945204514"><a name="p1548945204514"></a><a name="p1548945204514"></a>Smoke</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p174824517456"><a name="p174824517456"></a><a name="p174824517456"></a>Verifies basic functionalities of key features and basic DFX attributes with the most common input. The pass result indicates that the features are runnable.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row28563372451"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p448445144512"><a name="p448445144512"></a><a name="p448445144512"></a>Level1</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p44813452452"><a name="p44813452452"></a><a name="p44813452452"></a>Basic</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p648184584514"><a name="p648184584514"></a><a name="p648184584514"></a>Verifies basic functionalities of key features and basic DFX attributes with common input. The pass result indicates that the features are testable.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row12856137204514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p164834520453"><a name="p164834520453"></a><a name="p164834520453"></a>Level2</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p148245184511"><a name="p148245184511"></a><a name="p148245184511"></a>Major</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p348945124510"><a name="p348945124510"></a><a name="p348945124510"></a>Verifies basic functionalities of key features and basic DFX attributes with common input and errors. The pass result indicates that the features are functional and ready for beta testing.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row48571137204514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p7481545184513"><a name="p7481545184513"></a><a name="p7481545184513"></a>Level3</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p1748184514455"><a name="p1748184514455"></a><a name="p1748184514455"></a>Regular</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p8481245104519"><a name="p8481245104519"></a><a name="p8481245104519"></a>Verifies functionalities of all key features, and all DFX attributes with common and uncommon input combinations or normal and abnormal preset conditions.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row14857133712451"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p1248144515456"><a name="p1248144515456"></a><a name="p1248144515456"></a>Level4</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p94804514519"><a name="p94804514519"></a><a name="p94804514519"></a>Rare</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p1248445164516"><a name="p1248445164516"></a><a name="p1248445164516"></a>Verifies functionalities of key features under extremely abnormal presets and uncommon input combinations.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
**Table 2** Test case granularities
|
||||||
|
|
||||||
|
<a name="table1690733521014"></a>
|
||||||
|
<table><thead align="left"><tr id="row9907143516105"><th class="cellrowborder" valign="top" width="19.591959195919593%" id="mcps1.2.4.1.1"><p id="p1141312416102"><a name="p1141312416102"></a><a name="p1141312416102"></a>Test Scale</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="35.17351735173517%" id="mcps1.2.4.1.2"><p id="p34131416109"><a name="p34131416109"></a><a name="p34131416109"></a>Test Objects</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="45.23452345234523%" id="mcps1.2.4.1.3"><p id="p12413141171010"><a name="p12413141171010"></a><a name="p12413141171010"></a>Test Environment</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row2907335181017"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p6414134117109"><a name="p6414134117109"></a><a name="p6414134117109"></a>LargeTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p20414104113101"><a name="p20414104113101"></a><a name="p20414104113101"></a>Service functionalities, all-scenario features, and mechanical power environment (MPE) and scenario-level DFX</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p5414841121013"><a name="p5414841121013"></a><a name="p5414841121013"></a>Devices close to real devices</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row10907635131015"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p19414134117104"><a name="p19414134117104"></a><a name="p19414134117104"></a>MediumTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p114141241141018"><a name="p114141241141018"></a><a name="p114141241141018"></a>Modules, subsystem functionalities after module integration, and DFX</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p14414941111015"><a name="p14414941111015"></a><a name="p14414941111015"></a>Single device that is actually used. You can perform message simulation, but do not mock functions.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1990713353100"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p641414110109"><a name="p641414110109"></a><a name="p641414110109"></a>SmallTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p54141541181018"><a name="p54141541181018"></a><a name="p54141541181018"></a>Modules, classes, and functions</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p1841494131013"><a name="p1841494131013"></a><a name="p1841494131013"></a>Local PC. Use a large number of mocks to replace dependencies with other modules.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
**Table 3** Test types
|
||||||
|
|
||||||
|
<a name="table18811230124619"></a>
|
||||||
|
<table><thead align="left"><tr id="row48163019466"><th class="cellrowborder" valign="top" width="19.040000000000003%" id="mcps1.2.3.1.1"><p id="p1791784418465"><a name="p1791784418465"></a><a name="p1791784418465"></a>Type</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="80.96%" id="mcps1.2.3.1.2"><p id="p2917164444614"><a name="p2917164444614"></a><a name="p2917164444614"></a>Definition</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row682630104615"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1091784414469"><a name="p1091784414469"></a><a name="p1091784414469"></a>Function</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p16917344104618"><a name="p16917344104618"></a><a name="p16917344104618"></a>Tests the correctness of both service and platform functionalities provided by the tested object for end users or developers.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1821930154611"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p591714474612"><a name="p591714474612"></a><a name="p591714474612"></a>Performance</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p15917154410463"><a name="p15917154410463"></a><a name="p15917154410463"></a>Tests the processing capability of the tested object under specific preset conditions and load models. The processing capability is measured by the service volume that can be processed in a unit time, for example, call per second, frame per second, or event processing volume per second.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row13821030104616"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p691711440467"><a name="p691711440467"></a><a name="p691711440467"></a>Power</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p159171544104616"><a name="p159171544104616"></a><a name="p159171544104616"></a>Tests the power consumption of the tested object in a certain period of time under specific preset conditions and load models.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row6821330114618"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p13917164454612"><a name="p13917164454612"></a><a name="p13917164454612"></a>Reliability</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p11917194416465"><a name="p11917194416465"></a><a name="p11917194416465"></a>Tests the service performance of the tested object under common and uncommon input conditions, or specified service volume pressure and long-term continuous running pressure. The test covers stability, pressure handling, fault injection, and Monkey test times.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row11821930184612"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1691774474618"><a name="p1691774474618"></a><a name="p1691774474618"></a>Security</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><a name="ul112421652121513"></a><a name="ul112421652121513"></a><ul id="ul112421652121513"><li>Tests the capability of defending against security threats, including but not limited to unauthorized access, use, disclosure, damage, modification, and destruction, to ensure information confidentiality, integrity, and availability.</li><li>Tests the privacy protection capability to ensure that the collection, use, retention, disclosure, and disposal of users' private data comply with laws and regulations.</li><li>Tests the compliance with various security specifications, such as security design, security requirements, and security certification of the Ministry of Industry and Information Technology (MIIT).</li></ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row16825307467"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p129188444462"><a name="p129188444462"></a><a name="p129188444462"></a>Global</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p179186444465"><a name="p179186444465"></a><a name="p179186444465"></a>Tests the internationalized data and localization capabilities of the tested object, including multi-language display, various input/output habits, time formats, and regional features, such as currency, time, and culture taboos.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row08211308464"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p191814447465"><a name="p191814447465"></a><a name="p191814447465"></a>Compatibility</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><a name="ul186961827111612"></a><a name="ul186961827111612"></a><ul id="ul186961827111612"><li>Tests backward compatibility of an application with its own data, the forward and backward compatibility with the system, and the compatibility with different user data, such as audio file content of the player and smart SMS messages.</li><li>Tests system backward compatibility with its own data and the compatibility of common applications in the ecosystem.</li><li>Tests software compatibility with related hardware.</li></ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1782730124618"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p13918144134614"><a name="p13918144134614"></a><a name="p13918144134614"></a>User</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p1291844494611"><a name="p1291844494611"></a><a name="p1291844494611"></a>Tests user experience of the object in real user scenarios. All conclusions and comments should come from the users, which are all subjective evaluation in this case.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row58243024617"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1291884474614"><a name="p1291884474614"></a><a name="p1291884474614"></a>Standard</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p0918124424614"><a name="p0918124424614"></a><a name="p0918124424614"></a>Tests the compliance with industry and company-specific standards, protocols, and specifications. The standards here do not include any security standards that should be classified into the security test.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row382830124619"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p119181044164619"><a name="p119181044164619"></a><a name="p119181044164619"></a>Safety</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p1291818443468"><a name="p1291818443468"></a><a name="p1291818443468"></a>Tests the safety property of the tested object to avoid possible hazards to personal safety, health, and the object itself.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1083153014465"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p39187441469"><a name="p39187441469"></a><a name="p39187441469"></a>Resilience</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p891815444462"><a name="p891815444462"></a><a name="p891815444462"></a>Tests the resilience property of the tested object to ensure that it can withstand and maintain the defined running status (including downgrading) when being attacked, and recover from and adapt defense to the attacks to approach mission assurance.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Test Case Development Guidelines<a name="section3695134065513"></a>
|
||||||
|
|
||||||
|
You should select the appropriate programming language and your target test framework to develop test cases.
|
||||||
|
|
||||||
|
**Table 4** Test frameworks and test case languages for different systems
|
||||||
|
|
||||||
|
<a name="table4418343171415"></a>
|
||||||
|
<table><thead align="left"><tr id="row34183435145"><th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.1"><p id="p941874311148"><a name="p941874311148"></a><a name="p941874311148"></a>System</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.2"><p id="p1841804341413"><a name="p1841804341413"></a><a name="p1841804341413"></a>Test Framework</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.3"><p id="p2418104311148"><a name="p2418104311148"></a><a name="p2418104311148"></a>Language</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row8419164319148"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p7419194312143"><a name="p7419194312143"></a><a name="p7419194312143"></a>Mini</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p10419124312145"><a name="p10419124312145"></a><a name="p10419124312145"></a>HCTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p11419643191410"><a name="p11419643191410"></a><a name="p11419643191410"></a>C</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row141915438147"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p441911436141"><a name="p441911436141"></a><a name="p441911436141"></a>Small</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p541916432142"><a name="p541916432142"></a><a name="p541916432142"></a>HCPPTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p54191643131416"><a name="p54191643131416"></a><a name="p54191643131416"></a>C++</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row4419134341417"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p341964313143"><a name="p341964313143"></a><a name="p341964313143"></a>Standard</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p10419443171416"><a name="p10419443171416"></a><a name="p10419443171416"></a>HJSUnit and HCPPTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p9419143181414"><a name="p9419143181414"></a><a name="p9419143181414"></a>JavaScript and C++</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### C-based Test Case Development and Compilation \(for the Mini System\)<a name="section198193336544"></a>
|
||||||
|
|
||||||
|
**Developing test cases for the mini system**
|
||||||
|
|
||||||
|
The HCTest framework is used to support test cases developed with the C language. HCTest is enhanced and adapted based on the open-source test framework Unity.
|
||||||
|
|
||||||
|
1. Access the **test/xts/hats** repository where the test cases will be stored.
|
||||||
|
|
||||||
|
```
|
||||||
|
├── hats
|
||||||
|
│ └──subsystem_lite
|
||||||
|
│ │ └── module_hal
|
||||||
|
│ │ │ └── BUILD.gn
|
||||||
|
│ │ │ └── src
|
||||||
|
│ └──build_lite
|
||||||
|
│ │ └── BUILD.gn
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Write the test case in the **src** directory.
|
||||||
|
|
||||||
|
1 Import the test framework header file.
|
||||||
|
|
||||||
|
```
|
||||||
|
#include "hctest.h"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Use the **LITE\_TEST\_SUIT** macro to define names of the subsystem, module, and test suite.
|
||||||
|
|
||||||
|
```
|
||||||
|
/**
|
||||||
|
* @brief Registers a test suite named IntTestSuite.
|
||||||
|
* @param test Subsystem name
|
||||||
|
* @param example Module name
|
||||||
|
* @param IntTestSuite Test suite name
|
||||||
|
*/
|
||||||
|
LITE_TEST_SUIT(test, example, IntTestSuite);
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Define Setup and TearDown.
|
||||||
|
|
||||||
|
Format: Test suite name+Setup, Test suite name+TearDown.
|
||||||
|
|
||||||
|
The Setup and TearDown functions must exist, but function bodies can be empty.
|
||||||
|
|
||||||
|
4. Use the **LITE\_TEST\_CASE** macro to write the test case.
|
||||||
|
|
||||||
|
Three parameters are involved: test suite name, test case name, and test case properties \(including type, granularity, and level\).
|
||||||
|
|
||||||
|
```
|
||||||
|
LITE_TEST_CASE(IntTestSuite, TestCase001, Function | MediumTest | Level1)
|
||||||
|
{
|
||||||
|
// Do something
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Use the **RUN\_TEST\_SUITE** macro to register the test suite.
|
||||||
|
|
||||||
|
```
|
||||||
|
RUN_TEST_SUITE(IntTestSuite);
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Create the configuration file \(**BUILD.gn**\) of the test module.
|
||||||
|
|
||||||
|
Create a **BUILD.gn** \(example\) build file in each test module directory. Specify the name of the built static library and its dependent header file and library in the build file. The format is as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
import("//test/xts/tools/lite/build/suite_lite.gni")
|
||||||
|
hctest_suite("HatsDemoTest") {
|
||||||
|
suite_name = "hats"
|
||||||
|
sources = [
|
||||||
|
"src/test_demo.c",
|
||||||
|
]
|
||||||
|
include_dirs = [ ]
|
||||||
|
cflags = [ "-Wno-error" ]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Add build options to the **BUILD.gn** file in the **hats** directory.
|
||||||
|
|
||||||
|
You need to add the test module to the **test/xts/hats/build\_lite/BUILD.gn** script in the **hats** directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
lite_component("hats") {
|
||||||
|
...
|
||||||
|
if(board_name == "liteos_m") {
|
||||||
|
features += [
|
||||||
|
...
|
||||||
|
"//xts/hats/subsystem_lite/module_hal:HatsDemoTest"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run build commands.
|
||||||
|
|
||||||
|
Test suites are built along with version build. The HATS is built together with the debug version.
|
||||||
|
|
||||||
|
>![](figures/icon-note.gif) **NOTE:**
|
||||||
|
>The HATS build middleware is a static library, which will be linked to the image.
|
||||||
|
|
||||||
|
|
||||||
|
### C-based Test Case Execution \(for the Mini System\)<a name="section13820233175418"></a>
|
||||||
|
|
||||||
|
**Executing test cases for the mini system**
|
||||||
|
|
||||||
|
Burn the image into the development board.
|
||||||
|
|
||||||
|
**Executing the test**
|
||||||
|
|
||||||
|
1. Use a serial port tool to log in to the development board and save information about the serial port.
|
||||||
|
2. Restart the device and view serial port logs.
|
||||||
|
|
||||||
|
**Analyzing the test result**
|
||||||
|
|
||||||
|
View the serial port logs, whose format is as follows:
|
||||||
|
|
||||||
|
The log for each test suite starts with **Start to run test suite:** and ends with **xx Tests xx Failures xx Ignored**.
|
||||||
|
|
||||||
|
### C++-based Test Case Development and Compilation \(for Standard and Small Systems\)<a name="section3822123311540"></a>
|
||||||
|
|
||||||
|
**Developing test cases for small-system devices** \(For examples of the standard system, go to the **global/i18n\_standard directory**.\)
|
||||||
|
|
||||||
|
The HCPPTest framework is enhanced and adapted based on the open-source framework Googletest.
|
||||||
|
|
||||||
|
1. Access the **test/xts/hats** repository where the test cases will be stored.
|
||||||
|
|
||||||
|
```
|
||||||
|
├── hats
|
||||||
|
│ └──subsystem_lite
|
||||||
|
│ │ └── module_posix
|
||||||
|
│ │ │ └── BUILD.gn
|
||||||
|
│ │ │ └── src
|
||||||
|
│ └──build_lite
|
||||||
|
│ │ └── BUILD.gn
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Write the test case in the **src** directory.
|
||||||
|
|
||||||
|
1. Import the test framework header file.
|
||||||
|
|
||||||
|
The following statement includes **gtest.h**.
|
||||||
|
|
||||||
|
```
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Define Setup and TearDown.
|
||||||
|
|
||||||
|
```
|
||||||
|
using namespace std;
|
||||||
|
using namespace testing::ext;
|
||||||
|
class TestSuite: public testing::Test {
|
||||||
|
protected:
|
||||||
|
// Preset action of the test suite, which is executed before the first test case
|
||||||
|
static void SetUpTestCase(void){
|
||||||
|
}
|
||||||
|
// Test suite cleanup action, which is executed after the last test case
|
||||||
|
static void TearDownTestCase(void){
|
||||||
|
}
|
||||||
|
// Preset action of the test case
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
// Cleanup action of the test case
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Use the **HWTEST** or **HWTEST\_F** macro to write the test case.
|
||||||
|
|
||||||
|
**HWTEST**: definition of common test cases, including the test suite name, test case name, and case annotation.
|
||||||
|
|
||||||
|
**HWTEST\_F**: definition of SetUp and TearDown test cases, including the test suite name, test case name, and case annotation.
|
||||||
|
|
||||||
|
Three parameters are involved: test suite name, test case name, and test case properties \(including type, granularity, and level\).
|
||||||
|
|
||||||
|
```
|
||||||
|
HWTEST_F(TestSuite, TestCase_0001, Function | MediumTest | Level1) {
|
||||||
|
// Do something
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Create a configuration file \(**BUILD.gn**\) of the test module.
|
||||||
|
|
||||||
|
Create a **BUILD.gn** build file in each test module directory. Specify the name of the built static library and its dependent header file and library in the build file. Each test module is independently built into a **.bin** executable file, which can be directly pushed to the development board for testing.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
import("//test/xts/tools/lite/build/suite_lite.gni")
|
||||||
|
hcpptest_suite("HatsDemoTest") {
|
||||||
|
suite_name = "hats"
|
||||||
|
sources = [
|
||||||
|
"src/TestDemo.cpp"
|
||||||
|
]
|
||||||
|
|
||||||
|
include_dirs = [
|
||||||
|
"src",
|
||||||
|
...
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
...
|
||||||
|
]
|
||||||
|
cflags = [ "-Wno-error" ]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Add build options to the **BUILD.gn** file in the **hats** directory.
|
||||||
|
|
||||||
|
Add the test module to the **test/xts/hats/build\_lite/BUILD.gn** script in the **hats** directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
lite_component("hats") {
|
||||||
|
...
|
||||||
|
else if(board_name == "liteos_a") {
|
||||||
|
features += [
|
||||||
|
...
|
||||||
|
"//xts/hats/subsystem_lite/module_posix:HatsDemoTest"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run build commands.
|
||||||
|
|
||||||
|
Test suites are built along with the version build. The HATS is built together with the debug version.
|
||||||
|
|
||||||
|
>![](figures/icon-note.gif) **NOTE:**
|
||||||
|
>The HATS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\hats** directory of the build result.
|
||||||
|
|
||||||
|
|
||||||
|
### C++-based Test Case Execution \(for Standard and Small Systems\)<a name="section128222336544"></a>
|
||||||
|
|
||||||
|
**Executing test cases for the small system**
|
||||||
|
|
||||||
|
Currently, test cases are shared by the NFS and mounted to the development board for execution.
|
||||||
|
|
||||||
|
**Setting up the environment**
|
||||||
|
|
||||||
|
1. Use a network cable or wireless network to connect the development board to your PC.
|
||||||
|
2. Configure the IP address, subnet mask, and gateway for the development board. Ensure that the development board and the PC are in the same network segment.
|
||||||
|
3. Install and register the NFS server on the PC and start the NFS service.
|
||||||
|
4. Run the **mount** command for the development board to ensure that the development board can access NFS shared files on the PC.
|
||||||
|
|
||||||
|
Format: **mount** _NFS server IP address_**:/**_NFS shared directory_ **/**_development board directory_ **nfs**
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
mount 192.168.1.10:/nfs /nfs nfs
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**Executing test cases**
|
||||||
|
|
||||||
|
Execute **HatsDemoTest.bin** to trigger test case execution, and analyze serial port logs generated after the execution is complete.
|
||||||
|
567
README.md
567
README.md
@ -1,39 +1,552 @@
|
|||||||
# xts_dcts
|
# XTS子系统<a name="ZH-CN_TOPIC_0000001117409671"></a>
|
||||||
|
|
||||||
#### 介绍
|
- [简介](#section465982318513)
|
||||||
{**以下是 Gitee 平台说明,您可以替换此简介**
|
- [系统类型](#section125090457443)
|
||||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
|
- [目录](#section161941989596)
|
||||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
|
- [约束](#section119744591305)
|
||||||
|
- [使用说明](#section137768191623)
|
||||||
|
- [用例开发指导](#section3695134065513)
|
||||||
|
- [C语言用例开发编译指导(适用于轻量系统产品用例开发)](#section198193336544)
|
||||||
|
- [C语言用例执行指导(适用于轻量系统产品用例开发)](#section13820233175418)
|
||||||
|
- [C++语言用例开发编译指导(适用于小型系统、标准系统用例开发)](#section3822123311540)
|
||||||
|
- [C++语言用例执行指导(适用于小型系统、标准系统用例开发)](#section128222336544)
|
||||||
|
|
||||||
#### 软件架构
|
- [相关仓](#section1371113476307)
|
||||||
软件架构说明
|
|
||||||
|
## 简介<a name="section465982318513"></a>
|
||||||
|
|
||||||
|
XTS子系统是OpenHarmony生态认证测试套件的集合,当前包括hats(hardware abstract test suite)HAL兼容性测试套件。
|
||||||
|
|
||||||
|
XTS子系统当前包括hats与tools软件包:
|
||||||
|
|
||||||
|
- hats,存放hats相关测试用例源码与配置文件,其目的是帮助终端设备厂商尽早发现HAL层软件与OpenHarmony的不兼容性,确保软件在整个开发过程中满足OpenHarmony的兼容性要求。
|
||||||
|
- tools,存放hats相关测试用例开发框架。
|
||||||
|
|
||||||
|
## 系统类型<a name="section125090457443"></a>
|
||||||
|
|
||||||
|
OpenHarmony支持如下几种系统类型:
|
||||||
|
|
||||||
|
- 轻量系统(mini system)
|
||||||
|
|
||||||
|
面向MCU类处理器例如Arm Cortex-M、RISC-V 32位的设备,硬件资源极其有限,支持的设备最小内存为128KiB,可以提供多种轻量级网络协议,轻量级的图形框架,以及丰富的IOT总线读写部件等。可支撑的产品如智能家居领域的连接类模组、传感器设备、穿戴类设备等。
|
||||||
|
|
||||||
|
- 小型系统(small system)
|
||||||
|
|
||||||
|
面向应用处理器例如Arm Cortex-A的设备,支持的设备最小内存为1MiB,可以提供更高的安全能力、标准的图形框架、视频编解码的多媒体能力。可支撑的产品如智能家居领域的IP Camera、电子猫眼、路由器以及智慧出行领域的行车记录仪等。
|
||||||
|
|
||||||
|
- 标准系统(standard system)
|
||||||
|
|
||||||
|
面向应用处理器例如Arm Cortex-A的设备,支持的设备最小内存为128MiB,可以提供增强的交互能力、3D GPU以及硬件合成能力、更多控件以及动画效果更丰富的图形能力、完整的应用框架。可支撑的产品如高端的冰箱显示屏。
|
||||||
|
|
||||||
|
|
||||||
#### 安装教程
|
## 目录<a name="section161941989596"></a>
|
||||||
|
|
||||||
1. xxxx
|
```
|
||||||
2. xxxx
|
/test/xts
|
||||||
3. xxxx
|
├── hats # 测试代码存放目录
|
||||||
|
│ └── subsystem # 标准系统子系统测试用例源码存放目录
|
||||||
|
│ └── subsystem_lite # 轻量系统、小型系统子系统测试用例源码存放目录
|
||||||
|
│ └── BUILD.gn # 标准系统测试用例编译配置
|
||||||
|
│ └── build_lite # 轻量系统、小型系统测试用例编译配置存放目录
|
||||||
|
│ └── BUILD.gn # 轻量系统、小型系统测试用例编译配置
|
||||||
|
└── tools # 测试工具代码存放目录
|
||||||
|
```
|
||||||
|
|
||||||
#### 使用说明
|
## 约束<a name="section119744591305"></a>
|
||||||
|
|
||||||
1. xxxx
|
轻量系统用例开发语言是C,小型系统用例开发语言是C++。
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### 参与贡献
|
## 使用说明<a name="section137768191623"></a>
|
||||||
|
|
||||||
1. Fork 本仓库
|
**表 1** 用例级别说明
|
||||||
2. 新建 Feat_xxx 分支
|
|
||||||
3. 提交代码
|
<a name="table12856113719456"></a>
|
||||||
4. 新建 Pull Request
|
<table><thead align="left"><tr id="row88561737114517"><th class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.2.4.1.1"><p id="p54711456452"><a name="p54711456452"></a><a name="p54711456452"></a>级别名称</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.283328332833285%" id="mcps1.2.4.1.2"><p id="p114834544518"><a name="p114834544518"></a><a name="p114834544518"></a>基本定义</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.383338333833386%" id="mcps1.2.4.1.3"><p id="p348154574518"><a name="p348154574518"></a><a name="p348154574518"></a>测试范围</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row78561137134514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p17481345124512"><a name="p17481345124512"></a><a name="p17481345124512"></a>Level0</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p1548945204514"><a name="p1548945204514"></a><a name="p1548945204514"></a>冒烟</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p174824517456"><a name="p174824517456"></a><a name="p174824517456"></a>验证关键功能点基本功能/最基本DFX属性在最常见输入下的表现,通过表示功能基本可运行。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row28563372451"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p448445144512"><a name="p448445144512"></a><a name="p448445144512"></a>Level1</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p44813452452"><a name="p44813452452"></a><a name="p44813452452"></a>基本</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p648184584514"><a name="p648184584514"></a><a name="p648184584514"></a>验证各功能点基本功能/基本DFX属性在常见输入下的表现,通过表示功能基本可测试。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row12856137204514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p164834520453"><a name="p164834520453"></a><a name="p164834520453"></a>Level2</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p148245184511"><a name="p148245184511"></a><a name="p148245184511"></a>重要</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p348945124510"><a name="p348945124510"></a><a name="p348945124510"></a>验证各功能点的基本功能/基本DFX属性在常规输入/常见异常情况下的表现,通过表示功能基本正常可用,可开展Beta。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row48571137204514"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p7481545184513"><a name="p7481545184513"></a><a name="p7481545184513"></a>Level3</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p1748184514455"><a name="p1748184514455"></a><a name="p1748184514455"></a>一般</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p8481245104519"><a name="p8481245104519"></a><a name="p8481245104519"></a>验证各功能点的全部功能/全部DFX属性在各种常规/非常规输入组合下,或各种正常/异常预置条件组合下的表现。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row14857133712451"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.2.4.1.1 "><p id="p1248144515456"><a name="p1248144515456"></a><a name="p1248144515456"></a>Level4</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.283328332833285%" headers="mcps1.2.4.1.2 "><p id="p94804514519"><a name="p94804514519"></a><a name="p94804514519"></a>生僻</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.383338333833386%" headers="mcps1.2.4.1.3 "><p id="p1248445164516"><a name="p1248445164516"></a><a name="p1248445164516"></a>验证关键功能点在极端异常预置条件下、用户难以触及的异常输入组合下的表现。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
**表 2** 用例粒度说明
|
||||||
|
|
||||||
|
<a name="table1690733521014"></a>
|
||||||
|
<table><thead align="left"><tr id="row9907143516105"><th class="cellrowborder" valign="top" width="19.591959195919593%" id="mcps1.2.4.1.1"><p id="p1141312416102"><a name="p1141312416102"></a><a name="p1141312416102"></a>用例规模</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="35.17351735173517%" id="mcps1.2.4.1.2"><p id="p34131416109"><a name="p34131416109"></a><a name="p34131416109"></a>被测试对象</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="45.23452345234523%" id="mcps1.2.4.1.3"><p id="p12413141171010"><a name="p12413141171010"></a><a name="p12413141171010"></a>测试环境</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row2907335181017"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p6414134117109"><a name="p6414134117109"></a><a name="p6414134117109"></a>LargeTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p20414104113101"><a name="p20414104113101"></a><a name="p20414104113101"></a>业务功能/全场景特性/整机及场景级DFX</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p5414841121013"><a name="p5414841121013"></a><a name="p5414841121013"></a>尽量使用贴近真实的环境设备</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row10907635131015"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p19414134117104"><a name="p19414134117104"></a><a name="p19414134117104"></a>MediumTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p114141241141018"><a name="p114141241141018"></a><a name="p114141241141018"></a>模块/子系统集成至设备后的功能/DFX</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p14414941111015"><a name="p14414941111015"></a><a name="p14414941111015"></a>使用真实的单设备进行验证,可进行消息模拟,尽量不对函数进行MOCK</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1990713353100"><td class="cellrowborder" valign="top" width="19.591959195919593%" headers="mcps1.2.4.1.1 "><p id="p641414110109"><a name="p641414110109"></a><a name="p641414110109"></a>SmallTest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="35.17351735173517%" headers="mcps1.2.4.1.2 "><p id="p54141541181018"><a name="p54141541181018"></a><a name="p54141541181018"></a>模块/类/函数</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="45.23452345234523%" headers="mcps1.2.4.1.3 "><p id="p1841494131013"><a name="p1841494131013"></a><a name="p1841494131013"></a>在开发者个人环境进行测试,尽量不依赖其他模块,存在大量的MOCK</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
**表 3** 测试类型说明
|
||||||
|
|
||||||
|
<a name="table18811230124619"></a>
|
||||||
|
<table><thead align="left"><tr id="row48163019466"><th class="cellrowborder" valign="top" width="19.040000000000003%" id="mcps1.2.3.1.1"><p id="p1791784418465"><a name="p1791784418465"></a><a name="p1791784418465"></a>测试类型名称</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="80.96%" id="mcps1.2.3.1.2"><p id="p2917164444614"><a name="p2917164444614"></a><a name="p2917164444614"></a>测试类型定义</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row682630104615"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1091784414469"><a name="p1091784414469"></a><a name="p1091784414469"></a>Function</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p16917344104618"><a name="p16917344104618"></a><a name="p16917344104618"></a>验证被测对象提供给用户的业务功能实现正确性的测试项,这里的“用户”可以是终端用户或开发者,功能包括业务功能及平台功能</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1821930154611"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p591714474612"><a name="p591714474612"></a><a name="p591714474612"></a>Performance</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p15917154410463"><a name="p15917154410463"></a><a name="p15917154410463"></a>验证被测对象在特定预置条件/负载模型下的处理能力的测试项,“处理能力”一般以单位时间内可处理的业务量来衡量,如呼叫/秒,帧率/秒,事件处理量/秒等</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row13821030104616"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p691711440467"><a name="p691711440467"></a><a name="p691711440467"></a>Power</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p159171544104616"><a name="p159171544104616"></a><a name="p159171544104616"></a>验证被测对象在特定预置条件/负载模型下在一定时间内能源消耗量的测试项</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row6821330114618"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p13917164454612"><a name="p13917164454612"></a><a name="p13917164454612"></a>Reliability</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p11917194416465"><a name="p11917194416465"></a><a name="p11917194416465"></a>验证被测对象在正常/异常输入情况下,或业务量压力和长时间连续运行压力情况下业务表现的测试项,含稳定性、压力、故障注入、Monkey测试项</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row11821930184612"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1691774474618"><a name="p1691774474618"></a><a name="p1691774474618"></a>Security</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p1791784410463"><a name="p1791784410463"></a><a name="p1791784410463"></a>验证系统对恶意威胁的防护能力,威胁包括但不限于未授权访问、使用、泄露、破坏、修改、毁灭,以保障信息的机密性、完整性和可用性; 验证系统对用户隐私的保护能力,保障用户的隐私数据被收集、使用、保有、披露和处置符合法律规范,保障用户的隐私权; 验证对各类安全规范的遵从情况,如安全设计规范、安全红线、工信部安全认证规范等,保障安全相关法律法规的合规。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row16825307467"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p129188444462"><a name="p129188444462"></a><a name="p129188444462"></a>Global</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p179186444465"><a name="p179186444465"></a><a name="p179186444465"></a>验证被测对象在是否具有国际化数据支持和本地化能力的测试项,包括语言显示、输入/输出习惯、时间显示、区域特性如货币时间禁忌等等</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row08211308464"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p191814447465"><a name="p191814447465"></a><a name="p191814447465"></a>Compatibility</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p99181344144613"><a name="p99181344144613"></a><a name="p99181344144613"></a>当被测对象为应用时,包括被测对象对于自身数据的后向兼容性、对于系统的前后向兼容性、对于不同用户数据(如播放器之音频文件格式/智能短信之用户短信内容)的兼容性测试项; 当被测对象为系统时,包括被测系统对于系统自身数据的后向兼容性、以及对于生态中常用应用的兼容性测试项;当被测对象为软件时,包括被测系统对于相关的硬件的兼容性;</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1782730124618"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p13918144134614"><a name="p13918144134614"></a><a name="p13918144134614"></a>User</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p1291844494611"><a name="p1291844494611"></a><a name="p1291844494611"></a>验证被测对象在真实用户场景下的用户体验感受的测试项,注意此种情况下没有客观的“正确”与“失败”,所有的结论及评价都应该来自于用户</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row58243024617"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p1291884474614"><a name="p1291884474614"></a><a name="p1291884474614"></a>Standard</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p0918124424614"><a name="p0918124424614"></a><a name="p0918124424614"></a>验证被测对象对于行业及公司内标准/协议/规范的遵从情况的测试项,注意此处的“标准”不包含任何安全标准,针对安全标准的测试项划归为“安全测试”类型</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row382830124619"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p119181044164619"><a name="p119181044164619"></a><a name="p119181044164619"></a>Safety</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p1291818443468"><a name="p1291818443468"></a><a name="p1291818443468"></a>验证被测对象的Safety属性,避免产品可能对人身安全、健康以及产品本身带来的危害。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row1083153014465"><td class="cellrowborder" valign="top" width="19.040000000000003%" headers="mcps1.2.3.1.1 "><p id="p39187441469"><a name="p39187441469"></a><a name="p39187441469"></a>Resilience</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="80.96%" headers="mcps1.2.3.1.2 "><p id="p891815444462"><a name="p891815444462"></a><a name="p891815444462"></a>验证被测对象的韧性属性,确保系统受攻击时承受并保持在有定义的运行状态(包括降级)、恢复并适应攻击以保障Mission达成。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 用例开发指导<a name="section3695134065513"></a>
|
||||||
|
|
||||||
|
根据测试系统选择测试框架和对应测试用例语言。
|
||||||
|
|
||||||
|
**表 4** 系统和测试框架、开发语言对应关系
|
||||||
|
|
||||||
|
<a name="table4418343171415"></a>
|
||||||
|
<table><thead align="left"><tr id="row34183435145"><th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.1"><p id="p941874311148"><a name="p941874311148"></a><a name="p941874311148"></a>系统</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.2"><p id="p1841804341413"><a name="p1841804341413"></a><a name="p1841804341413"></a>测试框架</p>
|
||||||
|
</th>
|
||||||
|
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.3"><p id="p2418104311148"><a name="p2418104311148"></a><a name="p2418104311148"></a>语言</p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody><tr id="row8419164319148"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p7419194312143"><a name="p7419194312143"></a><a name="p7419194312143"></a>轻量系统</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p10419124312145"><a name="p10419124312145"></a><a name="p10419124312145"></a>hctest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p11419643191410"><a name="p11419643191410"></a><a name="p11419643191410"></a>c</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row141915438147"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p441911436141"><a name="p441911436141"></a><a name="p441911436141"></a>小型系统</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p541916432142"><a name="p541916432142"></a><a name="p541916432142"></a>hcpptest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p54191643131416"><a name="p54191643131416"></a><a name="p54191643131416"></a>c++</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="row4419134341417"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p341964313143"><a name="p341964313143"></a><a name="p341964313143"></a>标准系统</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="p10419443171416"><a name="p10419443171416"></a><a name="p10419443171416"></a>HJSUnit、hcpptest</p>
|
||||||
|
</td>
|
||||||
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p9419143181414"><a name="p9419143181414"></a><a name="p9419143181414"></a>js、c++</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### C语言用例开发编译指导(适用于轻量系统产品用例开发)<a name="section198193336544"></a>
|
||||||
|
|
||||||
|
**示例:轻量系统测试用例开发**
|
||||||
|
|
||||||
|
当前使用的测试框架是hctest,hctest测试框架支持使用C语言编写测试用例,是在开源测试框架unity的基础上进行增强和适配。
|
||||||
|
|
||||||
|
1. 用例目录规范:测试用例存储到test/xts/hats仓中
|
||||||
|
|
||||||
|
```
|
||||||
|
├── hats
|
||||||
|
│ └──subsystem_lite
|
||||||
|
│ │ └── module_hal
|
||||||
|
│ │ │ └── BUILD.gn
|
||||||
|
│ │ │ └── src
|
||||||
|
│ └──build_lite
|
||||||
|
│ │ └── BUILD.gn
|
||||||
|
```
|
||||||
|
|
||||||
|
2. src目录下用例编写样例。
|
||||||
|
|
||||||
|
1.引用测试框架
|
||||||
|
|
||||||
|
```
|
||||||
|
#include "hctest.h"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 使用宏定义LITE\_TEST\_SUIT定义子系统、模块、测试套件名称
|
||||||
|
|
||||||
|
```
|
||||||
|
/**
|
||||||
|
* @brief register a test suit named "IntTestSuite"
|
||||||
|
* @param test subsystem name
|
||||||
|
* @param example module name
|
||||||
|
* @param IntTestSuite test suit name
|
||||||
|
*/
|
||||||
|
LITE_TEST_SUIT(test, example, IntTestSuite);
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 定义Setup与TearDown
|
||||||
|
|
||||||
|
命名方式:测试套件名称+Setup,测试套件名称+TearDown。
|
||||||
|
|
||||||
|
Setup与TearDown必须存在,可以为空函数。
|
||||||
|
|
||||||
|
4. 使用宏定义LITE\_TEST\_CASE写测试用例
|
||||||
|
|
||||||
|
包括三个参数:测试套件名称,测试用例名称,用例属性(测试类型、用例粒度、用例级别)。
|
||||||
|
|
||||||
|
```
|
||||||
|
LITE_TEST_CASE(IntTestSuite, TestCase001, Function | MediumTest | Level1)
|
||||||
|
{
|
||||||
|
//do something
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 使用宏定义 RUN\_TEST\_SUITE注册测试套件
|
||||||
|
|
||||||
|
```
|
||||||
|
RUN_TEST_SUITE(IntTestSuite);
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 测试模块的配置文件(BUILD.gn)样例:
|
||||||
|
|
||||||
|
在每个测试模块目录下新建BUILD.gn编译文件,用于指定编译后静态库的名称、依赖的头文件、依赖的库等;具体写法如下:
|
||||||
|
|
||||||
|
```
|
||||||
|
import("//test/xts/tools/lite/build/suite_lite.gni")
|
||||||
|
hctest_suite("HatsDemoTest") {
|
||||||
|
suite_name = "hats"
|
||||||
|
sources = [
|
||||||
|
"src/test_demo.c",
|
||||||
|
]
|
||||||
|
include_dirs = [ ]
|
||||||
|
cflags = [ "-Wno-error" ]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. hats下BUILD.gn增加编译选项。
|
||||||
|
|
||||||
|
需要将测试模块加入到hats目录下的编译脚本中,编译脚本路径:test/xts/hats/build\_lite/BUILD.gn。
|
||||||
|
|
||||||
|
```
|
||||||
|
lite_component("hats") {
|
||||||
|
...
|
||||||
|
if(board_name == "liteos_m") {
|
||||||
|
features += [
|
||||||
|
...
|
||||||
|
"//xts/hats/subsystem_lite/module_hal:HatsDemoTest"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 测试套件编译命令。
|
||||||
|
|
||||||
|
随版本编译,debug版本编译时会同步编译hats测试套件
|
||||||
|
|
||||||
|
>![](figures/icon-note.gif) **说明:**
|
||||||
|
>hats测试套件编译中间件为静态库,最终链接到版本镜像中 。
|
||||||
|
|
||||||
|
|
||||||
#### 特技
|
### C语言用例执行指导(适用于轻量系统产品用例开发)<a name="section13820233175418"></a>
|
||||||
|
|
||||||
|
**示例:轻量系统测试用例执行**
|
||||||
|
|
||||||
|
将版本镜像烧录进开发板。
|
||||||
|
|
||||||
|
**测试步骤**
|
||||||
|
|
||||||
|
1. 使用串口工具登录开发板,并保存串口打印信息。
|
||||||
|
2. 重启设备,查看串口日志。
|
||||||
|
|
||||||
|
**测试结果分析指导**
|
||||||
|
|
||||||
|
基于串口打印日志进行分析;
|
||||||
|
|
||||||
|
每个测试套件执行以Start to run test suite开始,以xx Tests xx Failures xx Ignored结束。
|
||||||
|
|
||||||
|
### C++语言用例开发编译指导(适用于小型系统、标准系统用例开发)<a name="section3822123311540"></a>
|
||||||
|
|
||||||
|
**示例:小型系统测试用例开发**(标准系统参考具体样例目录:global/i18n\_standard)
|
||||||
|
|
||||||
|
当前使用的测试框架是hcpptest,hcpptest测试框架是在开源的googletest测试框架的基础上进行的增强和适配。
|
||||||
|
|
||||||
|
1. 规范用例目录:测试用例存储到test/xts/hats仓中。
|
||||||
|
|
||||||
|
```
|
||||||
|
├── hats
|
||||||
|
│ └──subsystem_lite
|
||||||
|
│ │ └── module_posix
|
||||||
|
│ │ │ └── BUILD.gn
|
||||||
|
│ │ │ └── src
|
||||||
|
│ └──build_lite
|
||||||
|
│ │ └── BUILD.gn
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 测试模块src下用例编写样例:
|
||||||
|
|
||||||
|
1. 引用测试框架:
|
||||||
|
|
||||||
|
需要引用gtest.h 如:\#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
```
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 定义Setup与TearDown
|
||||||
|
|
||||||
|
```
|
||||||
|
using namespace std;
|
||||||
|
using namespace testing::ext;
|
||||||
|
class TestSuite: public testing::Test {
|
||||||
|
protected:
|
||||||
|
// Preset action of the test suite, which is executed before the first test case
|
||||||
|
static void SetUpTestCase(void){
|
||||||
|
}
|
||||||
|
// Test suite cleanup action, which is executed after the last test case
|
||||||
|
static void TearDownTestCase(void){
|
||||||
|
}
|
||||||
|
// Preset action of the test case
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
// Cleanup action of the test case
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 使用宏定义HWTEST或HWTEST\_F写测试用例
|
||||||
|
|
||||||
|
普通测试用例的定义:HWTEST(测试套名称, 测试用例名称, 用例标注)。
|
||||||
|
|
||||||
|
包含SetUp和TearDown的测试用例的定义 :HWTEST\_F(测试套名称, 测试用例名称,用例标注)。
|
||||||
|
|
||||||
|
宏定义包括三个参数:测试套件名称,测试用例名称,用例属性(测试类型、用例粒度、用例级别)。
|
||||||
|
|
||||||
|
```
|
||||||
|
HWTEST_F(TestSuite, TestCase_0001, Function | MediumTest | Level1) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 测试模块下用例配置文件(BUILD.gn)样例:
|
||||||
|
|
||||||
|
每个测试模块目录下新建BUILD.gn编译文件,用于指定编译后可执行文件的名称、依赖的头文件、依赖的库等;具体写法如下。每个测试模块将独立编译成.bin可执行文件, 该文件可直接push到单板上进行测试。
|
||||||
|
|
||||||
|
举例:
|
||||||
|
|
||||||
|
```
|
||||||
|
import("//test/xts/tools/lite/build/suite_lite.gni")
|
||||||
|
hcpptest_suite("HatsDemoTest") {
|
||||||
|
suite_name = "hats"
|
||||||
|
sources = [
|
||||||
|
"src/TestDemo.cpp"
|
||||||
|
]
|
||||||
|
|
||||||
|
include_dirs = [
|
||||||
|
"src",
|
||||||
|
...
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
...
|
||||||
|
]
|
||||||
|
cflags = [ "-Wno-error" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
4. hats目录下增加编译选项(BUILD.gn)样例:
|
||||||
|
|
||||||
|
将测试模块加入到hats目录下的编译脚本中,编译脚本为:test/xts/hats/build\_lite/BUILD.gn。
|
||||||
|
|
||||||
|
```
|
||||||
|
lite_component("hats") {
|
||||||
|
...
|
||||||
|
else if(board_name == "liteos_a") {
|
||||||
|
features += [
|
||||||
|
...
|
||||||
|
"//xts/hats/subsystem_lite/module_posix:HatsDemoTest"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 测试套件编译命令。
|
||||||
|
|
||||||
|
随版本编译,debug版本编译时会同步编译hats测试套件
|
||||||
|
|
||||||
|
>![](figures/icon-note.gif) **说明:**
|
||||||
|
>小型系统hats独立编译成可执行文件(bin格式), 在编译产物的suites\\hats目录下归档。
|
||||||
|
|
||||||
|
|
||||||
|
### C++语言用例执行指导(适用于小型系统、标准系统用例开发)<a name="section128222336544"></a>
|
||||||
|
|
||||||
|
**示例:小型系统测试用例执行**
|
||||||
|
|
||||||
|
目前的用例执行采用nfs共享的方式,mount到单板去执行。
|
||||||
|
|
||||||
|
**环境搭建**
|
||||||
|
|
||||||
|
1. 使用网线或无线网络将开发板与PC进行连接。
|
||||||
|
2. 开发板配置IP、子网掩码、网关,确保开发板与PC处于同一个网段。
|
||||||
|
3. PC安装nfs服务器并完成注册,启动nfs服务。
|
||||||
|
4. 开发板配置mount命令,确保开发板可以访问PC端的nfs共享文件。
|
||||||
|
|
||||||
|
格式:mount \[nfs服务器IP\]:\[/nfs共享目录\] \[/开发板目录\] nfs
|
||||||
|
|
||||||
|
举例:
|
||||||
|
|
||||||
|
```
|
||||||
|
mount 192.168.1.10:/nfs /nfs nfs
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**用例执行**
|
||||||
|
|
||||||
|
测试套件执行 HatsDemoTest.bin 触发用例执行,基于串口打印日志进行分析。
|
||||||
|
|
||||||
|
### 全量编译指导(适用于标准系统)<a name="section128222336544"></a>
|
||||||
|
|
||||||
|
全量编译test/xts/hats目录下执行编译命令: ./build.sh suite=hats system_size=standard
|
||||||
|
|
||||||
|
测试用例输出目录:out/release/suites/hats/testcases
|
||||||
|
|
||||||
|
测试框架&用例整体输出目录:out/release/suites/hats(编译用例时会同步编译测试套执行框架)
|
||||||
|
|
||||||
|
### 全量用例执行指导(适用于小型系统、标准系统)<a name="section128222336544"></a>
|
||||||
|
|
||||||
|
搭建测试环境 Windows工作台下安装python3.7及以上版本,确保工作台和测试设备正常连接。
|
||||||
|
|
||||||
|
测试执行目录(对应编译生成的out/release/suites/hats目录)
|
||||||
|
|
||||||
|
```
|
||||||
|
├── testcase # 测试套文件存放目录
|
||||||
|
│ └──xxx.hap # 测试套可执行hap文件
|
||||||
|
│ └──xxx.json # 测试套对应执行配置文件
|
||||||
|
├── tools # 测试框架工具目录
|
||||||
|
├── run.bat # window平台测试套启动执行文件
|
||||||
|
├── report # 测试报告生成目录
|
||||||
|
|
||||||
|
```
|
||||||
|
用例执行
|
||||||
|
|
||||||
|
在Windows工作台上,找到从Linux服务器上拷贝下来的测试套件用例目录,在Windows命令窗口进入对应目录,直接执行hats\run.bat。
|
||||||
|
|
||||||
|
界面启动后,输入用例执行指令。
|
||||||
|
|
||||||
|
全量执行:run hats
|
||||||
|
|
||||||
|
模块执行(具体模块可以查看\hats\testcases):run –l ActsSamgrTest
|
||||||
|
|
||||||
|
查看测试报告。 进入hats\reports\,获取当前的执行记录,打开“summary_report.html”可以获取到测试报告。
|
||||||
|
|
||||||
|
|
||||||
|
## 相关仓<a name="section1371113476307"></a>
|
||||||
|
|
||||||
|
xts\_hats
|
||||||
|
|
||||||
|
xts\_tools
|
||||||
|
|
||||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
|
||||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
|
||||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
||||||
|
119
build.sh
Executable file
119
build.sh
Executable file
@ -0,0 +1,119 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo
|
||||||
|
echo "USAGE"
|
||||||
|
echo " ./build.sh [suite=BUILD_TARGET] [target_os=TARGET_OS] [target_arch=TARGET_ARCH] [variant=BUILD_VARIANT] [target_subsystem=TARGET_SUBSYSTEM]"
|
||||||
|
echo " target_platform : TARGET_PLATFORM the target platform, such as phone or ivi; Default to phone"
|
||||||
|
echo " suite : BUILD_TARGET cts/hit/vts and so on, default value is hit"
|
||||||
|
echo " target_arch : TARGET_ARCH arm64 or arm32, default value is arm64"
|
||||||
|
echo " variant : BUILD_VARIANT release or debug, default value is debug"
|
||||||
|
echo " target_subsystem : TARGET_SUBSYSTEM the target subsystem to build"
|
||||||
|
echo " system_size : SYSTEM_SIZE standard, large and son on, large is for L3-L5, standard is for L2 default value is large"
|
||||||
|
echo " product_name : PRODUCT_NAME the name of product. such as hikey960, Hi3516DV300, and so on."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parse_cmdline()
|
||||||
|
{
|
||||||
|
BASE_HOME=$(dirname $(cd $(dirname $0); pwd))
|
||||||
|
BASE_HOME=${BASE_HOME}/../..
|
||||||
|
BUILD_TOOLS_DIR=${BASE_HOME}/prebuilts/build-tools/linux-x86/bin
|
||||||
|
OUT_DIR=${BASE_HOME}/out
|
||||||
|
BUILD_SHELL=${BASE_HOME}/build.sh
|
||||||
|
# build all parts for all products by default
|
||||||
|
BUILD_TARGET=""
|
||||||
|
TARGET_PLATFORM=all
|
||||||
|
GN_ARGS="is_dbt_test=true include_all=false"
|
||||||
|
TARGET_ARCH=arm64
|
||||||
|
BUILD_VARIANT=release
|
||||||
|
UPLOAD_API_INFO=False
|
||||||
|
SYSTEM_SIZE=large
|
||||||
|
PRODUCT_NAME=""
|
||||||
|
export PATH=${BASE_HOME}/prebuilts/python/linux-x86/3.8.3/bin:$PATH
|
||||||
|
|
||||||
|
while [ -n "$1" ]
|
||||||
|
do
|
||||||
|
var="$1"
|
||||||
|
OPTIONS=${var%%=*}
|
||||||
|
PARAM=${var#*=}
|
||||||
|
echo "OPTIONS=$OPTIONS"
|
||||||
|
echo "PARAM=$PARAM"
|
||||||
|
echo "-------------------"
|
||||||
|
case "$OPTIONS" in
|
||||||
|
suite) BUILD_TARGET="$PARAM"
|
||||||
|
;;
|
||||||
|
target_arch) TARGET_ARCH="$PARAM"
|
||||||
|
;;
|
||||||
|
variant) BUILD_VARIANT="$PARAM"
|
||||||
|
;;
|
||||||
|
target_platform) TARGET_PLATFORM="$PARAM"
|
||||||
|
;;
|
||||||
|
target_subsystem) export target_subsystem=${PARAM}
|
||||||
|
;;
|
||||||
|
system_size) SYSTEM_SIZE="$PARAM"
|
||||||
|
;;
|
||||||
|
product_name) PRODUCT_NAME="$PARAM"
|
||||||
|
;;
|
||||||
|
upload_api_info) UPLOAD_API_INFO=$(echo $PARAM |tr [a-z] [A-Z])
|
||||||
|
;;
|
||||||
|
*) usage
|
||||||
|
break;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if [ "$SYSTEM_SIZE" = "standard" ]; then
|
||||||
|
BUILD_TARGET=${BUILD_TARGET:-"dcts"}
|
||||||
|
PRODUCT_NAME=${PRODUCT_NAME:-"Hi3516DV300"}
|
||||||
|
else
|
||||||
|
BUILD_TARGET=${BUILD_TARGET:-"dcts dcts_ivi dcts_intellitv dcts_wearable"}
|
||||||
|
PRODUCT_NAME=${PRODUCT_NAME:-"arm64"}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
do_make()
|
||||||
|
{
|
||||||
|
cd $BASE_HOME
|
||||||
|
HATS_ROOT="$BASE_HOME/test/xts/dcts"
|
||||||
|
|
||||||
|
rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
|
||||||
|
export XTS_SUITENAME=dcts
|
||||||
|
if [ "$SYSTEM_SIZE" = "standard" ]; then
|
||||||
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools" --gn-args is_standard_system=true
|
||||||
|
else
|
||||||
|
if [ "$BUILD_TARGET" = "dcts dcts_ivi dcts_intellitv dcts_wearable" ]; then
|
||||||
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target "dcts" --build-target "dcts_ivi" --build-target "dcts_intellitv" --build-target "dcts_wearable" --build-target "deploy_testtools"
|
||||||
|
else
|
||||||
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
|
||||||
|
if [ "$ret" != 0 ]; then
|
||||||
|
echo "build error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
parse_cmdline $@
|
||||||
|
do_make
|
||||||
|
exit 0
|
177
common/shm_utils.cpp
Normal file
177
common/shm_utils.cpp
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shm_utils.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <cstring>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static void *shm = NULL; //分配的共享内存的原始首地址
|
||||||
|
static struct shared_use_st *shared; //指向shm
|
||||||
|
static int shmid; //共享内存标识符
|
||||||
|
|
||||||
|
int createShm(int key)
|
||||||
|
{
|
||||||
|
//创建共享内存
|
||||||
|
shmid = shmget((key_t)key,sizeof(struct shared_use_st), 0666|IPC_CREAT);
|
||||||
|
if(shmid == -1)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
//将共享内存连接到当前进程的地址空间
|
||||||
|
shm = shmat(shmid,NULL,0);
|
||||||
|
if(shm == (void*)-1)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared = (struct shared_use_st*)shm;
|
||||||
|
initShm();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initShm(void)
|
||||||
|
{
|
||||||
|
memset_s(shm, sizeof(struct shared_use_st), 0, sizeof(struct shared_use_st));
|
||||||
|
shared->written = 0;
|
||||||
|
memset_s(shared->data, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int readDataFromShm(char* buf)
|
||||||
|
{
|
||||||
|
//LOG("readDataFormShm, begin");
|
||||||
|
if(shared->written !=0)
|
||||||
|
{
|
||||||
|
strcpy_s(buf , strlen(shared->data)+1, shared->data);
|
||||||
|
shared->written = 0;
|
||||||
|
LOG("readDataFromShm %s",buf);
|
||||||
|
memset_s(shared->data, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int waitDataWithCode(char* code, char* data)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
int timeout = 10;
|
||||||
|
char str[1024] = {0};
|
||||||
|
memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
|
||||||
|
while(i<timeout)
|
||||||
|
{
|
||||||
|
if(readDataFromShm(str) ==0)
|
||||||
|
{
|
||||||
|
if(strncmp(code, str, 4) == 0)
|
||||||
|
{
|
||||||
|
//char* pNext = (char*)strtok(str,":");
|
||||||
|
strncpy(data,str+5,1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int writeCodeDataToShm(int code, char*buf)
|
||||||
|
{
|
||||||
|
char str[1024] = {0};
|
||||||
|
memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
|
||||||
|
char codeStr[5] = {0};
|
||||||
|
memset_s(codeStr, 5, 0, 5);
|
||||||
|
Int2String(code, codeStr);
|
||||||
|
strcpy_s(str, strlen(codeStr)+1, codeStr);
|
||||||
|
strcat(str, ":");
|
||||||
|
strcat(str, buf);
|
||||||
|
writeDataToShm(str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int writeDataToShm(char* buf)
|
||||||
|
{
|
||||||
|
LOG("writeDataToShm, begin");
|
||||||
|
while(shared->written == 1)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG("writeDataToShm %s", buf);
|
||||||
|
memset_s(shared->data, 5, 0, 5);
|
||||||
|
strcpy_s(shared->data, strlen(buf)+1, buf);
|
||||||
|
shared->written = 1;
|
||||||
|
sleep(2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int disconnectShm(void)
|
||||||
|
{
|
||||||
|
if(shmdt(shm) ==-1)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int deleteShm(void)
|
||||||
|
{
|
||||||
|
if(shmctl(shmid, IPC_RMID, 0) == -1)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char* Int2String(int num,char *str)//10进制
|
||||||
|
{
|
||||||
|
int i = 0;//指示填充str
|
||||||
|
if (num<0)//如果num为负数,将num变正
|
||||||
|
{
|
||||||
|
num = -num;
|
||||||
|
str[i++] = '-';
|
||||||
|
}
|
||||||
|
//转换
|
||||||
|
do
|
||||||
|
{
|
||||||
|
str[i++] = num%10+48;//取num最低位 字符0~9的ASCII码是48~57:简单来说数字0+48=48,ASCII码对应字符'0'
|
||||||
|
num /=10;//去掉最低位
|
||||||
|
}while(num);//num不为0继续循环
|
||||||
|
|
||||||
|
str[i] = '\0';
|
||||||
|
|
||||||
|
//确定开始调整的位置
|
||||||
|
int j = 0;
|
||||||
|
if(str[0]=='-')//如果有负号,负号不用调整
|
||||||
|
{
|
||||||
|
j = 1;//从第二位开始调整
|
||||||
|
++i;//由于有负号,所以交换的对称轴也要后移一位
|
||||||
|
}
|
||||||
|
//对称交换
|
||||||
|
for(;j<i/2;j++)
|
||||||
|
{
|
||||||
|
//对称交换两端的值 其实就是省下中间变量交换a+b的值:a=a+b;b=a-b;a=a-b;
|
||||||
|
str[j] = str[j] + str[i-1-j];
|
||||||
|
str[i-1-j] = str[j] - str[i-1-j];
|
||||||
|
str[j] = str[j] - str[i-1-j];
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;//返回转换后的值
|
||||||
|
}
|
69
common/shm_utils.h
Normal file
69
common/shm_utils.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHM_UTILS_H
|
||||||
|
#define SHM_UTILS_H
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <securec.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
|
||||||
|
#define MAX_DATA_LENGTH 1024
|
||||||
|
#define MAX_WAIT_TIMEOUT 10
|
||||||
|
#define SHM_SEND_KEY 123456
|
||||||
|
#define SHM_RECV_KEY 123466
|
||||||
|
|
||||||
|
struct shared_use_st
|
||||||
|
{
|
||||||
|
int written;//作为一个标志,非0:表示可读,0表示可写
|
||||||
|
char data[MAX_DATA_LENGTH];//记录写入和读取的文本
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LOG(format, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
time_t timeSec; \
|
||||||
|
time(&timeSec); \
|
||||||
|
struct tm tmRst; \
|
||||||
|
localtime_r(&timeSec, &tmRst); \
|
||||||
|
char strTime[10]; \
|
||||||
|
strftime(strTime, sizeof(strTime), "%H:%M:%S", &tmRst); \
|
||||||
|
fprintf(stdout, "[shm-utils] %s " format "\n",strTime, ##__VA_ARGS__); \
|
||||||
|
FILE* fp; \
|
||||||
|
fp = fopen("/data/disTestSuiteLog" , "a+"); \
|
||||||
|
fprintf(fp, "[shm-utils] %s " format "\n",strTime, ##__VA_ARGS__); \
|
||||||
|
fclose(fp); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
int createShm(int key);
|
||||||
|
int disconnectShm(void);
|
||||||
|
int writeCodeDataToShm(int code, char* buf);
|
||||||
|
int waitDataWithCode(char* code, char* data);
|
||||||
|
int writeDataToShm(char* buf);
|
||||||
|
int deleteShm(void);
|
||||||
|
char* Int2String(int num,char *str);
|
||||||
|
void initShm(void);
|
||||||
|
int readDataFromShm(char* buf);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
68
distributeddatamgr/BUILD.gn
Normal file
68
distributeddatamgr/BUILD.gn
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# 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.
|
||||||
|
import("//build/ohos_var.gni")
|
||||||
|
group("distributeddatatest") {
|
||||||
|
testonly = true
|
||||||
|
if (is_standard_system) {
|
||||||
|
deps = [
|
||||||
|
"distributed_kv_store:disDataTest",
|
||||||
|
":disDataProcess",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_library("disDataProcess") {
|
||||||
|
#module_out_path = module_output_path
|
||||||
|
#
|
||||||
|
sources = [
|
||||||
|
"./process_common/process_msg.cpp",
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
visibility = [ ":*" ]
|
||||||
|
|
||||||
|
include_dirs = [
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/src",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/permission",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/account",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/broadcaster",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/utils",
|
||||||
|
"//utils/native/base/include",
|
||||||
|
"//utils/system/safwk/native/ include",
|
||||||
|
"../include",
|
||||||
|
"../../../../interfaces/innerkits/distributeddata",
|
||||||
|
"//third_party/json/single_include",
|
||||||
|
"//base/powermgr/power_manager/interfaces/innerkits/native/include",
|
||||||
|
"../../common",
|
||||||
|
"../common",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata:distributeddata_inner",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter:distributeddata_adapter",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/libs/distributeddb:distributeddb",
|
||||||
|
"//utils/native/base:utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
# external_deps = [
|
||||||
|
# "hiviewdfx_hilog_native:libhilog",
|
||||||
|
# "ipc:ipc_core",
|
||||||
|
# "permission_standard:libpermissionsdk_standard",
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# subsystem_name = "distributeddatamgr"
|
||||||
|
}
|
||||||
|
|
63
distributeddatamgr/distributed_kv_store/BUILD.gn
Normal file
63
distributeddatamgr/distributed_kv_store/BUILD.gn
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# 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.
|
||||||
|
import("//test/xts/tools/build/suite.gni")
|
||||||
|
|
||||||
|
module_output_path = "dcts/distributeddatamgr"
|
||||||
|
|
||||||
|
###############################################################################################
|
||||||
|
config("module_private_config") {
|
||||||
|
visibility = [ ":*" ]
|
||||||
|
include_dirs = [
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/src",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/permission",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/account",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/broadcaster",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/utils",
|
||||||
|
"//utils/native/base/include",
|
||||||
|
"//utils/system/safwk/native/ include",
|
||||||
|
"../include",
|
||||||
|
"../../../../interfaces/innerkits/distributeddata",
|
||||||
|
"//third_party/json/single_include",
|
||||||
|
"//base/powermgr/power_manager/interfaces/innerkits/native/include",
|
||||||
|
"../../common",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
ohos_moduletest_suite("disDataTest") {
|
||||||
|
module_out_path = module_output_path
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"./disdata_func_test.cpp",
|
||||||
|
"../../common/shm_utils.cpp",
|
||||||
|
]
|
||||||
|
|
||||||
|
configs = [ ":module_private_config" ]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata:distributeddata_inner",
|
||||||
|
"//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter:distributeddata_adapter",
|
||||||
|
"//third_party/googletest:gtest_main",
|
||||||
|
"//utils/native/base:utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
external_deps = [
|
||||||
|
"hiviewdfx_hilog_native:libhilog",
|
||||||
|
"ipc:ipc_core",
|
||||||
|
"permission_standard:libpermissionsdk_standard",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
###########################################################################################
|
18
distributeddatamgr/distributed_kv_store/Test.json
Normal file
18
distributeddatamgr/distributed_kv_store/Test.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"kits":[
|
||||||
|
{
|
||||||
|
"push":[
|
||||||
|
"disDataTest->/data/local/tmp/disDataTest"
|
||||||
|
],
|
||||||
|
"type":"PushKit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"driver":{
|
||||||
|
"native-test-timeout":"120000",
|
||||||
|
"type":"CppTest",
|
||||||
|
"module-name":"disDataTest",
|
||||||
|
"runtime-hint":"1s",
|
||||||
|
"native-test-device-path":"/data/local/tmp"
|
||||||
|
},
|
||||||
|
"description":"Configuration for disDataTest Tests"
|
||||||
|
}
|
3159
distributeddatamgr/distributed_kv_store/disdata_func_test.cpp
Normal file
3159
distributeddatamgr/distributed_kv_store/disdata_func_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
506
distributeddatamgr/process_common/process_msg.cpp
Normal file
506
distributeddatamgr/process_common/process_msg.cpp
Normal file
@ -0,0 +1,506 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "process_msg.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iostream>
|
||||||
|
#include "types.h"
|
||||||
|
#include "distributed_kv_data_manager.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include<sstream> // 使用stringstream
|
||||||
|
#include <string.h>
|
||||||
|
#include <cstring>
|
||||||
|
#include <securec.h>
|
||||||
|
using namespace OHOS::DistributedKv;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class DisKvTest {
|
||||||
|
public:
|
||||||
|
static DistributedKvDataManager manager;
|
||||||
|
static std::shared_ptr<SingleKvStore> KvStorePtr; // declare kvstore instance.
|
||||||
|
static Status statusGetKvStore;
|
||||||
|
static Status statusCloseKvStore;
|
||||||
|
static Status statusDeleteKvStore;
|
||||||
|
static Options create;
|
||||||
|
static UserId userId;
|
||||||
|
static AppId appId;
|
||||||
|
static StoreId storeIdTest;
|
||||||
|
};
|
||||||
|
|
||||||
|
DistributedKvDataManager DisKvTest::manager;
|
||||||
|
std::shared_ptr<SingleKvStore> DisKvTest::KvStorePtr = nullptr; // declare kvstore instance.
|
||||||
|
Status DisKvTest::statusGetKvStore = Status::ERROR;
|
||||||
|
Status DisKvTest::statusCloseKvStore = Status::ERROR;
|
||||||
|
Status DisKvTest::statusDeleteKvStore = Status::ERROR;
|
||||||
|
UserId DisKvTest::userId;
|
||||||
|
AppId DisKvTest::appId;
|
||||||
|
StoreId DisKvTest::storeIdTest;
|
||||||
|
|
||||||
|
void initKvstoreId()
|
||||||
|
{
|
||||||
|
DisKvTest::userId.userId = "account0";
|
||||||
|
DisKvTest::appId.appId = "com.ohos.kvdatamanager3.test";
|
||||||
|
DisKvTest::storeIdTest.storeId = "test3";
|
||||||
|
|
||||||
|
//1.创建数据库
|
||||||
|
Options options {
|
||||||
|
.createIfMissing = true,
|
||||||
|
.encrypt = false, // .persistant = true,
|
||||||
|
.autoSync = false,
|
||||||
|
.backup = false,
|
||||||
|
.kvStoreType = KvStoreType::SINGLE_VERSION
|
||||||
|
};
|
||||||
|
|
||||||
|
DisKvTest::statusGetKvStore = DisKvTest::manager.GetSingleKvStore(options, { DisKvTest::appId }, { DisKvTest::storeIdTest }, DisKvTest::KvStorePtr);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char* getRealData(char* str, char* delims)
|
||||||
|
{
|
||||||
|
char *result = strtok( str, delims );
|
||||||
|
char *second = NULL;
|
||||||
|
// result = strtok( str, delims );
|
||||||
|
while( result != NULL ) {
|
||||||
|
//printf( "result is \"%s\"\n", result );
|
||||||
|
second = result;
|
||||||
|
result = strtok( NULL,delims );
|
||||||
|
}
|
||||||
|
return second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void getParam(char* putData, char ret[] [MAX_DATA_LENGTH])
|
||||||
|
{
|
||||||
|
char str[1024] = {":"};
|
||||||
|
memset_s(str,1024,0,1024);
|
||||||
|
strcpy_s(str, strlen(putData)+1, putData);
|
||||||
|
char delims[2] = {":"};
|
||||||
|
//memset_s(delims,0,2);
|
||||||
|
//strcpy_s(delims,strlen()+1, ":");
|
||||||
|
|
||||||
|
char *result = strtok( str, delims );
|
||||||
|
//char *second = NULL;
|
||||||
|
// result = strtok( str, delims );
|
||||||
|
int i = 0;
|
||||||
|
while( result != NULL ) {
|
||||||
|
printf( "result is \"%s\"\n", result);
|
||||||
|
strcpy_s(ret[i], strlen(result)+1, result);
|
||||||
|
//second = result;
|
||||||
|
result = strtok( NULL, delims );
|
||||||
|
i++;
|
||||||
|
// printf("i= %d", i);
|
||||||
|
if(i==3)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int str2int(char *str, int base) {
|
||||||
|
char sign;
|
||||||
|
int rv = 0;
|
||||||
|
int newbase = -1;
|
||||||
|
|
||||||
|
if ((base < 2 && base !=0) || base > 36)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
//跳过str开头的空白字符
|
||||||
|
while(*str && isspace(*str))
|
||||||
|
str++;
|
||||||
|
|
||||||
|
//取得符号位
|
||||||
|
sign = (*str == '-' || *str == '+') ? *str++ : '+';
|
||||||
|
|
||||||
|
//猜测需要转换的类型
|
||||||
|
if (*str == '0' && ++str) {
|
||||||
|
if ((*str == 'x' || *str == 'X') && ++str) {
|
||||||
|
newbase = 16;
|
||||||
|
} else if ((*str == 'b' || *str == 'B') &&++str) {
|
||||||
|
newbase = 2;
|
||||||
|
} else {
|
||||||
|
newbase = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//默认10进制
|
||||||
|
if (base == 0) {
|
||||||
|
base = newbase == -1 ? 10 : newbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;*str; str++) {
|
||||||
|
//大写转小写
|
||||||
|
char c = *str | 0x20;
|
||||||
|
if (c >= 'a' && c<= 'z') {
|
||||||
|
rv = rv * base + c - 'a' + 10;
|
||||||
|
} else if (c >= '0' && c <= '9') {
|
||||||
|
rv = rv * base + c - '0';
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//printf("rv = %d\n", rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sign == '-' ? -rv : rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessSoftBus(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessDataMgr(int code, char* recvData)
|
||||||
|
{
|
||||||
|
LOG("ProcessDataMgr, begin");
|
||||||
|
|
||||||
|
initKvstoreId();
|
||||||
|
std::cout << "create status=" << static_cast<int>(DisKvTest::statusGetKvStore) << std::endl;
|
||||||
|
if ( Status::SUCCESS != DisKvTest::statusGetKvStore)
|
||||||
|
{
|
||||||
|
std::cout << "ERR:statusGetKvStore"<< std::endl;
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(code)
|
||||||
|
{
|
||||||
|
case CTRL_CODE_DATAMGR_GET_DATA:
|
||||||
|
{
|
||||||
|
return processGetData(recvData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CTRL_CODE_DATAMGR_GET_DATA_REPLY:
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CTRL_CODE_DATAMGR_CREATE_KV:
|
||||||
|
{
|
||||||
|
return processCreateKv(recvData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CTRL_CODE_DATAMGR_DELETE_KV:
|
||||||
|
{
|
||||||
|
return processDeleteKv(recvData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CTRL_CODE_DATAMGR_PUT_DATA:
|
||||||
|
{
|
||||||
|
return processPutData(recvData);
|
||||||
|
}
|
||||||
|
case CTRL_CODE_DATAMGR_DELETE_DATA:
|
||||||
|
{
|
||||||
|
return processDeletetData(recvData);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int processDeletetData(char* putData)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest---processDeletetData, begin");
|
||||||
|
//解析远端发来的数据 result[0]=code result[1]=key result[2]=value
|
||||||
|
char result[5][MAX_DATA_LENGTH];
|
||||||
|
memset_s(result,5*MAX_DATA_LENGTH,0,5*MAX_DATA_LENGTH);
|
||||||
|
getParam(putData, result);
|
||||||
|
for(int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest---processGetData %s", result[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//put data删除数据
|
||||||
|
Value valueInt;
|
||||||
|
Key keyInt=result[1];
|
||||||
|
Status status = DisKvTest::KvStorePtr->Delete(keyInt);
|
||||||
|
if (Status::SUCCESS == status )
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest---Delete:RESULT_OK");
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
LOG("LOGdisDataTest---Delete:RESULT_ERR");
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int processPutData(char* putData)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest-processPutData, begin");
|
||||||
|
//解析远端发来的数据 result[0]=code result[1]=key result[2]=value
|
||||||
|
char result[3][MAX_DATA_LENGTH];
|
||||||
|
memset_s(result,3*MAX_DATA_LENGTH,0,3*MAX_DATA_LENGTH);
|
||||||
|
getParam(putData, result);
|
||||||
|
for(int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest-processPutData %s", result[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//put data修改数据
|
||||||
|
Value valueInt;
|
||||||
|
Key keyInt=result[1];
|
||||||
|
if(strcmp(result[1], "math_score_int") == 0)
|
||||||
|
{
|
||||||
|
int numInt = atoi(result[2]);
|
||||||
|
valueInt = Value(TransferTypeToByteArray<int>(numInt));
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_float") == 0)
|
||||||
|
{
|
||||||
|
float f2 = atof(result[2]);
|
||||||
|
valueInt = Value(TransferTypeToByteArray<float>(f2));
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_double") == 0)
|
||||||
|
{
|
||||||
|
double f2 = atof(result[2]);
|
||||||
|
valueInt = Value(TransferTypeToByteArray<double>(f2));
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_int64_t") == 0)
|
||||||
|
{
|
||||||
|
int64_t numInt = atoi(result[2]);
|
||||||
|
valueInt = Value(TransferTypeToByteArray<int64_t>(numInt));
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_size_t") == 0)
|
||||||
|
{
|
||||||
|
size_t numInt = atoi(result[2]);
|
||||||
|
valueInt = Value(TransferTypeToByteArray<size_t>(numInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(strcmp(result[1], "math_score_string") == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
// result[2]解析的不完整
|
||||||
|
string ss ;
|
||||||
|
string ss2 ;
|
||||||
|
//strcpy_s(ss,str);
|
||||||
|
ss=putData;
|
||||||
|
ss2 = ss.substr(23);
|
||||||
|
cout<<"LOGdisDataTest2--ss = "<< ss<<endl;
|
||||||
|
cout<<"LOGdisDataTest2--ss2 = "<< ss2<<endl;
|
||||||
|
LOG("LOGdisDataTest2--ss2.c_str() = %s", ss2.c_str());
|
||||||
|
valueInt = Value(ss2);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_vector") == 0)
|
||||||
|
{
|
||||||
|
std::string str = result[2];
|
||||||
|
std::vector<uint8_t> vect;
|
||||||
|
vect.assign(str.begin(), str.end());
|
||||||
|
valueInt = Value(vect);
|
||||||
|
}
|
||||||
|
Status status = DisKvTest::KvStorePtr->Put(keyInt, valueInt);
|
||||||
|
if (Status::SUCCESS == status )
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest2--putData:RESULT_OK");
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
LOG("LOGdisDataTest2--putData:RESULT_ERR");
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int processGetData(char* putData)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest-processGetData, begin");
|
||||||
|
|
||||||
|
//解析远端发来的数据 result[0]=code result[1]=key result[2]=value
|
||||||
|
char result[3][MAX_DATA_LENGTH];
|
||||||
|
memset_s(result,3*MAX_DATA_LENGTH,0,3*MAX_DATA_LENGTH);
|
||||||
|
getParam(putData, result);
|
||||||
|
// LOG("LOGdisDataTest--putData= %s", putData);
|
||||||
|
for(int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
LOG("for result[i] %s", result[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取到本端数据
|
||||||
|
Value valueRetInt;
|
||||||
|
Key keyInt=result[1];
|
||||||
|
Status status = DisKvTest::KvStorePtr->Get(keyInt, valueRetInt);
|
||||||
|
if (Status::SUCCESS != status )
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--ERROR: Get(keyInt, valueRetInt)");
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ret = valueRetInt.ToString();
|
||||||
|
LOG("LOGdisDataTest--result[2]= %s", result[2]);
|
||||||
|
LOG("LOGdisDataTest--ret.c_str() = %s", ret.c_str());
|
||||||
|
|
||||||
|
if(strcmp(result[1], "math_score_int") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--math_score_int ");
|
||||||
|
int aaa = TransferByteArrayToType<int>(valueRetInt.Data());
|
||||||
|
int i2 = atoi(result[2]);
|
||||||
|
LOG("LOGdisDataTest--aaa= %d", aaa);
|
||||||
|
LOG("LOGdisDataTest--i2 = %d", i2);
|
||||||
|
if ( aaa == i2)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_float") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--math_score_float ");
|
||||||
|
float aaa = TransferByteArrayToType<float>(valueRetInt.Data());
|
||||||
|
|
||||||
|
// float fret = atof(ret.c_str());
|
||||||
|
float f2 = atof(result[2]);
|
||||||
|
float delta = f2 - aaa;
|
||||||
|
LOG("LOGdisDataTest--aaa= %f", aaa);
|
||||||
|
LOG("LOGdisDataTest--f2 = %f", f2);
|
||||||
|
LOG("LOGdisDataTest--delta = %f", delta);
|
||||||
|
if ( std::abs(delta) <= 0.00001)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_double") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--math_score_double ");
|
||||||
|
double aaa = TransferByteArrayToType<double>(valueRetInt.Data());
|
||||||
|
double d2 = atof(result[2]);
|
||||||
|
double delta = d2 - aaa;
|
||||||
|
LOG("LOGdisDataTest--aaa= %f", aaa);
|
||||||
|
LOG("LOGdisDataTest--d2 = %f", d2);
|
||||||
|
LOG("LOGdisDataTest--delta = %f", delta);
|
||||||
|
if ( std::abs(delta) <= 0.00001)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_int64_t") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--math_score_int64_t ");
|
||||||
|
int64_t aaa = TransferByteArrayToType<int64_t>(valueRetInt.Data());
|
||||||
|
int64_t i2 = atoi(result[2]);
|
||||||
|
//LOG("LOGdisDataTest--aaa= %ld", aaa);
|
||||||
|
// LOG("LOGdisDataTest--i2 = %ld", i2);
|
||||||
|
if ( aaa == i2)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_size_t") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--math_score_size_t ");
|
||||||
|
size_t aaa = TransferByteArrayToType<size_t>(valueRetInt.Data());
|
||||||
|
size_t i2 = atoi(result[2]);
|
||||||
|
// LOG("LOGdisDataTest--aaa= %lu", aaa);
|
||||||
|
// LOG("LOGdisDataTest--i2 = %lu", i2);
|
||||||
|
if ( aaa == i2)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_string") == 0)
|
||||||
|
{
|
||||||
|
// result[2]解析的不完整
|
||||||
|
string ss ;
|
||||||
|
string ss2 ;
|
||||||
|
//strcpy_s(ss,str);
|
||||||
|
ss=putData;
|
||||||
|
ss2 = ss.substr(23);
|
||||||
|
cout<<"LOGdisDataTest--ss = "<< ss<<endl;
|
||||||
|
cout<<"LOGdisDataTest--ss2 = "<< ss2<<endl;
|
||||||
|
LOG("LOGdisDataTest--ss2.c_str() = %s", ss2.c_str());
|
||||||
|
LOG("LOGdisDataTest--ret.c_str() = %s", ret.c_str()); //数据库
|
||||||
|
if(strcmp(ss2.c_str(), ret.c_str()) == 0)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(result[1], "math_score_vector") == 0)
|
||||||
|
{
|
||||||
|
LOG("LOGdisDataTest--result[2]= %s", result[2]);
|
||||||
|
LOG("LOGdisDataTest--ret.c_str() = %s", ret.c_str());
|
||||||
|
if(strcmp(result[2], ret.c_str()) == 0)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int processCreateKv(char* putData)
|
||||||
|
{
|
||||||
|
|
||||||
|
LOG("processCreateKv, begin");
|
||||||
|
//initKvstoreId();
|
||||||
|
std::cout << "create status=" << static_cast<int>(DisKvTest::statusGetKvStore) << std::endl;
|
||||||
|
if ( Status::SUCCESS == DisKvTest::statusGetKvStore)
|
||||||
|
{
|
||||||
|
std::cout << "SUCCESS:statusGetKvStore"<< std::endl;
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "ERR:statusGetKvStore"<< std::endl;
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int processDeleteKv(char* putData)
|
||||||
|
{
|
||||||
|
|
||||||
|
LOG("processDeleteKv, begin");
|
||||||
|
//initKvstoreId();
|
||||||
|
DisKvTest::statusCloseKvStore = DisKvTest::manager.CloseAllKvStore(DisKvTest::appId);
|
||||||
|
DisKvTest::statusDeleteKvStore = DisKvTest::manager.DeleteAllKvStore(DisKvTest::appId);
|
||||||
|
if ( (Status::SUCCESS == DisKvTest::statusCloseKvStore) && (Status::SUCCESS == DisKvTest::statusDeleteKvStore) )
|
||||||
|
{
|
||||||
|
std::cout << "SUCCESS:statusDeleteKvStore"<< std::endl;
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "ERR:statusDeleteKvStore"<< std::endl;
|
||||||
|
return RESULT_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessDP(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessDM(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessFileMgr(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessSecMgr(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProcessMediaMgr(int code, char* recvData)
|
||||||
|
{
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
85
distributeddatamgr/process_common/process_msg.h
Normal file
85
distributeddatamgr/process_common/process_msg.h
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEST_PROCESS_MSG_H
|
||||||
|
#define TEST_PROCESS_MSG_H
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "distributed_kv_data_manager.h"
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#define MAX_DATA_LENGTH 1024
|
||||||
|
#define RESULT_OK 0
|
||||||
|
#define RESULT_ERR 1
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
CTRL_CODE_SOFTBUS_TYPE = 1000,
|
||||||
|
CTRL_CODE_SOFTBUS_OPEN_SESSION,
|
||||||
|
CTRL_CODE_DATAMGR_TYPE = 2000,
|
||||||
|
CTRL_CODE_DATAMGR_GET_DATA,
|
||||||
|
CTRL_CODE_DATAMGR_GET_DATA_REPLY,
|
||||||
|
CTRL_CODE_DATAMGR_CREATE_KV,
|
||||||
|
CTRL_CODE_DATAMGR_DELETE_KV,
|
||||||
|
CTRL_CODE_DATAMGR_PUT_DATA,
|
||||||
|
CTRL_CODE_DATAMGR_DELETE_DATA,
|
||||||
|
CTRL_CODE_DM_TYPE = 3000,
|
||||||
|
CTRL_CODE_FILEMGR_TYPE = 4000,
|
||||||
|
CTRL_CODE_DP_TYPE = 5000,
|
||||||
|
CTRL_CODE_SEC_TYPE = 6000,
|
||||||
|
CTRL_CODE_MEDIA_TYPE = 7000,
|
||||||
|
CTRL_CODE_RESULT_TYPE = 9999,
|
||||||
|
} CtrlCodeType;
|
||||||
|
|
||||||
|
|
||||||
|
#define LOG(format, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
time_t timeSec; \
|
||||||
|
time(&timeSec); \
|
||||||
|
struct tm tmRst; \
|
||||||
|
localtime_r(&timeSec, &tmRst); \
|
||||||
|
char strTime[10]; \
|
||||||
|
strftime(strTime, sizeof(strTime), "%H:%M:%S", &tmRst); \
|
||||||
|
fprintf(stdout, "[process-dataMsg] %s " format "\n", strTime, ##__VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
int ProcessSoftBus(int code, char* recvData);
|
||||||
|
int ProcessDataMgr(int code, char* recvData);
|
||||||
|
int ProcessDP(int code, char* recvData);
|
||||||
|
int ProcessDM(int code, char* recvData);
|
||||||
|
int ProcessFileMgr(int code, char* recvData);
|
||||||
|
int ProcessSecMgr(int code, char* recvData);
|
||||||
|
int ProcessMediaMgr(int code, char* recvData);
|
||||||
|
|
||||||
|
int processDeletetData(char* putData);
|
||||||
|
int processGetData(char* putData);
|
||||||
|
int processPutData(char* putData);
|
||||||
|
int processCreateKv(char* putData);
|
||||||
|
int processDeleteKv(char* putData);
|
||||||
|
char* getRealData(char* str, char* delims);
|
||||||
|
int str2int(char *str, int base);
|
||||||
|
void getParam(char* str, char ret[] [MAX_DATA_LENGTH]);
|
||||||
|
void initKvstoreId();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
187
runtest.sh
Executable file
187
runtest.sh
Executable file
@ -0,0 +1,187 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo
|
||||||
|
echo "USAGE"
|
||||||
|
echo " ./runtest.sh device=IP:PORT serial=[SERIAL_NUMBER] [module=MODULE_NAME] [test=TEST] [runonly=RUN_ONLY]"
|
||||||
|
echo " First, you must be execute stf/start.bat in the windows which connected a device."
|
||||||
|
echo " target_platform : TARGET_PLATFORM the target platform, such as phone or ivi; Default to phone"
|
||||||
|
echo " device : IP:PORT the host ip:port of the connected device."
|
||||||
|
echo " module : MODULE_NAME the module name to run. Run all modules by default."
|
||||||
|
echo " test : TEST_NAME the test name to run. Run all tests by default. This should be a FULL-QUALIFIED className or methodName."
|
||||||
|
echo " runonly : RUN_ONLY TRUE=not build, only runtest; FALSE=build and runtest. FALSE by default."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_cmdline()
|
||||||
|
{
|
||||||
|
echo parse_cmdline:$@
|
||||||
|
SCRIPT_DIR=$(cd $(dirname $0); pwd)
|
||||||
|
BUILD_SCRIPT=${SCRIPT_DIR}/build.sh
|
||||||
|
BASE_HOME=${SCRIPT_DIR}/../../..
|
||||||
|
OUT_DIR=${SCRIPT_DIR}/../../../out
|
||||||
|
TARGET_ARCH=arm64
|
||||||
|
TARGET_PLATFORM=all
|
||||||
|
BUILD_VARIANT=release
|
||||||
|
MODULE_NAME=""
|
||||||
|
DEVICE_SN=""
|
||||||
|
TEST_NAME=""
|
||||||
|
RUN_ONLY=FALSE
|
||||||
|
BUILD_PARAM=""
|
||||||
|
HATS_HOME=$SCRIPT_DIR/../../../out/$BUILD_VARIANT/suites/dcts
|
||||||
|
MODULE_INFO_FILE=$SCRIPT_DIR/../../../out/$BUILD_VARIANT/suites/dcts/testcases/module_info.list
|
||||||
|
export PATH=${BASE_HOME}/prebuilts/python/linux-x86/3.8.5/bin:$PATH
|
||||||
|
BUILD_PARAM="$BUILD_PARAM target_arch=$TARGET_ARCH variant=$BUILD_VARIANT"
|
||||||
|
|
||||||
|
while [ -n "$1" ]
|
||||||
|
do
|
||||||
|
var="$1"
|
||||||
|
OPTIONS=$(echo ${var%%=*})
|
||||||
|
PARAM=$(echo ${var#*=})
|
||||||
|
case "$OPTIONS" in
|
||||||
|
target_platform) TARGET_PLATFORM="$PARAM"
|
||||||
|
BUILD_PARAM="$BUILD_PARAM target_platform=$TARGET_PLATFORM"
|
||||||
|
;;
|
||||||
|
module) MODULE_NAME="$PARAM"
|
||||||
|
BUILD_PARAM="$BUILD_PARAM suite=$MODULE_NAME"
|
||||||
|
;;
|
||||||
|
test) TEST_NAME="$PARAM"
|
||||||
|
;;
|
||||||
|
device) DEVICE_SN="$DEVICE_SN;$PARAM"
|
||||||
|
;;
|
||||||
|
runonly) RUN_ONLY=$(echo $PARAM |tr [a-z] [A-Z])
|
||||||
|
;;
|
||||||
|
*) usage
|
||||||
|
break;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if [ "$DEVICE_SN" == "" ];then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
do_make()
|
||||||
|
{
|
||||||
|
cd $BASE_HOME
|
||||||
|
echo "================================"
|
||||||
|
echo "start to build"
|
||||||
|
echo "$BUILD_SCRIPT $BUILD_PARAM"
|
||||||
|
echo "================================"
|
||||||
|
|
||||||
|
echo BUILD_PARAM= $BUILD_PARAM
|
||||||
|
$BUILD_SCRIPT $BUILD_PARAM
|
||||||
|
if [ "$?" != 0 ]; then
|
||||||
|
echo -e "\033[31mbuild error!\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_testmodule_name()
|
||||||
|
{
|
||||||
|
BUILD_TARGET_NAME=$1
|
||||||
|
# map from build_target name to actual testmodule name
|
||||||
|
test_module_name=""
|
||||||
|
OLD_IFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
for line in $(cat $MODULE_INFO_FILE); do
|
||||||
|
VAR1=$(echo $line |awk -F ' ' '{print $1}')
|
||||||
|
VAR2=$(echo $line |awk -F ' ' '{print $2}')
|
||||||
|
if [ "$BUILD_TARGET_NAME" == "$VAR1" ] ; then
|
||||||
|
test_module_name=$VAR2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$OLD_IFS
|
||||||
|
echo $test_module_name
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test_with_xdevice()
|
||||||
|
{
|
||||||
|
TC_PATH=$HATS_HOME/testcases
|
||||||
|
RES_PATH=$HATS_HOME/resource/
|
||||||
|
REPORT_PATH=$HATS_HOME/xdevice_reports/$(date "+%Y.%m.%d-%H.%M.%S")
|
||||||
|
python -m easy_install --quiet $HATS_HOME/tools/xdevice-0.0.0.tar.gz
|
||||||
|
python -m easy_install --quiet $HATS_HOME/tools/xdevice-extension-0.0.0.tar.gz
|
||||||
|
|
||||||
|
run_arguments="run dcts -tcpath $TC_PATH -respath $RES_PATH -rp $REPORT_PATH"
|
||||||
|
if [ ! -z "$MODULE_NAME" ]; then
|
||||||
|
run_arguments="$run_arguments -l $1"
|
||||||
|
fi
|
||||||
|
if [ ! -z "$TEST_NAME" ]; then
|
||||||
|
TEST_LIST_FILE=$HATS_HOME/include_tests
|
||||||
|
echo "$TEST_NAME" > $TEST_LIST_FILE
|
||||||
|
run_arguments="$run_arguments -ta test-file-include-filter:$TEST_LIST_FILE"
|
||||||
|
fi
|
||||||
|
if [ ! -z "$DEVICE_SN" ]; then
|
||||||
|
run_arguments="$run_arguments $(echo $DEVICE_SN | sed 's/;/-sn /')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $run_arguments
|
||||||
|
cd $HATS_HOME
|
||||||
|
python -m xdevice "$run_arguments"
|
||||||
|
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test()
|
||||||
|
{
|
||||||
|
cd $BASE_HOME
|
||||||
|
|
||||||
|
MAPPED_MODULE_NAME=$MODULE_NAME
|
||||||
|
# map from build_target name to actual testmodule name
|
||||||
|
if [ ! -z "$MODULE_NAME" ]; then
|
||||||
|
MAPPED_MODULE_NAME=$(get_testmodule_name $MODULE_NAME $HATS_HOME)
|
||||||
|
if [ ! -z "$MAPPED_MODULE_NAME" ]; then
|
||||||
|
echo -e "\033[32mTest module name of build_target "$MODULE_NAME is" "$MAPPED_MODULE_NAME"\033[0m"
|
||||||
|
else
|
||||||
|
echo -e "\033[31mTest module "$MODULE_NAME" dose not exist!\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
JSON_CONFIG_FILE=$HATS_HOME/testcases/$MAPPED_MODULE_NAME.json
|
||||||
|
ret_code=0
|
||||||
|
if [ -f "$JSON_CONFIG_FILE" ]; then
|
||||||
|
echo -e "\033[32mRun $MAPPED_MODULE_NAME with xdevice ...\033[0m"
|
||||||
|
run_test_with_xdevice $MAPPED_MODULE_NAME
|
||||||
|
ret_code=$?
|
||||||
|
elif [ -z "$MODULE_NAME" ]; then
|
||||||
|
echo -e "\033[32mRun all modules with xdevice ...\033[0m"
|
||||||
|
run_test_with_xdevice
|
||||||
|
ret_code=$?
|
||||||
|
else
|
||||||
|
echo -e "\033[31mNon-xdevice module in dcts!\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ret_code" != "0" ]; then
|
||||||
|
echo -e "\033[31mFailed to run test, ret=$ret_code\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_cmdline $@
|
||||||
|
if [ "$RUN_ONLY" == FALSE ];then
|
||||||
|
do_make
|
||||||
|
fi
|
||||||
|
mkdir -p $OUT_DIR/$BUILD_VARIANT/suites/dcts/resource/tools
|
||||||
|
run_test
|
||||||
|
exit 0
|
81
test_packages.gni
Executable file
81
test_packages.gni
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
import("//test/xts/tools/build/suite.gni")
|
||||||
|
|
||||||
|
_all_test_packages = [ "${DCTS_ROOT}/distributeddatamgr:distributeddatatest",
|
||||||
|
#"${DCTS_ROOT}/distributedschedule:distributedschetest",
|
||||||
|
]
|
||||||
|
|
||||||
|
_all_test_packages_ivi = [
|
||||||
|
# add hats for ivi here
|
||||||
|
# "${HATS_ROOT}/multimedia:multimedia_ivi",
|
||||||
|
]
|
||||||
|
|
||||||
|
_all_test_packages_intellitv = [
|
||||||
|
# add hats for intellitv here
|
||||||
|
#"${HATS_ROOT}/multimedia:multimedia_intellitv",
|
||||||
|
]
|
||||||
|
|
||||||
|
_all_test_packages_wearable = [
|
||||||
|
# add hats for wearable here
|
||||||
|
#"${HATS_ROOT}/multimedia:multimedia_wearable",
|
||||||
|
]
|
||||||
|
|
||||||
|
selected_packages_wearable = []
|
||||||
|
selected_packages_intellitv = []
|
||||||
|
selected_packages_ivi = []
|
||||||
|
selected_packages = []
|
||||||
|
assert(XTS_SUITENAME != "")
|
||||||
|
if (build_xts == true && XTS_SUITENAME == "dcts") {
|
||||||
|
_select_script = "//test/xts/tools/build/test_package_select.py"
|
||||||
|
_subsystem_config_path = rebase_path(
|
||||||
|
"$root_build_dir/build_configs/subsystem_info/src_subsystem_info.json")
|
||||||
|
_select_args = [ _subsystem_config_path ] + _all_test_packages
|
||||||
|
_select_args_ivi = [ _subsystem_config_path ] + _all_test_packages_ivi
|
||||||
|
_select_args_intellitv =
|
||||||
|
[ _subsystem_config_path ] + _all_test_packages_intellitv
|
||||||
|
_select_args_wearable =
|
||||||
|
[ _subsystem_config_path ] + _all_test_packages_wearable
|
||||||
|
_target_subsystem = getenv("target_subsystem")
|
||||||
|
|
||||||
|
if (_target_subsystem != "" && _target_subsystem != "all") {
|
||||||
|
print("Build dcts, target_subsystem=" + _target_subsystem)
|
||||||
|
_select_args += [ "selected_subsystem=" + _target_subsystem ]
|
||||||
|
_select_args_ivi += [ "selected_subsystem=" + _target_subsystem ]
|
||||||
|
_select_args_intellitv += [ "selected_subsystem=" + _target_subsystem ]
|
||||||
|
_select_args_wearable += [ "selected_subsystem=" + _target_subsystem ]
|
||||||
|
}
|
||||||
|
|
||||||
|
selected_packages = exec_script(_select_script, _select_args, "list lines")
|
||||||
|
|
||||||
|
selected_packages_ivi =
|
||||||
|
exec_script(_select_script, _select_args_ivi, "list lines")
|
||||||
|
|
||||||
|
selected_packages_intellitv =
|
||||||
|
exec_script(_select_script, _select_args_intellitv, "list lines")
|
||||||
|
|
||||||
|
selected_packages_wearable =
|
||||||
|
exec_script(_select_script, _select_args_wearable, "list lines")
|
||||||
|
|
||||||
|
print("Selected packages:")
|
||||||
|
print(selected_packages)
|
||||||
|
|
||||||
|
# always include testtools
|
||||||
|
selected_packages += [ "testtools:deploy_testtools" ]
|
||||||
|
selected_packages_ivi += [ "testtools:deploy_testtools" ]
|
||||||
|
selected_packages_intellitv += [ "testtools:deploy_testtools" ]
|
||||||
|
selected_packages_wearable += [ "testtools:deploy_testtools" ]
|
||||||
|
} else {
|
||||||
|
print("HATS build is not enabled")
|
||||||
|
}
|
18
testtools/BUILD.gn
Executable file
18
testtools/BUILD.gn
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
import("//test/xts/tools/build/suite.gni")
|
||||||
|
|
||||||
|
ohos_deploy_xdevice("deploy_testtools") {
|
||||||
|
configs_dir = "./config"
|
||||||
|
}
|
33
testtools/config/dcts.json
Executable file
33
testtools/config/dcts.json
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"description": "Common configurations for running dcts modules",
|
||||||
|
"kits": [
|
||||||
|
{
|
||||||
|
"type": "PropertyCheckKit",
|
||||||
|
"property-name": "ro.build.type",
|
||||||
|
"expected-value": "user",
|
||||||
|
"throw-error": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PropertyCheckKit",
|
||||||
|
"property-name": "ro.product.locale",
|
||||||
|
"expected-value": "en-US",
|
||||||
|
"throw-error": "false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ShellKit",
|
||||||
|
"run-command": [
|
||||||
|
"remount",
|
||||||
|
"mkdir /data/data/resource",
|
||||||
|
"chmod -R 777 /data/data/resource",
|
||||||
|
"settings put global verifier_verify_hdc_installs 0",
|
||||||
|
"settings put secure hdc_install_need_confirm 0",
|
||||||
|
"setprop persist.sys.platformautotest 1",
|
||||||
|
"settings put secure smart_suggestion_enable 1"
|
||||||
|
],
|
||||||
|
"teardown-command": [
|
||||||
|
"remount",
|
||||||
|
"rm -rf /data/data/resource"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
33
testtools/config/user_config.xml
Executable file
33
testtools/config/user_config.xml
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="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.
|
||||||
|
-->
|
||||||
|
<user_config>
|
||||||
|
<environment>
|
||||||
|
<support_device>
|
||||||
|
<device>true</device>
|
||||||
|
</support_device>
|
||||||
|
<device type="usb-hdc">
|
||||||
|
<ip></ip>
|
||||||
|
<port></port>
|
||||||
|
<sn></sn>
|
||||||
|
</device>
|
||||||
|
</environment>
|
||||||
|
<testcases>
|
||||||
|
<dir></dir>
|
||||||
|
</testcases>
|
||||||
|
<resource>
|
||||||
|
<dir></dir>
|
||||||
|
</resource>
|
||||||
|
</user_config>
|
Loading…
Reference in New Issue
Block a user