• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2020-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           "ModeType", "ConfigConst"]
27
28
29@dataclass
30class DeviceOsType(object):
31    """
32    DeviceOsType enumeration
33    """
34    default = "default"
35    lite = "lite"
36
37
38@dataclass
39class ProductForm(object):
40    """
41    ProductForm enumeration
42    """
43    phone = "phone"
44    car = "ivi"
45    television = "tv"
46    watch = "watch"
47    tablet = 'tablet'
48
49
50@dataclass
51class TestType(object):
52    """
53    TestType enumeration
54    """
55    unittest = "unittest"
56    mst = "moduletest"
57    systemtest = "systemtest"
58    perf = "performance"
59    sec = "security"
60    reli = "reliability"
61    dst = "distributedtest"
62    benchmark = "benchmark"
63    all = "ALL"
64
65
66@dataclass
67class ComType(object):
68    """
69    ComType enumeration
70    """
71    cmd_com = "cmd"
72    deploy_com = "deploy"
73
74
75@dataclass
76class DeviceLabelType(object):
77    """
78    DeviceLabelType enumeration
79    """
80    wifiiot = "wifiiot"
81    ipcamera = "ipcamera"
82    watch_gt = "watchGT"
83    phone = "phone"
84    watch = "watch"
85
86
87@dataclass
88class DeviceLiteKernel(object):
89    """
90    Lite device os enumeration
91    """
92    linux_kernel = "linux"
93    lite_kernel = "lite"
94
95
96TEST_TYPE_DICT = {
97    "UT": TestType.unittest,
98    "MST": TestType.mst,
99    "ST": TestType.systemtest,
100    "PERF": TestType.perf,
101    "SEC": TestType.sec,
102    "RELI": TestType.reli,
103    "DST": TestType.dst,
104    "ALL": TestType.all,
105}
106
107
108@dataclass
109class TestExecType(object):
110    """
111    TestExecType enumeration according to test execution method
112    """
113    # A test running on the device
114    device_test = "device"
115    # A test running on the host (pc)
116    host_test = "host"
117    # A test running on the host that interacts with one or more devices.
118    host_driven_test = "hostdriven"
119
120
121@dataclass
122class DeviceTestType(object):
123    """
124    DeviceTestType enumeration
125    """
126    cpp_test = "CppTest"
127    hap_test = "HapTest"
128    junit_test = "JUnitTest"
129    jsunit_test = "JSUnitTest"
130    jsunit_test_lite = "JSUnitTestLite"
131    ctest_lite = "CTestLite"
132    cpp_test_lite = "CppTestLite"
133    lite_cpp_test = "LiteUnitTest"
134    open_source_test = "OpenSourceTest"
135    build_only_test = "BuildOnlyTestLite"
136
137
138@dataclass
139class HostTestType(object):
140    """
141    HostTestType enumeration
142    """
143    host_gtest = "HostGTest"
144    host_junit_test = "HostJUnitTest"
145
146
147@dataclass
148class HostDrivenTestType(object):
149    """
150    HostDrivenType enumeration
151    """
152    device_test = "DeviceTest"
153
154
155TEST_DRIVER_SET = {
156    DeviceTestType.cpp_test,
157    DeviceTestType.hap_test,
158    DeviceTestType.junit_test,
159    DeviceTestType.jsunit_test,
160    DeviceTestType.cpp_test_lite,
161    DeviceTestType.ctest_lite,
162    DeviceTestType.lite_cpp_test,
163    HostDrivenTestType.device_test
164}
165
166
167@dataclass
168class SchedulerType(object):
169    """
170    SchedulerType enumeration
171    """
172    # default scheduler
173    scheduler = "Scheduler"
174
175
176@dataclass
177class LogType:
178    tool = "Tool"
179    device = "Device"
180
181
182@dataclass
183class ListenerType:
184    log = "Log"
185    report = "Report"
186    upload = "Upload"
187    collect = "Collect"
188    collect_lite = "CollectLite"
189
190
191@dataclass
192class ParserType:
193    ctest_lite = "CTestLite"
194    cpp_test_lite = "CppTestLite"
195    cpp_test_list_lite = "CppTestListLite"
196    open_source_test = "OpenSourceTest"
197    build_only_test = "BuildOnlyTestLite"
198    jsuit_test_lite = "JSUnitTestLite"
199
200
201@dataclass
202class ManagerType:
203    device = "device"
204    lite_device = "device_lite"
205
206
207@dataclass
208class ToolCommandType(object):
209    toolcmd_key_help = "help"
210    toolcmd_key_show = "show"
211    toolcmd_key_run = "run"
212    toolcmd_key_quit = "quit"
213    toolcmd_key_list = "list"
214
215
216@dataclass
217class CKit:
218    push = "PushKit"
219    liteinstall = "LiteAppInstallKit"
220    command = "CommandKit"
221    config = "ConfigKit"
222    wifi = "WIFIKit"
223    propertycheck = 'PropertyCheckKit'
224    sts = 'STSKit'
225    shell = "ShellKit"
226    deploy = 'DeployKit'
227    mount = 'MountKit'
228    liteuikit = 'LiteUiKit'
229    rootfs = "RootFsKit"
230    query = "QueryKit"
231    liteshell = "LiteShellKit"
232    app_install = "AppInstallKit"
233    deploytool = "DeployToolKit"
234    component = "ComponentKit"
235
236
237@dataclass
238class GTestConst(object):
239    exec_para_filter = "--gtest_filter"
240    exec_para_level = "--gtest_testsize"
241
242
243@dataclass
244class ModeType(object):
245    decc = "decc"
246    factory = "factory"
247    developer = "developer"
248
249
250@dataclass
251class ConfigConst(object):
252    action = "action"
253    task = "task"
254    testlist = "testlist"
255    testfile = "testfile"
256    testcase = "testcase"
257    testdict = "testdict"
258    device_sn = "device_sn"
259    report_path = "report_path"
260    resource_path = "resource_path"
261    testcases_path = "testcases_path"
262    testargs = "testargs"
263    pass_through = "pass_through"
264    test_environment = "test_environment"
265    exectype = "exectype"
266    testtype = "testtype"
267    testdriver = "testdriver"
268    retry = "retry"
269    session = "session"
270    dry_run = "dry_run"
271    reboot_per_module = "reboot_per_module"
272    check_device = "check_device"
273    configfile = "config"
274    repeat = "repeat"
275    subsystems = "subsystems"
276    parts = "parts"
277
278    # Runtime Constant
279    history_report_path = "history_report_path"
280    product_info = "product_info"
281    task_state = "task_state"
282    recover_state = "recover_state"
283    need_kit_setup = "need_kit_setup"
284    task_kits = "task_kits"
285    module_kits = "module_kits"
286    spt = "spt"
287    version = "version"
288    component_mapper = "_component_mapper"
289    component_base_kit = "component_base_kit"
290    support_component = "support_component"
291
292
293class FilePermission(object):
294    mode_777 = 0o777
295    mode_755 = 0o755
296    mode_644 = 0o644
297