未验证 提交 98b38000 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #19294 from taosdata/test/TD-21262

test: update script for crash_gen
...@@ -324,7 +324,7 @@ def main(): ...@@ -324,7 +324,7 @@ def main():
print( " crash_gen.sh is not exists ") print( " crash_gen.sh is not exists ")
sys.exit(1) sys.exit(1)
git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[8:16] git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16]
# crash_cmds = get_cmds() # crash_cmds = get_cmds()
...@@ -348,15 +348,12 @@ def main(): ...@@ -348,15 +348,12 @@ def main():
else: else:
print('======== crash_gen run sucess and exit as expected ========') print('======== crash_gen run sucess and exit as expected ========')
try:
if status!=0 : text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}"
send_msg(get_msg(text))
try: except Exception as e:
text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}" print("exception:", e)
send_msg(get_msg(text)) exit(status)
except Exception as e:
print("exception:", e)
exit(status)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -357,7 +357,7 @@ def main(): ...@@ -357,7 +357,7 @@ def main():
print( " crash_gen.sh is not exists ") print( " crash_gen.sh is not exists ")
sys.exit(1) sys.exit(1)
git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[8:16] git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16]
# crash_cmds = get_cmds() # crash_cmds = get_cmds()
...@@ -383,14 +383,12 @@ def main(): ...@@ -383,14 +383,12 @@ def main():
else: else:
print('======== crash_gen run sucess and exit as expected ========') print('======== crash_gen run sucess and exit as expected ========')
if status!=0 : try:
text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}"
try: send_msg(get_msg(text))
text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}" except Exception as e:
send_msg(get_msg(text)) print("exception:", e)
except Exception as e: exit(status)
print("exception:", e)
exit(status)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -357,7 +357,7 @@ def main(): ...@@ -357,7 +357,7 @@ def main():
print( " crash_gen.sh is not exists ") print( " crash_gen.sh is not exists ")
sys.exit(1) sys.exit(1)
git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[8:16] git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16]
# crash_cmds = get_cmds() # crash_cmds = get_cmds()
...@@ -383,14 +383,12 @@ def main(): ...@@ -383,14 +383,12 @@ def main():
else: else:
print('======== crash_gen run sucess and exit as expected ========') print('======== crash_gen run sucess and exit as expected ========')
if status!=0 : try:
text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}"
try: send_msg(get_msg(text))
text = f"crash_gen instance exit status of docker [ {hostname} ] is : {msg_dict[status]}\n " + f" and git commit : {git_commit}" except Exception as e:
send_msg(get_msg(text)) print("exception:", e)
except Exception as e: exit(status)
print("exception:", e)
exit(status)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册