From d4ef6aefd2093c375eab6b7f38807801f2ecc6ad Mon Sep 17 00:00:00 2001 From: AinL Date: Tue, 12 Apr 2022 09:15:20 +0900 Subject: [PATCH] Add using `--easy` flag for faster reducing in README.md (#4) * fuzz: add seed feature fuzz: add easy flag (ease csmith) * fuzz: remove inline prob flag * fuzz: fix clipboard error... * update fuzz * Add `--skip-build` option * readme: add using --easy for reduce * Update fuzzer manual Co-authored-by: Minseong Jang --- README.md | 25 ++++++++++++++++--------- tests/README.md | 9 +++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e4fa455..638d709 100644 --- a/README.md +++ b/README.md @@ -60,24 +60,33 @@ RUST_MIN_STACK=33554432 cargo test test_examples_end_to_end # run irgen, opti We encourage you to do homework using the test-driven development approach (TDD). You randomly generate test input, and if it fails, then reduce it as much as possible and manually inspect the -reduced test input. For example, for homework 1, do: +reduced test input. For example: ```sh -# randomly generates test inputs and tests them -python3 tests/fuzz.py --print +# Randomly generates simple test inputs and tests them. +# If this goes infinitely, then try without `--easy` option. It will generate more complicated code. +python3 tests/fuzz.py --easy -# reduces the failing test input as much as possible -python3 tests/fuzz.py --print --reduce +# Randomly generates test inputs and tests them +python3 tests/fuzz.py -# fix your code for the reduced test input +# Reduces the failing test input as much as possible +python3 tests/fuzz.py --reduce + +# Fix your code for the reduced test input cat tests/test_reduced.c ``` +`` can be `--print` or `--irgen`. It shall be the one used in [Run](#run). + +For more information on usage, please refer to the [Fuzzer User's Manual](tests/README.md). + ### Install ```sh # Ubuntu 20.04 sudo apt install -y build-essential clang make cmake python3 csmith libcsmith-dev creduce +pip3 install tqdm ``` ### Run @@ -103,7 +112,7 @@ Suppose `tests/test_polished.c` is the buggy input program. Then the following s program to `tests/test_reduced.c`: ```sh -python3 tests/fuzz.py --reduce +python3 tests/fuzz.py --reduce ``` `` can be `--print` or `--irgen`. It shall be the one used in [Run](#run). @@ -118,8 +127,6 @@ information, we refer to the [Creduce](https://embed.cs.utah.edu/creduce/) homep **[NOTICE]** The fuzzer supports Ubuntu 20.04 only. It may work for other platforms, but if it doesn't, please run the fuzzer in Ubuntu 20.04. -For more information on usage, please refer to the [Fuzzer User's Manual](tests/README.md). - ## Running RISC-V Binaries ### RISC-V Documentation diff --git a/tests/README.md b/tests/README.md index 00ceec0..be65a66 100644 --- a/tests/README.md +++ b/tests/README.md @@ -27,6 +27,7 @@ For now, fuzzer is supported only for Homework 1 (C AST Printer) and Homework 2 ```bash # Ubuntu 20.04 sudo apt install -y make cmake python3 csmith libcsmith-dev creduce +pip3 install tqdm ``` **[NOTICE]** The fuzzer supports Ubuntu 20.04 only. It may work for other platforms, but if it doesn't, please run the fuzzer in Ubuntu 20.04. @@ -46,6 +47,10 @@ Use `-h` option to display all available options. - Fuzzing ```bash + # Try infinitely many simple test cases until find a buggy one. + # If this goes infinitely, then try without `--easy` option. It will generate more complicated code. + python3 tests/fuzz.py -p --easy + # Try infinitely many test cases until find a buggy one. python3 tests/fuzz.py -p @@ -65,6 +70,10 @@ Use `-h` option to display all available options. - Fuzzing ```bash + # Try infinitely many simple test cases until find a buggy one. + # If this goes infinitely, then try without `--easy` option. It will generate more complicated code. + python3 tests/fuzz.py -i --easy + # Try infinitely many test cases until find a buggy one. python3 tests/fuzz.py -i