From 0ea8a460062a3d7b72a51b99ecfa0de68a92dd09 Mon Sep 17 00:00:00 2001 From: wuliushuan Date: Mon, 19 Jun 2023 09:03:58 +0000 Subject: [PATCH] Specifies the script execution device number Signed-off-by: wuliushuan Change-Id: I5c5a39ffb1c4d0c4f8c27e1f2a303147ca96c000 --- .../screenshot32/acls_check/acl_check.py | 24 +++++++++++++++---- .../basic/screenshot32/acls_check/config.py | 19 ++++++++++++--- .../acls_check/read_acl_whitelist.py | 13 ++++++++++ .../acls_check/resolve_token_info.py | 13 ++++++++++ .../basic/screenshot32/acls_check/utils.py | 13 ++++++++++ 5 files changed, 74 insertions(+), 8 deletions(-) diff --git a/cases/smoke/basic/screenshot32/acls_check/acl_check.py b/cases/smoke/basic/screenshot32/acls_check/acl_check.py index f5be4ddb..7f9238d6 100644 --- a/cases/smoke/basic/screenshot32/acls_check/acl_check.py +++ b/cases/smoke/basic/screenshot32/acls_check/acl_check.py @@ -1,3 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 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. import os import sys @@ -35,13 +48,13 @@ def whitelist_check(whitelist, acls): raise -def main(): +def main(sn): set_log_content(LogLevel(2).name, log_tag, '-------------------------- ACL check begin --------------------------') try: - hdc_command(GENERATING_TOKEN_INFO_COMMAND) - hdc_command(DOWNLOAD_TOKEN_INFO_COMMAND) - hdc_command(CLEAR_TOKEN_INFO_FILE) + hdc_command(GENERATING_TOKEN_INFO_COMMAND.format(sn, TOKEN_INFO_URL)) + hdc_command(DOWNLOAD_TOKEN_INFO_COMMAND.format(sn, TOKEN_INFO_URL, DOWNLOAD_TOKEN_INFO_URL)) + hdc_command(CLEAR_TOKEN_INFO_FILE.format(sn, TOKEN_INFO_URL)) file = read_txt(DOWNLOAD_TOKEN_INFO_URL) clear_token_info_txt(DOWNLOAD_TOKEN_INFO_URL) acls_dict = check_and_get(file) @@ -58,4 +71,5 @@ def main(): if __name__ == '__main__': - main() + sn = sys.argv[1] + main(sn) diff --git a/cases/smoke/basic/screenshot32/acls_check/config.py b/cases/smoke/basic/screenshot32/acls_check/config.py index dd6281cc..90ae5585 100644 --- a/cases/smoke/basic/screenshot32/acls_check/config.py +++ b/cases/smoke/basic/screenshot32/acls_check/config.py @@ -1,3 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 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. import os import platform import time @@ -15,10 +28,10 @@ TOKEN_INFO_NAME = 'token_info_{}.txt'.format(time.time_ns()) # 设备上生成文件存放位置 TOKEN_INFO_URL = '/data/{}'.format(TOKEN_INFO_NAME) # 设备上文件生成命令 -GENERATING_TOKEN_INFO_COMMAND = 'hdc shell atm dump -t > {}'.format(TOKEN_INFO_URL) +GENERATING_TOKEN_INFO_COMMAND = 'hdc -t {} shell atm dump -t > {}' # 下载token info 文件存放路径 DOWNLOAD_TOKEN_INFO_URL = PATH + TOKEN_INFO_NAME # 文件下载命令 -DOWNLOAD_TOKEN_INFO_COMMAND = 'hdc file recv {} {}'.format(TOKEN_INFO_URL, DOWNLOAD_TOKEN_INFO_URL) +DOWNLOAD_TOKEN_INFO_COMMAND = 'hdc -t {} file recv {} {}' # 删除设备上的文件命令 -CLEAR_TOKEN_INFO_FILE = 'hdc shell rm -rf {}'.format(TOKEN_INFO_URL) +CLEAR_TOKEN_INFO_FILE = 'hdc -t {} shell rm -rf {}' diff --git a/cases/smoke/basic/screenshot32/acls_check/read_acl_whitelist.py b/cases/smoke/basic/screenshot32/acls_check/read_acl_whitelist.py index 59538c01..80295085 100644 --- a/cases/smoke/basic/screenshot32/acls_check/read_acl_whitelist.py +++ b/cases/smoke/basic/screenshot32/acls_check/read_acl_whitelist.py @@ -1,3 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 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. import os import sys diff --git a/cases/smoke/basic/screenshot32/acls_check/resolve_token_info.py b/cases/smoke/basic/screenshot32/acls_check/resolve_token_info.py index 25db52ac..6c2d16c9 100644 --- a/cases/smoke/basic/screenshot32/acls_check/resolve_token_info.py +++ b/cases/smoke/basic/screenshot32/acls_check/resolve_token_info.py @@ -1,3 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 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. import os import sys diff --git a/cases/smoke/basic/screenshot32/acls_check/utils.py b/cases/smoke/basic/screenshot32/acls_check/utils.py index fc3d4c2a..545ae46c 100644 --- a/cases/smoke/basic/screenshot32/acls_check/utils.py +++ b/cases/smoke/basic/screenshot32/acls_check/utils.py @@ -1,3 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 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. import enum import logging import os