• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2021 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19from dataclasses import dataclass
20
21__all__ = ["DeviceOsType", "ProductForm", "TestType", "TestExecType",
22           "DeviceTestType", "HostTestType", "HostDrivenTestType",
23           "SchedulerType", "ListenerType", "ToolCommandType",
24           "TEST_DRIVER_SET", "LogType", "ParserType", "CKit", "ComType",
25           "DeviceLabelType", "DeviceLiteKernel", "GTestConst", "ManagerType",
26           "CommonParserType", "DeviceConnectorType", "FilePermission"]
27
28
29@dataclass
30class DeviceOsType(object):
31    """
32    DeviceOsType enumeration
33    """
34    default = "default"
35    lite = "lite"
36
37
38@dataclass
39class DeviceConnectorType:
40    hdc = "usb-hdc"
41
42
43@dataclass
44class ProductForm(object):
45    """
46    ProductForm enumeration
47    """
48    phone = "phone"
49    car = "ivi"
50    television = "tv"
51    watch = "watch"
52    tablet = 'tablet'
53
54
55@dataclass
56class TestType(object):
57    """
58    TestType enumeration
59    """
60    unittest = "unittest"
61    mst = "moduletest"
62    systemtest = "systemtest"
63    perf = "performance"
64    sec = "security"
65    reli = "reliability"
66    dst = "distributedtest"
67    all = "ALL"
68
69
70@dataclass
71class ComType(object):
72    """
73    ComType enumeration
74    """
75    cmd_com = "cmd"
76    deploy_com = "deploy"
77
78
79@dataclass
80class DeviceLabelType(object):
81    """
82    DeviceLabelType enumeration
83    """
84    wifiiot = "wifiiot"
85    ipcamera = "ipcamera"
86    watch = "watch"
87    phone = "phone"
88
89
90@dataclass
91class DeviceLiteKernel(object):
92    """
93    Lite device os enumeration
94    """
95    linux_kernel = "linux"
96    lite_kernel = "lite"
97
98
99TEST_TYPE_DICT = {
100    "UT": TestType.unittest,
101    "MST": TestType.mst,
102    "ST": TestType.systemtest,
103    "PERF": TestType.perf,
104    "SEC": TestType.sec,
105    "RELI": TestType.reli,
106    "DST": TestType.dst,
107    "ALL": TestType.all,
108}
109
110
111@dataclass
112class TestExecType(object):
113    """
114    TestExecType enumeration according to test execution method
115    """
116    # A test running on the device
117    device_test = "device"
118    # A test running on the host (pc)
119    host_test = "host"
120    # A test running on the host that interacts with one or more devices.
121    host_driven_test = "hostdriven"
122
123
124@dataclass
125class DeviceTestType(object):
126    """
127    DeviceTestType enumeration
128    """
129    cpp_test = "CppTest"
130    hap_test = "HapTest"
131    junit_test = "JUnitTest"
132    jsunit_test = "JSUnitTest"
133    ctest_lite = "CTestLite"
134    cpp_test_lite = "CppTestLite"
135    lite_cpp_test = "LiteUnitTest"
136    open_source_test = "OpenSourceTest"
137    build_only_test = "BuildOnlyTestLite"
138    ltp_posix_test = "LtpPosixTest"
139    oh_kernel_test = "OHKernelTest"
140    oh_jsunit_test = "OHJSUnitTest"
141
142
143@dataclass
144class HostTestType(object):
145    """
146    HostTestType enumeration
147    """
148    host_gtest = "HostGTest"
149    host_junit_test = "HostJUnitTest"
150
151
152@dataclass
153class HostDrivenTestType(object):
154    """
155    HostDrivenType enumeration
156    """
157    device_test = "DeviceTest"
158
159
160TEST_DRIVER_SET = {
161    DeviceTestType.cpp_test,
162    DeviceTestType.hap_test,
163    DeviceTestType.junit_test,
164    DeviceTestType.jsunit_test,
165    DeviceTestType.cpp_test_lite,
166    DeviceTestType.ctest_lite,
167    DeviceTestType.lite_cpp_test,
168    DeviceTestType.oh_kernel_test,
169    HostDrivenTestType.device_test
170}
171
172
173@dataclass
174class SchedulerType(object):
175    """
176    SchedulerType enumeration
177    """
178    # default scheduler
179    scheduler = "Scheduler"
180
181
182@dataclass
183class LogType:
184    tool = "Tool"
185    device = "Device"
186
187
188@dataclass
189class ListenerType:
190    log = "Log"
191    report = "Report"
192    upload = "Upload"
193    collect = "Collect"
194    collect_lite = "CollectLite"
195    collect_pass = "CollectPass"
196
197
198@dataclass
199class ParserType:
200    ctest_lite = "CTestLite"
201    cpp_test_lite = "CppTestLite"
202    cpp_test_list_lite = "CppTestListLite"
203    open_source_test = "OpenSourceTest"
204    build_only_test = "BuildOnlyTestLite"
205
206
207@dataclass
208class CommonParserType:
209    jsunit = "JSUnit"
210    cpptest = "CppTest"
211    cpptest_list = "CppTestList"
212    junit = "JUnit"
213    ltp_posix = "LtpPosixTest"
214    oh_kernel_test = "OHKernel"
215    oh_jsunit = "OHJSUnit"
216    oh_jsunit_list = "OHJSUnitList"
217
218
219@dataclass
220class ManagerType:
221    device = "device"
222    lite_device = "device_lite"
223
224
225@dataclass
226class ToolCommandType(object):
227    toolcmd_key_help = "help"
228    toolcmd_key_show = "show"
229    toolcmd_key_run = "run"
230    toolcmd_key_quit = "quit"
231    toolcmd_key_list = "list"
232
233
234@dataclass
235class CKit:
236    push = "PushKit"
237    command = "CommandKit"
238    config = "ConfigKit"
239    wifi = "WIFIKit"
240    propertycheck = 'PropertyCheckKit'
241    sts = 'STSKit'
242    shell = "ShellKit"
243    testbundle = "TestBundleKit"
244    appinstall = "AppInstallKit"
245    component = "ComponentKit"
246
247@dataclass
248class GTestConst(object):
249    exec_para_filter = "--gtest_filter"
250    exec_para_level = "--gtest_testsize"
251
252
253@dataclass
254class FilePermission(object):
255    mode_777 = 0o777
256    mode_755 = 0o755
257    mode_644 = 0o644
258