From f25f571be85a09f97fa0d11f5a6a244b4837e496 Mon Sep 17 00:00:00 2001 From: jiyong_sd Date: Tue, 1 Mar 2022 16:29:20 +0800 Subject: [PATCH 1/2] modified xdevice Signed-off-by: jiyong_sd Change-Id: I02922ed9e0d53b2443130424742b898c9592ec6a --- .../src/xdevice_extension/_core/constants.py | 2 ++ .../xdevice_extension/_core/testkit/kit.py | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/extension/src/xdevice_extension/_core/constants.py b/extension/src/xdevice_extension/_core/constants.py index 9916642..a927459 100644 --- a/extension/src/xdevice_extension/_core/constants.py +++ b/extension/src/xdevice_extension/_core/constants.py @@ -135,6 +135,7 @@ class DeviceTestType(object): lite_cpp_test = "LiteUnitTest" open_source_test = "OpenSourceTest" build_only_test = "BuildOnlyTestLite" + ltp_posix_test = "LtpPosixTest" @dataclass @@ -205,6 +206,7 @@ class CommonParserType: cpptest = "CppTest" cpptest_list = "CppTestList" junit = "JUnit" + ltp_posix = "LtpPosixTest" @dataclass diff --git a/extension/src/xdevice_extension/_core/testkit/kit.py b/extension/src/xdevice_extension/_core/testkit/kit.py index e7f65a3..9eca083 100644 --- a/extension/src/xdevice_extension/_core/testkit/kit.py +++ b/extension/src/xdevice_extension/_core/testkit/kit.py @@ -131,6 +131,7 @@ class PushKit(ITestKit): LOG.debug("PushKit setup, device:{}".format(device.device_sn)) for command in self.pre_push: run_command(device, command) + dst = None for push_info in self.push_list: files = re.split('->|=>', push_info) if len(files) != 2: @@ -152,10 +153,25 @@ class PushKit(ITestKit): LOG.warning(error, error_no=error.error_no) continue remount(device) - device.hdc_command("file send {} {}".format(real_src_path, dst)) - LOG.debug("Push file finished from {} to {}".format(src, dst)) + # hdc don't support push directory now + if os.path.isdir(real_src_path): + device.hdc_command("shell mkdir {}".format(dst)) + for root, _, files in os.walk(real_src_path): + for file in files: + device.hdc_command( + "file send {} {}".format(os.path.join(root, file), + dst)) + LOG.debug( + "Push file finished from {} to {}".format( + os.path.join(root, file), dst)) + self.pushed_file.append(file) + else: + device.hdc_command("file send {} {}".format(real_src_path, dst)) + LOG.debug("Push file finished from {} to {}".format(src, dst)) + self.pushed_file.append(real_src_path) for command in self.post_push: run_command(device, command) + return self.pushed_file, dst def add_pushed_dir(self, src, dst): for root, _, files in os.walk(src): From a8e3bcc0cd0bd9d757b8490fbd643e89e4229efe Mon Sep 17 00:00:00 2001 From: jiyong_sd Date: Tue, 1 Mar 2022 16:35:36 +0800 Subject: [PATCH 2/2] modified xdevice Signed-off-by: jiyong_sd Change-Id: Iab7be5abb8ad49e80086face9035b52b62b0cc9d --- extension/src/xdevice_extension/_core/testkit/kit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extension/src/xdevice_extension/_core/testkit/kit.py b/extension/src/xdevice_extension/_core/testkit/kit.py index 9eca083..6e098e2 100644 --- a/extension/src/xdevice_extension/_core/testkit/kit.py +++ b/extension/src/xdevice_extension/_core/testkit/kit.py @@ -163,10 +163,11 @@ class PushKit(ITestKit): dst)) LOG.debug( "Push file finished from {} to {}".format( - os.path.join(root, file), dst)) + os.path.join(root, file), dst)) self.pushed_file.append(file) else: - device.hdc_command("file send {} {}".format(real_src_path, dst)) + device.hdc_command("file send {} {}".format(real_src_path, + dst)) LOG.debug("Push file finished from {} to {}".format(src, dst)) self.pushed_file.append(real_src_path) for command in self.post_push: