Skip to content

Commit ab6813d

Browse files
committed
use FIre
1 parent e3e5546 commit ab6813d

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

fuzz/modify_fuzz_files.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env python3
12
import os
23
import ast
4+
import fire
35

46
def add_print_to_testoneinput(file_path):
57
with open(file_path, 'r') as f:
@@ -36,13 +38,19 @@ def visit_FunctionDef(self, node):
3638
# 转回代码
3739
import astor
3840
new_content = astor.to_source(new_tree)
39-
4041
return new_content
4142

42-
def main():
43-
projects_path = "/home/jiayiguo/FuzzAug/fuzz/oss-fuzz/projects"
44-
valid_projects_file = "data/valid_projects.txt"
43+
def main(
44+
projects_path="/home/jiayiguo/FuzzAug/fuzz/oss-fuzz/projects",
45+
valid_projects_file="data/valid_projects.txt"
46+
):
47+
"""
48+
给 fuzz target 的 TestOneInput / TestInput 函数开头插入 print(参数名)
4549
50+
Args:
51+
projects_path (str): OSS-Fuzz 项目的根目录
52+
valid_projects_file (str): 包含有效项目名的文件路径
53+
"""
4654
with open(valid_projects_file, 'r') as f:
4755
projects = [line.strip() for line in f if line.strip()]
4856

@@ -70,4 +78,4 @@ def main():
7078
print(f"Error processing {file_path}: {str(e)}")
7179

7280
if __name__ == "__main__":
73-
main()
81+
fire.Fire(main)

0 commit comments

Comments
 (0)