From 17d816136aadb62877148a1380a33ca6a13659a7 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Wed, 7 Jul 2021 11:57:34 +0000 Subject: [PATCH 01/10] =?UTF-8?q?CI=E6=B5=8B=E8=AF=95=EF=BC=8C=E8=AF=B7?= =?UTF-8?q?=E5=8B=BF=E5=90=88=E5=85=A5=EF=BC=81=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test01.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test01.txt diff --git a/test01.txt b/test01.txt new file mode 100644 index 0000000..7e44814 --- /dev/null +++ b/test01.txt @@ -0,0 +1 @@ +dddddddddddddddddddddddddddd \ No newline at end of file -- Gitee From 7a29b5f7b907c238a5b1f548b6aa7a0185ef6ab7 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 06:23:53 +0000 Subject: [PATCH 02/10] add test01.py. --- test01.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 test01.py diff --git a/test01.py b/test01.py new file mode 100644 index 0000000..77ea787 --- /dev/null +++ b/test01.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +def _init_global_config(): + import sys + import os + + # insert src path for loading xdevice modules + sys.framework_src_dir = os.path.abspath(os.path.dirname( + os.path.dirname(__file__)))/ + sys.path.insert(0, sys.framework_src_dir) + sys.framework_root_dir = os.path.abspath(os.path.dirname( + os.path.dirname(os.path.dirname(__file__))))/ + + sys.xdevice_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice", + "src")) + sys.path.insert(0, sys.xdevice_dir) + + sys.xdevice_extension_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice", + "extension", + "src")) + sys.path.insert(1, sys.xdevice_extension_dir) + + sys.pytest_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "aw", + "python")) + sys.path.insert(2, sys.pytest_dir) + + sys.adapter_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "adapter" + "aw", + "python")) + sys.path.insert(3, sys.adapter_dir) + + sys.hmh_script = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "test-tools", + "hmh")) + sys.path.insert(4, sys.hmh_script) + + sys.framework_res_dir = sys.framework_root_dir + sys.exec_dir = sys.framework_root_dir + + from core.common import get_source_code_root_path + sys.source_code_root_path = get_source_code_root_path( + sys.framework_root_dir) + + from xdevice import Variables + Variables.exec_dir = sys.framework_root_dir + + +def _iter_module_plugins(packages): + import importlib + import pkgutil + for package in packages: + pkg_path = getattr(package, "__path__", "") + pkg_name = getattr(package, "__name__", "") + if not pkg_name or not pkg_path: + continue + _iter_modules = pkgutil.iter_modules(pkg_path, "%s%s" % ( + pkg_name, ".")) + for _, name, _ in _iter_modules: + importlib.import_module(name) + + +def _load_internal_plugins(): + import core.driver + _iter_module_plugins([core.driver]) + + try: + import xdevice_extension._core.environment + _iter_module_plugins([xdevice_extension._core.environment]) + except (ModuleNotFoundError, ImportError): + pass + + try: + import script.report + _iter_module_plugins([script.report]) + except (ModuleNotFoundError, ImportError): + pass + +_init_global_config() +del _init_global_config + +_load_internal_plugins() +del _load_internal_plugins -- Gitee From 1cb0c353d5bebf8fc3e4d68bb5c3574673d1d72e Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 06:48:06 +0000 Subject: [PATCH 03/10] update test01.py. --- test01.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test01.py b/test01.py index 77ea787..42bf987 100644 --- a/test01.py +++ b/test01.py @@ -31,8 +31,8 @@ def _init_global_config(): sys.xdevice_dir = os.path.abspath(os.path.join( sys.framework_root_dir, "..", - "xdevice", - "src")) + "xdevice",/ + "src"))/ sys.path.insert(0, sys.xdevice_dir) sys.xdevice_extension_dir = os.path.abspath(os.path.join( -- Gitee From 8e913aac0415607b95b1583bb95e2e44663b1c05 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 07:16:31 +0000 Subject: [PATCH 04/10] update test01.py. --- test01.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test01.py b/test01.py index 42bf987..2086c1f 100644 --- a/test01.py +++ b/test01.py @@ -7,7 +7,7 @@ # 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 +# 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, -- Gitee From 15ebec9ba2067f52d7af1faba8821d427e757ce7 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 07:44:02 +0000 Subject: [PATCH 05/10] add test02.py. --- test02.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 test02.py diff --git a/test02.py b/test02.py new file mode 100644 index 0000000..2086c1f --- /dev/null +++ b/test02.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0///////////////////// +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +def _init_global_config(): + import sys + import os + + # insert src path for loading xdevice modules + sys.framework_src_dir = os.path.abspath(os.path.dirname( + os.path.dirname(__file__)))/ + sys.path.insert(0, sys.framework_src_dir) + sys.framework_root_dir = os.path.abspath(os.path.dirname( + os.path.dirname(os.path.dirname(__file__))))/ + + sys.xdevice_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice",/ + "src"))/ + sys.path.insert(0, sys.xdevice_dir) + + sys.xdevice_extension_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice", + "extension", + "src")) + sys.path.insert(1, sys.xdevice_extension_dir) + + sys.pytest_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "aw", + "python")) + sys.path.insert(2, sys.pytest_dir) + + sys.adapter_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "adapter" + "aw", + "python")) + sys.path.insert(3, sys.adapter_dir) + + sys.hmh_script = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "test-tools", + "hmh")) + sys.path.insert(4, sys.hmh_script) + + sys.framework_res_dir = sys.framework_root_dir + sys.exec_dir = sys.framework_root_dir + + from core.common import get_source_code_root_path + sys.source_code_root_path = get_source_code_root_path( + sys.framework_root_dir) + + from xdevice import Variables + Variables.exec_dir = sys.framework_root_dir + + +def _iter_module_plugins(packages): + import importlib + import pkgutil + for package in packages: + pkg_path = getattr(package, "__path__", "") + pkg_name = getattr(package, "__name__", "") + if not pkg_name or not pkg_path: + continue + _iter_modules = pkgutil.iter_modules(pkg_path, "%s%s" % ( + pkg_name, ".")) + for _, name, _ in _iter_modules: + importlib.import_module(name) + + +def _load_internal_plugins(): + import core.driver + _iter_module_plugins([core.driver]) + + try: + import xdevice_extension._core.environment + _iter_module_plugins([xdevice_extension._core.environment]) + except (ModuleNotFoundError, ImportError): + pass + + try: + import script.report + _iter_module_plugins([script.report]) + except (ModuleNotFoundError, ImportError): + pass + +_init_global_config() +del _init_global_config + +_load_internal_plugins() +del _load_internal_plugins -- Gitee From ae29ddd64f175bc9bb4aac500ac755620070f1ff Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 08:22:01 +0000 Subject: [PATCH 06/10] add test03.c. --- test03.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 test03.c diff --git a/test03.c b/test03.c new file mode 100644 index 0000000..2086c1f --- /dev/null +++ b/test03.c @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0///////////////////// +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +def _init_global_config(): + import sys + import os + + # insert src path for loading xdevice modules + sys.framework_src_dir = os.path.abspath(os.path.dirname( + os.path.dirname(__file__)))/ + sys.path.insert(0, sys.framework_src_dir) + sys.framework_root_dir = os.path.abspath(os.path.dirname( + os.path.dirname(os.path.dirname(__file__))))/ + + sys.xdevice_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice",/ + "src"))/ + sys.path.insert(0, sys.xdevice_dir) + + sys.xdevice_extension_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "xdevice", + "extension", + "src")) + sys.path.insert(1, sys.xdevice_extension_dir) + + sys.pytest_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "aw", + "python")) + sys.path.insert(2, sys.pytest_dir) + + sys.adapter_dir = os.path.abspath(os.path.join( + sys.framework_root_dir, + "adapter" + "aw", + "python")) + sys.path.insert(3, sys.adapter_dir) + + sys.hmh_script = os.path.abspath(os.path.join( + sys.framework_root_dir, + "..", + "test-tools", + "hmh")) + sys.path.insert(4, sys.hmh_script) + + sys.framework_res_dir = sys.framework_root_dir + sys.exec_dir = sys.framework_root_dir + + from core.common import get_source_code_root_path + sys.source_code_root_path = get_source_code_root_path( + sys.framework_root_dir) + + from xdevice import Variables + Variables.exec_dir = sys.framework_root_dir + + +def _iter_module_plugins(packages): + import importlib + import pkgutil + for package in packages: + pkg_path = getattr(package, "__path__", "") + pkg_name = getattr(package, "__name__", "") + if not pkg_name or not pkg_path: + continue + _iter_modules = pkgutil.iter_modules(pkg_path, "%s%s" % ( + pkg_name, ".")) + for _, name, _ in _iter_modules: + importlib.import_module(name) + + +def _load_internal_plugins(): + import core.driver + _iter_module_plugins([core.driver]) + + try: + import xdevice_extension._core.environment + _iter_module_plugins([xdevice_extension._core.environment]) + except (ModuleNotFoundError, ImportError): + pass + + try: + import script.report + _iter_module_plugins([script.report]) + except (ModuleNotFoundError, ImportError): + pass + +_init_global_config() +del _init_global_config + +_load_internal_plugins() +del _load_internal_plugins -- Gitee From 6b3dec887782966271d720eac8f2f25c1a58d8e5 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Fri, 9 Jul 2021 08:22:28 +0000 Subject: [PATCH 07/10] rename test03.c to test03.py. --- test03.c => test03.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test03.c => test03.py (100%) diff --git a/test03.c b/test03.py similarity index 100% rename from test03.c rename to test03.py -- Gitee From d0012c68d897d2ed3493b5db40d634815f502a6f Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Mon, 12 Jul 2021 01:35:45 +0000 Subject: [PATCH 08/10] update test01.py. --- test01.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test01.py b/test01.py index 2086c1f..c48411d 100644 --- a/test01.py +++ b/test01.py @@ -16,7 +16,7 @@ # limitations under the License. # - +\\\\\\\\\\\\\\\\ def _init_global_config(): import sys import os -- Gitee From 1c4d61c49cb04804cce9de9c5e00be4b9e51de42 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Mon, 12 Jul 2021 03:33:17 +0000 Subject: [PATCH 09/10] update test01.py. --- test01.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test01.py b/test01.py index c48411d..3d32206 100644 --- a/test01.py +++ b/test01.py @@ -27,7 +27,7 @@ def _init_global_config(): sys.path.insert(0, sys.framework_src_dir) sys.framework_root_dir = os.path.abspath(os.path.dirname( os.path.dirname(os.path.dirname(__file__))))/ - +\\\\\\\\\\\\ sys.xdevice_dir = os.path.abspath(os.path.join( sys.framework_root_dir, "..", -- Gitee From 84783ec4d7de79d22fc34f7700c271acd8da6fd0 Mon Sep 17 00:00:00 2001 From: MrBarryLiang <1028332731@qq.com> Date: Mon, 12 Jul 2021 07:37:31 +0000 Subject: [PATCH 10/10] update test02.py. --- test02.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test02.py b/test02.py index 2086c1f..1f88cea 100644 --- a/test02.py +++ b/test02.py @@ -42,7 +42,7 @@ def _init_global_config(): "extension", "src")) sys.path.insert(1, sys.xdevice_extension_dir) - +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ sys.pytest_dir = os.path.abspath(os.path.join( sys.framework_root_dir, "aw", -- Gitee