@@ -67,9 +67,12 @@ def main():
67
67
if cargs .stop_afl :
68
68
return not stop_afl (cargs )
69
69
70
- if not validate_args (cargs ):
70
+ if not validate_cargs (cargs ):
71
71
return exit_failure
72
72
73
+ if cargs .validate_args :
74
+ return exit_success
75
+
73
76
if cargs .func_search or cargs .line_search :
74
77
return not search_cov (cargs )
75
78
@@ -175,6 +178,9 @@ def process_afl_test_cases(cargs):
175
178
out_lines = run_cmd (cargs .coverage_cmd .replace ('AFL_FILE' , f ),
176
179
cov_paths ['log_file' ], cargs , WANT_OUTPUT )[1 ]
177
180
run_once = True
181
+
182
+ tot_files += 1
183
+
178
184
# capture coverage
179
185
run_cmd (cargs .lcov_path +
180
186
lcov_opts +
@@ -932,6 +938,8 @@ def is_gcov_enabled(binary, cargs):
932
938
for line in run_cmd ("%s -a %s" % (cargs .readelf_path , binary ),
933
939
False , cargs , WANT_OUTPUT )[1 ]:
934
940
if ' __gcov' in line :
941
+ if cargs .validate_args :
942
+ print " Binary '%s' is compiled with code coverage support." % binary
935
943
rv = True
936
944
break
937
945
@@ -977,7 +985,7 @@ def check_requirements(cargs):
977
985
978
986
return False
979
987
980
- def validate_args (cargs ):
988
+ def validate_cargs (cargs ):
981
989
982
990
if cargs .coverage_cmd :
983
991
if 'AFL_FILE' not in cargs .coverage_cmd :
@@ -1245,6 +1253,8 @@ def parse_cmdline():
1245
1253
p .add_argument ("--stop-afl" , action = 'store_true' ,
1246
1254
help = "Stop all running afl-fuzz instances associated with --afl-fuzzing-dir <dir>" ,
1247
1255
default = False )
1256
+ p .add_argument ("--validate-args" , action = 'store_true' ,
1257
+ help = "Validate args and exit" , default = False )
1248
1258
p .add_argument ("-v" , "--verbose" , action = 'store_true' ,
1249
1259
help = "Verbose mode" , default = False )
1250
1260
p .add_argument ("-V" , "--version" , action = 'store_true' ,
0 commit comments