From 9d11a87e531ee99e8df5efd065dd7293cee2ea7d Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:03:28 +0800 Subject: [PATCH 1/6] test:alter crashgen report --- tests/pytest/auto_crash_gen.py | 50 ++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/tests/pytest/auto_crash_gen.py b/tests/pytest/auto_crash_gen.py index 4e4679db6a..26cd303d62 100755 --- a/tests/pytest/auto_crash_gen.py +++ b/tests/pytest/auto_crash_gen.py @@ -16,7 +16,18 @@ msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: # formal hostname = socket.gethostname() -group_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9' +group_url_test = ( + 'https://open.feishu.cn/open-apis/bot/v2/hook/7e409a8e-4390-4043-80d0-4e0dd2cbae7d' +) + +notification_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9" +) + +alert_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/02363732-91f1-49c4-879c-4e98cf31a5f3" +) + def get_msg(text): return { @@ -37,12 +48,12 @@ def get_msg(text): } -def send_msg(json): +def send_msg(url:str,json:dict): headers = { 'Content-Type': 'application/json' } - req = requests.post(url=group_url, headers=headers, json=json) + req = requests.post(url=url, headers=headers, json=json) inf = req.json() if "StatusCode" in inf and inf["StatusCode"] == 0: pass @@ -355,18 +366,27 @@ def main(): core_dir = "none" text = f''' - exit status: {msg_dict[status]} - test scope: crash_gen - owner: pxiao - hostname: {hostname} - start time: {starttime} - end time: {endtime} - git commit : {git_commit} - log dir: {log_dir} - core dir: {core_dir} - cmd: {cmd}''' - - send_msg(get_msg(text)) + Result: {msg_dict[status]} + + Details + Owner: Jayden Jia + Start time: {starttime} + End time: {endtime} + Hostname: {hostname} + Commit: {git_commit} + Cmd: {cmd} + Log dir: {log_dir} + Core dir: {core_dir} + ''' + text_result=text.split("Result: ")[1].split("Details")[0].strip() + print(text_result) + + if text_result == "success": + send_msg(notification_robot_url, get_msg(text)) + else: + send_msg(alert_robot_url, get_msg(text)) + + #send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) From 4a05f3ffd0cbe60ee1a50681623816137dfb2ab5 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:03:42 +0800 Subject: [PATCH 2/6] test:alter crashgen report --- tests/pytest/auto_crash_gen_valgrind.py | 52 +++++++++++++++++-------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/tests/pytest/auto_crash_gen_valgrind.py b/tests/pytest/auto_crash_gen_valgrind.py index 1e0de6ace1..9eab6acf3b 100755 --- a/tests/pytest/auto_crash_gen_valgrind.py +++ b/tests/pytest/auto_crash_gen_valgrind.py @@ -19,7 +19,18 @@ msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: # formal hostname = socket.gethostname() -group_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9' +group_url_test = ( + 'https://open.feishu.cn/open-apis/bot/v2/hook/7e409a8e-4390-4043-80d0-4e0dd2cbae7d' +) + +notification_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9" +) + +alert_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/02363732-91f1-49c4-879c-4e98cf31a5f3" +) + def get_msg(text): return { @@ -40,13 +51,12 @@ def get_msg(text): } -def send_msg(json): +def send_msg(url:str,json:dict): headers = { 'Content-Type': 'application/json' } - - req = requests.post(url=group_url, headers=headers, json=json) + req = requests.post(url=url, headers=headers, json=json) inf = req.json() if "StatusCode" in inf and inf["StatusCode"] == 0: pass @@ -389,18 +399,28 @@ def main(): core_dir = "none" text = f''' - exit status: {msg_dict[status]} - test scope: crash_gen - owner: pxiao - hostname: {hostname} - start time: {starttime} - end time: {endtime} - git commit : {git_commit} - log dir: {log_dir} - core dir: {core_dir} - cmd: {cmd}''' - - send_msg(get_msg(text)) + Result: {msg_dict[status]} + + Details + Owner: Jayden Jia + Start time: {starttime} + End time: {endtime} + Hostname: {hostname} + Commit: {git_commit} + Cmd: {cmd} + Log dir: {log_dir} + Core dir: {core_dir} + ''' + + text_result=text.split("Result: ")[1].split("Details")[0].strip() + print(text_result) + + if text_result == "success": + send_msg(notification_robot_url, get_msg(text)) + else: + send_msg(alert_robot_url, get_msg(text)) + + #send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) From d426209113a3b10c4d507283e8a94da5e17568d8 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:03:53 +0800 Subject: [PATCH 3/6] test:alter crashgen report --- .../pytest/auto_crash_gen_valgrind_cluster.py | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/tests/pytest/auto_crash_gen_valgrind_cluster.py b/tests/pytest/auto_crash_gen_valgrind_cluster.py index 22f453e51e..b6c98fbf94 100755 --- a/tests/pytest/auto_crash_gen_valgrind_cluster.py +++ b/tests/pytest/auto_crash_gen_valgrind_cluster.py @@ -16,7 +16,18 @@ msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: # formal hostname = socket.gethostname() -group_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9' +group_url_test = ( + 'https://open.feishu.cn/open-apis/bot/v2/hook/7e409a8e-4390-4043-80d0-4e0dd2cbae7d' +) + +notification_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/56c333b5-eae9-4c18-b0b6-7e4b7174f5c9" +) + +alert_robot_url = ( + "https://open.feishu.cn/open-apis/bot/v2/hook/02363732-91f1-49c4-879c-4e98cf31a5f3" +) + def get_msg(text): return { @@ -37,12 +48,12 @@ def get_msg(text): } -def send_msg(json): +def send_msg(url:str,json:dict): headers = { 'Content-Type': 'application/json' } - req = requests.post(url=group_url, headers=headers, json=json) + req = requests.post(url=url, headers=headers, json=json) inf = req.json() if "StatusCode" in inf and inf["StatusCode"] == 0: pass @@ -376,18 +387,28 @@ def main(): core_dir = "none" text = f''' - exit status: {msg_dict[status]} - test scope: crash_gen - owner: pxiao - hostname: {hostname} - start time: {starttime} - end time: {endtime} - git commit : {git_commit} - log dir: {log_dir} - core dir: {core_dir} - cmd: {cmd}''' - - send_msg(get_msg(text)) + Result: {msg_dict[status]} + + Details + Owner: Jayden Jia + Start time: {starttime} + End time: {endtime} + Hostname: {hostname} + Commit: {git_commit} + Cmd: {cmd} + Log dir: {log_dir} + Core dir: {core_dir} + ''' + + text_result=text.split("Result: ")[1].split("Details")[0].strip() + print(text_result) + + if text_result == "success": + send_msg(notification_robot_url, get_msg(text)) + else: + send_msg(alert_robot_url, get_msg(text)) + + #send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) From 69604c2d7dafe8b826546bf1b27e62bc97180697 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:05:44 +0800 Subject: [PATCH 4/6] test:alter crashgen report --- .../pytest/auto_crash_gen_valgrind_cluster.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/pytest/auto_crash_gen_valgrind_cluster.py b/tests/pytest/auto_crash_gen_valgrind_cluster.py index b6c98fbf94..522ad48640 100755 --- a/tests/pytest/auto_crash_gen_valgrind_cluster.py +++ b/tests/pytest/auto_crash_gen_valgrind_cluster.py @@ -387,18 +387,18 @@ def main(): core_dir = "none" text = f''' - Result: {msg_dict[status]} +Result: {msg_dict[status]} - Details - Owner: Jayden Jia - Start time: {starttime} - End time: {endtime} - Hostname: {hostname} - Commit: {git_commit} - Cmd: {cmd} - Log dir: {log_dir} - Core dir: {core_dir} - ''' +Details +Owner: Jayden Jia +Start time: {starttime} +End time: {endtime} +Hostname: {hostname} +Commit: {git_commit} +Cmd: {cmd} +Log dir: {log_dir} +Core dir: {core_dir} +''' text_result=text.split("Result: ")[1].split("Details")[0].strip() print(text_result) From 7baf37162885a6b293f2bfee11129afbf5668eae Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:05:51 +0800 Subject: [PATCH 5/6] test:alter crashgen report --- tests/pytest/auto_crash_gen_valgrind.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/pytest/auto_crash_gen_valgrind.py b/tests/pytest/auto_crash_gen_valgrind.py index 9eab6acf3b..b346aca308 100755 --- a/tests/pytest/auto_crash_gen_valgrind.py +++ b/tests/pytest/auto_crash_gen_valgrind.py @@ -399,18 +399,18 @@ def main(): core_dir = "none" text = f''' - Result: {msg_dict[status]} - - Details - Owner: Jayden Jia - Start time: {starttime} - End time: {endtime} - Hostname: {hostname} - Commit: {git_commit} - Cmd: {cmd} - Log dir: {log_dir} - Core dir: {core_dir} - ''' +Result: {msg_dict[status]} + +Details +Owner: Jayden Jia +Start time: {starttime} +End time: {endtime} +Hostname: {hostname} +Commit: {git_commit} +Cmd: {cmd} +Log dir: {log_dir} +Core dir: {core_dir} +''' text_result=text.split("Result: ")[1].split("Details")[0].strip() print(text_result) From c02e4085d6d81dde6399baf0c32038febd3912f9 Mon Sep 17 00:00:00 2001 From: happyguoxy Date: Thu, 21 Nov 2024 18:05:58 +0800 Subject: [PATCH 6/6] test:alter crashgen report --- tests/pytest/auto_crash_gen.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/pytest/auto_crash_gen.py b/tests/pytest/auto_crash_gen.py index 26cd303d62..f6b31b4691 100755 --- a/tests/pytest/auto_crash_gen.py +++ b/tests/pytest/auto_crash_gen.py @@ -366,18 +366,18 @@ def main(): core_dir = "none" text = f''' - Result: {msg_dict[status]} - - Details - Owner: Jayden Jia - Start time: {starttime} - End time: {endtime} - Hostname: {hostname} - Commit: {git_commit} - Cmd: {cmd} - Log dir: {log_dir} - Core dir: {core_dir} - ''' +Result: {msg_dict[status]} + +Details +Owner: Jayden Jia +Start time: {starttime} +End time: {endtime} +Hostname: {hostname} +Commit: {git_commit} +Cmd: {cmd} +Log dir: {log_dir} +Core dir: {core_dir} +''' text_result=text.split("Result: ")[1].split("Details")[0].strip() print(text_result)