From 2799c22fd10506a45df7b84a2352def6c31067ee Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 31 Aug 2017 11:48:27 -0400 Subject: Avoid variable overwrite I hate (and always forget) how Python list comprehensions leak the iteration variable. --- src/scripts/test_fuzzers.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/scripts') diff --git a/src/scripts/test_fuzzers.py b/src/scripts/test_fuzzers.py index b00ef0405..c4c2ef589 100755 --- a/src/scripts/test_fuzzers.py +++ b/src/scripts/test_fuzzers.py @@ -102,9 +102,9 @@ def main(args=None): run_fuzzer_func = run_fuzzer_gdb if options.gdb else run_fuzzer - for f in sorted(list(fuzzers_with_corpus)): - fuzzer_bin = os.path.join(fuzzer_dir, f) - corpus_subdir = os.path.join(corpus_dir, f) + for fuzzer in sorted(list(fuzzers_with_corpus)): + fuzzer_bin = os.path.join(fuzzer_dir, fuzzer) + corpus_subdir = os.path.join(corpus_dir, fuzzer) corpus_files = [os.path.join(corpus_subdir, l) for l in sorted(list(os.listdir(corpus_subdir)))] # We have to do this hack because multiprocessing's Pool.map doesn't support @@ -115,18 +115,18 @@ def main(args=None): (corpus_file, retcode, stdout, stderr) = result if retcode != 0: - print("Fuzzer %s crashed with input %s returncode %d" % (f, corpus_file, retcode)) + print("Fuzzer %s crashed with input %s returncode %d" % (fuzzer, corpus_file, retcode)) crash_count += 1 if len(stdout) != 0: - print("Fuzzer %s produced stdout on input %s:\n%s" % (f, corpus_file, stdout)) + print("Fuzzer %s produced stdout on input %s:\n%s" % (fuzzer, corpus_file, stdout)) stdout_count += 1 if len(stderr) != 0: - print("Fuzzer %s produced stderr on input %s:\n%s" % (f, corpus_file, stderr)) + print("Fuzzer %s produced stderr on input %s:\n%s" % (fuzzer, corpus_file, stderr)) stderr_count += 1 - print("Tested fuzzer %s with %d test cases, %d crashes" % (f, len(corpus_files), crash_count)) + print("Tested fuzzer %s with %d test cases, %d crashes" % (fuzzer, len(corpus_files), crash_count)) sys.stdout.flush() if crash_count > 0 or stderr_count > 0 or stdout_count > 0: -- cgit v1.2.3