update fuzz

This commit is contained in:
gmlwns2000
2022-03-15 20:26:33 +09:00
committed by Jeehoon Kang
parent d2ecfe629a
commit 7ffd357fde

View File

@@ -261,11 +261,10 @@ def fuzz(tests_dir, fuzz_arg, num_iter, easy=False):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Fuzzing KECC.')
parser.add_argument('-n', '--num', type=int, help='The number of tests', default=None)
parser.add_argument('-n', '--num', type=int, help='The number of tests')
parser.add_argument('-p', '--print', action='store_true', help='Fuzzing C AST printer')
parser.add_argument('-i', '--irgen', action='store_true', help='Fuzzing irgen')
parser.add_argument('-r', '--reduce', action='store_true', help="Reducing input file")
parser.add_argument('--skip-build', action='store_true', help="Skipping cargo build")
parser.add_argument('--easy', action='store_true', help="Generate more easy code by csmith option")
parser.add_argument('--seed', type=int, help="Provide seed of fuzz generation", default=-1)
args = parser.parse_args()
@@ -288,16 +287,13 @@ if __name__ == "__main__":
tests_dir = os.path.abspath(os.path.dirname(__file__))
if not args.skip_build:
print("Building KECC..")
try:
proc = subprocess.Popen(["cargo", "build", "--release"], cwd=tests_dir)
proc.communicate()
except subprocess.TimeoutExpired as e:
proc.kill()
raise e
else:
print("Skip building. You should manually build the binary. Please execute `cargo build --release` to build.")
print("Building KECC..")
try:
proc = subprocess.Popen(["cargo", "build", "--release"], cwd=tests_dir)
proc.communicate()
except subprocess.TimeoutExpired as e:
proc.kill()
raise e
if args.reduce:
creduce(tests_dir, fuzz_arg)