File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
12import os
23import ast
4+ import fire
35
46def 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
7280if __name__ == "__main__" :
73- main ( )
81+ fire . Fire ( main )
You can’t perform that action at this time.
0 commit comments