aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-13 15:30:20 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-13 15:30:20 +0100
commit7ade650065a2693f41e3a858bfb25881bac06e9d (patch)
tree0d17cc827f58cc8ac5310f7c08da717d20b19d38
parent5f07c9840ecaebd07b9685dc55539166a697eb6e (diff)
downloadtools.nes-7ade650065a2693f41e3a858bfb25881bac06e9d.tar.gz
tools.nes-7ade650065a2693f41e3a858bfb25881bac06e9d.zip
ci: Run a fuzzy test also for the assembler
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
-rw-r--r--.github/workflows/ci.yml25
-rw-r--r--lib/xixanta/fuzz/Cargo.toml7
-rw-r--r--lib/xixanta/fuzz/fuzz_targets/fuzz_target_2.rs10
3 files changed, 40 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index db5bc23..589ccbe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,7 +26,7 @@ jobs:
- name: Run Clippy
run: cargo clippy --all-targets --all-features
- fuzz:
+ fuzz_parser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -42,7 +42,28 @@ jobs:
- name: Build with nightly
run: cargo build --verbose
- - name: Fuzzy testing
+ - name: Fuzzy test the parser
run: |
cd lib/xixanta
cargo +nightly fuzz run fuzz_target_1 -- -max_total_time=180
+
+ fuzz_assembler:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Update rust toolchain to nightly
+ run: |
+ rustup update nightly
+ rustup default nightly
+
+ - name: Install cargo fuzz
+ run: cargo install cargo-fuzz
+
+ - name: Build with nightly
+ run: cargo build --verbose
+
+ - name: Fuzzy test the assembler
+ run: |
+ cd lib/xixanta
+ cargo +nightly fuzz run fuzz_target_2 -- -max_total_time=180
diff --git a/lib/xixanta/fuzz/Cargo.toml b/lib/xixanta/fuzz/Cargo.toml
index 3b3498d..0c0376d 100644
--- a/lib/xixanta/fuzz/Cargo.toml
+++ b/lib/xixanta/fuzz/Cargo.toml
@@ -22,3 +22,10 @@ path = "fuzz_targets/fuzz_target_1.rs"
test = false
doc = false
bench = false
+
+[[bin]]
+name = "fuzz_target_2"
+path = "fuzz_targets/fuzz_target_2.rs"
+test = false
+doc = false
+bench = false
diff --git a/lib/xixanta/fuzz/fuzz_targets/fuzz_target_2.rs b/lib/xixanta/fuzz/fuzz_targets/fuzz_target_2.rs
new file mode 100644
index 0000000..111bae9
--- /dev/null
+++ b/lib/xixanta/fuzz/fuzz_targets/fuzz_target_2.rs
@@ -0,0 +1,10 @@
+#![no_main]
+
+use libfuzzer_sys::fuzz_target;
+use xixanta::assembler::Assembler;
+use xixanta::mapping::EMPTY;
+
+fuzz_target!(|data: &[u8]| {
+ let mut asm = Assembler::new(EMPTY.to_vec());
+ let _ = asm.assemble(data);
+});