constants.py 6.2 KB
Newer Older
W
wenjun 已提交
1 2 3 4
#!/usr/bin/env python3
# coding=utf-8

#
M
mamingshuai 已提交
5
# Copyright (c) 2020-2021 Huawei Device Co., Ltd.
W
wenjun 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from dataclasses import dataclass

__all__ = ["DeviceOsType", "ProductForm", "TestType", "TestExecType",
           "DeviceTestType", "HostTestType", "HostDrivenTestType",
           "SchedulerType", "ListenerType", "ToolCommandType",
           "TEST_DRIVER_SET", "LogType", "ParserType", "CKit", "ComType",
M
mamingshuai 已提交
25 26
           "DeviceLabelType", "DeviceLiteKernel", "GTestConst", "ManagerType",
           "ModeType", "ConfigConst"]
W
wenjun 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43


@dataclass
class DeviceOsType(object):
    """
    DeviceOsType enumeration
    """
    default = "default"
    lite = "lite"


@dataclass
class ProductForm(object):
    """
    ProductForm enumeration
    """
    phone = "phone"
M
mamingshuai 已提交
44
    car = "ivi"
W
wenjun 已提交
45 46
    television = "tv"
    watch = "watch"
M
mamingshuai 已提交
47
    tablet = 'tablet'
W
wenjun 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61


@dataclass
class TestType(object):
    """
    TestType enumeration
    """
    unittest = "unittest"
    mst = "moduletest"
    systemtest = "systemtest"
    perf = "performance"
    sec = "security"
    reli = "reliability"
    dst = "distributedtest"
M
mamingshuai 已提交
62
    benchmark = "benchmark"
W
wenjun 已提交
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
    all = "ALL"


@dataclass
class ComType(object):
    """
    ComType enumeration
    """
    cmd_com = "cmd"
    deploy_com = "deploy"


@dataclass
class DeviceLabelType(object):
    """
    DeviceLabelType enumeration
    """
    wifiiot = "wifiiot"
    ipcamera = "ipcamera"
M
mamingshuai 已提交
82
    watch_gt = "watchGT"
W
wenjun 已提交
83
    phone = "phone"
M
mamingshuai 已提交
84
    watch = "watch"
W
wenjun 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129


@dataclass
class DeviceLiteKernel(object):
    """
    Lite device os enumeration
    """
    linux_kernel = "linux"
    lite_kernel = "lite"


TEST_TYPE_DICT = {
    "UT": TestType.unittest,
    "MST": TestType.mst,
    "ST": TestType.systemtest,
    "PERF": TestType.perf,
    "SEC": TestType.sec,
    "RELI": TestType.reli,
    "DST": TestType.dst,
    "ALL": TestType.all,
}


@dataclass
class TestExecType(object):
    """
    TestExecType enumeration according to test execution method
    """
    # A test running on the device
    device_test = "device"
    # A test running on the host (pc)
    host_test = "host"
    # A test running on the host that interacts with one or more devices.
    host_driven_test = "hostdriven"


@dataclass
class DeviceTestType(object):
    """
    DeviceTestType enumeration
    """
    cpp_test = "CppTest"
    hap_test = "HapTest"
    junit_test = "JUnitTest"
    jsunit_test = "JSUnitTest"
M
mamingshuai 已提交
130
    jsunit_test_lite = "JSUnitTestLite"
W
wenjun 已提交
131 132 133 134
    ctest_lite = "CTestLite"
    cpp_test_lite = "CppTestLite"
    lite_cpp_test = "LiteUnitTest"
    open_source_test = "OpenSourceTest"
M
mamingshuai 已提交
135
    build_only_test = "BuildOnlyTestLite"
W
wenjun 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196


@dataclass
class HostTestType(object):
    """
    HostTestType enumeration
    """
    host_gtest = "HostGTest"
    host_junit_test = "HostJUnitTest"


@dataclass
class HostDrivenTestType(object):
    """
    HostDrivenType enumeration
    """
    device_test = "DeviceTest"


TEST_DRIVER_SET = {
    DeviceTestType.cpp_test,
    DeviceTestType.hap_test,
    DeviceTestType.junit_test,
    DeviceTestType.jsunit_test,
    DeviceTestType.cpp_test_lite,
    DeviceTestType.ctest_lite,
    DeviceTestType.lite_cpp_test,
    HostDrivenTestType.device_test
}


@dataclass
class SchedulerType(object):
    """
    SchedulerType enumeration
    """
    # default scheduler
    scheduler = "Scheduler"


@dataclass
class LogType:
    tool = "Tool"
    device = "Device"


@dataclass
class ListenerType:
    log = "Log"
    report = "Report"
    upload = "Upload"
    collect = "Collect"
    collect_lite = "CollectLite"


@dataclass
class ParserType:
    ctest_lite = "CTestLite"
    cpp_test_lite = "CppTestLite"
    cpp_test_list_lite = "CppTestListLite"
    open_source_test = "OpenSourceTest"
M
mamingshuai 已提交
197 198
    build_only_test = "BuildOnlyTestLite"
    jsuit_test_lite = "JSUnitTestLite"
W
wenjun 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218


@dataclass
class ManagerType:
    device = "device"
    lite_device = "device_lite"


@dataclass
class ToolCommandType(object):
    toolcmd_key_help = "help"
    toolcmd_key_show = "show"
    toolcmd_key_run = "run"
    toolcmd_key_quit = "quit"
    toolcmd_key_list = "list"


@dataclass
class CKit:
    push = "PushKit"
M
mamingshuai 已提交
219
    liteinstall = "LiteAppInstallKit"
W
wenjun 已提交
220 221 222 223 224 225 226 227 228 229 230
    command = "CommandKit"
    config = "ConfigKit"
    wifi = "WIFIKit"
    propertycheck = 'PropertyCheckKit'
    sts = 'STSKit'
    shell = "ShellKit"
    deploy = 'DeployKit'
    mount = 'MountKit'
    liteuikit = 'LiteUiKit'
    rootfs = "RootFsKit"
    query = "QueryKit"
M
mamingshuai 已提交
231 232
    liteshell = "LiteShellKit"
    app_install = "AppInstallKit"
233
    deploytool = "DeployToolKit"
W
wenjun 已提交
234 235 236 237 238 239


@dataclass
class GTestConst(object):
    exec_para_filter = "--gtest_filter"
    exec_para_level = "--gtest_testsize"
M
mamingshuai 已提交
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283


@dataclass
class ModeType(object):
    decc = "decc"
    factory = "factory"
    developer = "developer"


@dataclass
class ConfigConst(object):
    action = "action"
    task = "task"
    testlist = "testlist"
    testfile = "testfile"
    testcase = "testcase"
    device_sn = "device_sn"
    report_path = "report_path"
    resource_path = "resource_path"
    testcases_path = "testcases_path"
    testargs = "testargs"
    pass_through = "pass_through"
    test_environment = "test_environment"
    exectype = "exectype"
    testtype = "testtype"
    testdriver = "testdriver"
    retry = "retry"
    session = "session"
    dry_run = "dry_run"
    reboot_per_module = "reboot_per_module"
    check_device = "check_device"
    configfile = "config"
    repeat = "repeat"

    # Runtime Constant
    history_report_path = "history_report_path"
    product_info = "product_info"
    task_state = "task_state"
    recover_state = "recover_state"
    need_kit_setup = "need_kit_setup"
    task_kits = "task_kits"
    module_kits = "module_kits"
    spt = "spt"
    version = "version"
A
alex__hold 已提交
284 285 286 287 288 289 290


class FilePermission(object):
    mode_777 = 0o777
    mode_755 = 0o755
    mode_644 = 0o644