mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
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 <minseong.jang@cp.kaist.ac.kr>
This commit is contained in:
25
README.md
25
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 <fuzz-option> --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 <fuzz-option>
|
||||
|
||||
# fix your code for the reduced test input
|
||||
# Reduces the failing test input as much as possible
|
||||
python3 tests/fuzz.py <fuzz-option> --reduce
|
||||
|
||||
# Fix your code for the reduced test input
|
||||
cat tests/test_reduced.c
|
||||
```
|
||||
|
||||
`<fuzz-option>` 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 <fuzz-option>
|
||||
python3 tests/fuzz.py <fuzz-option> --reduce
|
||||
```
|
||||
|
||||
`<fuzz-option>` 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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user