From 4e539996d6666f62611b366ed487017990a7196e Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Thu, 23 Jan 2025 03:17:01 +0000 Subject: [PATCH 01/13] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20gated=5Fcheck=5Fin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/gated_check_in/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tools/gated_check_in/.keep diff --git a/tools/gated_check_in/.keep b/tools/gated_check_in/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From b79faebdd512070a435d8b1ac441af956ad5cef8 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Thu, 23 Jan 2025 03:18:07 +0000 Subject: [PATCH 02/13] add tools/gated_check_in/check_tdd.py. Signed-off-by: liangliang6768 --- tools/gated_check_in/check_tdd.py | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tools/gated_check_in/check_tdd.py diff --git a/tools/gated_check_in/check_tdd.py b/tools/gated_check_in/check_tdd.py new file mode 100644 index 0000000..4b33812 --- /dev/null +++ b/tools/gated_check_in/check_tdd.py @@ -0,0 +1,61 @@ +import json +import subprocess +import argparse +import os + + +def check_file_paths(json_data): + check_result = True + for key in json_data: + changed_file_list = json_data[key]["changed_file_list"] + if "added" in changed_file_list: + for file_path in changed_file_list["added"]: + if "test" not in file_path: + check_result = False + if "modified" in changed_file_list: + for file_path in changed_file_list["modified"]: + if "test" not in file_path: + check_result = False + if "deleted" in changed_file_list: + for file_path in changed_file_list["deleted"]: + if "test" not in file_path: + check_result = False + if "rename" in changed_file_list: + for rename_pair in changed_file_list["rename"]: + if "test" not in rename_pair[1]: + check_result = False + return check_result + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--build', required=True) + args = parser.parse_args() + build_command = args.build + command_list = build_command.split() + try: + with open('change_info.json', 'r') as file: + change_info = json.load(file) + except Exception as e: + print(f'An unexpected error occurred: {e}') + try: + result = subprocess.run(command_list, text=True, check=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print(f'Command execution failed: {e}') + exit(1) + else: + if check_file_paths(change_info): + print('Modify only test cases and do not need to be executed') + if not os.path.exists('out'): + os.mkdir('out') + file_path = 'out/smoke_check.json' + with open(file_path, 'w') as f: + json.dump({}, f) + else: + try: + result = subprocess.run(command_list, text=True, check=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print(f'Command execution failed: {e}') + exit(1) \ No newline at end of file -- Gitee From 3de95129463dbfe82884310dd76aa37154b7a741 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Thu, 13 Feb 2025 08:26:35 +0000 Subject: [PATCH 03/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_tdd.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/gated_check_in/check_tdd.py b/tools/gated_check_in/check_tdd.py index 4b33812..a652b6a 100644 --- a/tools/gated_check_in/check_tdd.py +++ b/tools/gated_check_in/check_tdd.py @@ -10,23 +10,31 @@ def check_file_paths(json_data): changed_file_list = json_data[key]["changed_file_list"] if "added" in changed_file_list: for file_path in changed_file_list["added"]: - if "test" not in file_path: + if not check_directory_matches(file_path, "test"): check_result = False if "modified" in changed_file_list: for file_path in changed_file_list["modified"]: - if "test" not in file_path: + if not check_directory_matches(file_path, "test"): check_result = False if "deleted" in changed_file_list: for file_path in changed_file_list["deleted"]: - if "test" not in file_path: + if not check_directory_matches(file_path, "test"): check_result = False if "rename" in changed_file_list: for rename_pair in changed_file_list["rename"]: - if "test" not in rename_pair[1]: + if not check_directory_matches(rename_pair[1], "test"): check_result = False return check_result +def check_directory_matches(path_str, target_str): + parts = path_str.split('/') + for part in parts: + if part == target_str: + return True + return False + + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--build', required=True) -- Gitee From 74e8de3a410abbb3209320d71da3618b1e6b08ab Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Thu, 13 Feb 2025 08:26:47 +0000 Subject: [PATCH 04/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20to?= =?UTF-8?q?ols/gated=5Fcheck=5Fin/.keep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/gated_check_in/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/gated_check_in/.keep diff --git a/tools/gated_check_in/.keep b/tools/gated_check_in/.keep deleted file mode 100644 index e69de29..0000000 -- Gitee From bb8df820510248309541833e980a904081498b0e Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Thu, 27 Feb 2025 08:57:46 +0000 Subject: [PATCH 05/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 69 +++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tools/gated_check_in/check_webview.py diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py new file mode 100644 index 0000000..5795ed5 --- /dev/null +++ b/tools/gated_check_in/check_webview.py @@ -0,0 +1,69 @@ +import json +import subprocess +import argparse +import os + + +def check_file_paths(json_data): + check_result = False + for key in json_data: + if key =='base/web/webview': + changed_file_list = json_data[key]["changed_file_list"] + if "added" in changed_file_list: + for file_path in changed_file_list["added"]: + if check_directory_matches(file_path, "ohos_interface"): + check_result = True + return check_result + if "modified" in changed_file_list: + for file_path in changed_file_list["modified"]: + if check_directory_matches(file_path, "ohos_interface"): + check_result = True + return check_result + if "deleted" in changed_file_list: + for file_path in changed_file_list["deleted"]: + if check_directory_matches(file_path, "ohos_interface"): + check_result = True + return check_result + if "rename" in changed_file_list: + for rename_pair in changed_file_list["rename"]: + if check_directory_matches(rename_pair[1], "ohos_interface"): + check_result = True + return check_result + return check_result + + +def check_directory_matches(path_str, target_str): + parts = path_str.split('/') + for part in parts: + if part == target_str: + return True + return False + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--build', required=True) + args = parser.parse_args() + build_command = args.build + command_list = build_command.split() + try: + with open('change_info.json', 'r') as file: + change_info = json.load(file) + except Exception as e: + print(f'An unexpected error occurred: {e}') + try: + result = subprocess.run(command_list, text=True, check=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print(f'Command execution failed: {e}') + exit(1) + else: + if check_file_paths(change_info): + try: + result = subprocess.run(command_list, text=True, check=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print(f'Command execution failed: {e}') + exit(1) + else: + print('do not need to build') -- Gitee From 1e3e7c86f310ac3f9cc270a628807e318215c43a Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Fri, 28 Feb 2025 03:25:09 +0000 Subject: [PATCH 06/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 5795ed5..0fed086 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -55,7 +55,7 @@ if __name__ == '__main__': result = subprocess.run(command_list, text=True, check=True) print(result.stdout) except subprocess.CalledProcessError as e: - print(f'Command execution failed: {e}') + print('Command execution failed') exit(1) else: if check_file_paths(change_info): @@ -63,7 +63,7 @@ if __name__ == '__main__': result = subprocess.run(command_list, text=True, check=True) print(result.stdout) except subprocess.CalledProcessError as e: - print(f'Command execution failed: {e}') + print('Command execution failed') exit(1) else: print('do not need to build') -- Gitee From 4a3f23e22f088af01626711285c00b122eba72e4 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Fri, 28 Feb 2025 06:06:49 +0000 Subject: [PATCH 07/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 0fed086..8aad258 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -50,7 +50,7 @@ if __name__ == '__main__': with open('change_info.json', 'r') as file: change_info = json.load(file) except Exception as e: - print(f'An unexpected error occurred: {e}') + print('An unexpected error occurred') try: result = subprocess.run(command_list, text=True, check=True) print(result.stdout) -- Gitee From 8462f7d5e865c49b84ee24cd0187c972df9bc17f Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Fri, 28 Feb 2025 07:36:13 +0000 Subject: [PATCH 08/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 8aad258..32e9b05 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -4,6 +4,7 @@ import argparse import os + def check_file_paths(json_data): check_result = False for key in json_data: @@ -52,7 +53,7 @@ if __name__ == '__main__': except Exception as e: print('An unexpected error occurred') try: - result = subprocess.run(command_list, text=True, check=True) + run_build_command(command_list) print(result.stdout) except subprocess.CalledProcessError as e: print('Command execution failed') @@ -60,7 +61,7 @@ if __name__ == '__main__': else: if check_file_paths(change_info): try: - result = subprocess.run(command_list, text=True, check=True) + run_build_command(command_list) print(result.stdout) except subprocess.CalledProcessError as e: print('Command execution failed') -- Gitee From 47b8b083cb5e533abed84a91c2f7d34724850a9a Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Fri, 28 Feb 2025 09:11:33 +0000 Subject: [PATCH 09/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 32e9b05..fe3645a 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -40,6 +40,15 @@ def check_directory_matches(path_str, target_str): return True return False +def run_build_command(command_list): + process = subprocess.Popen(command_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + if process.returncode != 0: + print('Command execution failed: %s' % stderr) + import sys + sys.exit(1) + print(stdout) + if __name__ == '__main__': parser = argparse.ArgumentParser() @@ -52,19 +61,9 @@ if __name__ == '__main__': change_info = json.load(file) except Exception as e: print('An unexpected error occurred') - try: - run_build_command(command_list) - print(result.stdout) - except subprocess.CalledProcessError as e: - print('Command execution failed') - exit(1) + run_build_command(command_list) else: if check_file_paths(change_info): - try: - run_build_command(command_list) - print(result.stdout) - except subprocess.CalledProcessError as e: - print('Command execution failed') - exit(1) + run_build_command(command_list) else: print('do not need to build') -- Gitee From 239af29655180d747dea7ce80309e3bec8ea6a75 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Sat, 1 Mar 2025 02:35:02 +0000 Subject: [PATCH 10/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index fe3645a..137b365 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -40,30 +40,38 @@ def check_directory_matches(path_str, target_str): return True return False -def run_build_command(command_list): - process = subprocess.Popen(command_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = process.communicate() - if process.returncode != 0: - print('Command execution failed: %s' % stderr) - import sys - sys.exit(1) - print(stdout) +def run_build_command(): + commands = [ + "./prebuilts_download.sh", + ["bash", "build.sh", "rk3568", "-t", "w", "-A", "-ccache"], + "./sign.sh rk3568" + ] + for command in commands: + try: + if isinstance(command, str): + command = command.split() + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + if process.returncode != 0: + print('Command execution failed: %s' % stderr) + break + else: + print(stdout) + except Exception as e: + print('An unexpected error occurred: %s' % e) + break + if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--build', required=True) - args = parser.parse_args() - build_command = args.build - command_list = build_command.split() try: with open('change_info.json', 'r') as file: change_info = json.load(file) except Exception as e: print('An unexpected error occurred') - run_build_command(command_list) + run_build_command() else: if check_file_paths(change_info): - run_build_command(command_list) + run_build_command() else: print('do not need to build') -- Gitee From 962a86001b36b400cad2a5d41e53148325a5e88c Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Wed, 12 Mar 2025 06:58:51 +0000 Subject: [PATCH 11/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 137b365..c372a3d 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -54,12 +54,12 @@ def run_build_command(): stdout, stderr = process.communicate() if process.returncode != 0: print('Command execution failed: %s' % stderr) - break + exit(1) else: print(stdout) except Exception as e: print('An unexpected error occurred: %s' % e) - break + exit(1) -- Gitee From 2905af420cbd094d0c856f653f64dd017efa8842 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Mon, 17 Mar 2025 07:04:31 +0000 Subject: [PATCH 12/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index c372a3d..90395ff 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -50,8 +50,14 @@ def run_build_command(): try: if isinstance(command, str): command = command.split() - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) stdout, stderr = process.communicate() + if stdout: + print("Standard Output:") + print(stdout) + if stderr: + print("Standard Error:") + print(stderr) if process.returncode != 0: print('Command execution failed: %s' % stderr) exit(1) -- Gitee From 383377e8e73414d522f00eea859f2e1f87ff8bd2 Mon Sep 17 00:00:00 2001 From: liangliang6768 Date: Mon, 17 Mar 2025 07:47:34 +0000 Subject: [PATCH 13/13] 11 Signed-off-by: liangliang6768 --- tools/gated_check_in/check_webview.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tools/gated_check_in/check_webview.py b/tools/gated_check_in/check_webview.py index 90395ff..c372a3d 100644 --- a/tools/gated_check_in/check_webview.py +++ b/tools/gated_check_in/check_webview.py @@ -50,14 +50,8 @@ def run_build_command(): try: if isinstance(command, str): command = command.split() - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() - if stdout: - print("Standard Output:") - print(stdout) - if stderr: - print("Standard Error:") - print(stderr) if process.returncode != 0: print('Command execution failed: %s' % stderr) exit(1) -- Gitee