-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test.py
More file actions
42 lines (29 loc) · 1020 Bytes
/
run_test.py
File metadata and controls
42 lines (29 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import os
import subprocess
import sys
import argparse
def main():
# 打印脚本运行信息
print("✨ 测试脚本开始运行...")
# 构建项目
if subprocess.run("xmake f -m debug && xmake", shell=True).returncode != 0:
print("✖️ 构建失败")
sys.exit(1)
print("✅ 构建成功")
print("✨ 运行Testkit...")
# 设置环境变量
env = os.environ.copy()
env["TK_VERBOSE"] = "1"
# 运行测试,运行目录: ./build
subprocess.run(["./sperf"], env=env, cwd="./build", check=False)
print("✅ Testkit运行结束")
print("✨ 运行valgrind...")
subprocess.run(["valgrind", "--tool=memcheck",
"--show-leak-kinds=all", "--leak-check=full",
"-q",
"./sperf","ls","./"], cwd="./build", check=False)
print("✅ valgrind运行结束")
print("✨ 脚本运行完毕!")
if __name__ == "__main__":
main()