Skip to content

Commit f42fc82

Browse files
committed
adjust the fuzzers to use the new structure
1 parent 0b2505d commit f42fc82

9 files changed

Lines changed: 35 additions & 19 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ description = "A CLI app for generating diff files"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/notriddle/diffutils"
88

9+
[lib]
10+
name = "diffutils"
11+
path = "src/lib.rs"
12+
913
[[bin]]
1014
name = "diffutils"
1115
path = "src/main.rs"
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ cargo-fuzz = true
1010

1111
[dependencies]
1212
libfuzzer-sys = "0.3"
13-
14-
[dependencies.unified-diff]
15-
path = ".."
13+
diffutils = { path = "../" }
1614

1715
# Prevent this from interfering with workspaces
1816
[workspace]
@@ -24,3 +22,17 @@ path = "fuzz_targets/fuzz_patch.rs"
2422
test = false
2523
doc = false
2624

25+
[[bin]]
26+
name = "fuzz_normal"
27+
path = "fuzz_targets/fuzz_normal.rs"
28+
test = false
29+
doc = false
30+
31+
32+
[[bin]]
33+
name = "fuzz_ed"
34+
path = "fuzz_targets/fuzz_ed.rs"
35+
test = false
36+
doc = false
37+
38+
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#![no_main]
22
#[macro_use]
33
extern crate libfuzzer_sys;
4-
extern crate ed_diff;
5-
4+
use diffutils::{unified_diff, ed_diff, normal_diff};
65
use std::fs::{self, File};
76
use std::io::Write;
87
use std::process::Command;

lib/normal-diff/fuzz/fuzz_targets/fuzz_patch.rs renamed to fuzz/fuzz_targets/fuzz_normal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_main]
22
#[macro_use]
33
extern crate libfuzzer_sys;
4-
extern crate normal_diff;
4+
use diffutils::{unified_diff, normal_diff};
55

66
use std::fs::{self, File};
77
use std::io::Write;

lib/unified-diff/fuzz/fuzz_targets/fuzz_patch.rs renamed to fuzz/fuzz_targets/fuzz_patch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#![no_main]
22
#[macro_use]
33
extern crate libfuzzer_sys;
4-
extern crate unified_diff;
5-
4+
use diffutils::{unified_diff, normal_diff};
65
use std::fs::{self, File};
76
use std::io::Write;
87
use std::process::Command;

lib/normal-diff/fuzz/Cargo.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,14 @@
33
name = "normal-diff-fuzz"
44
version = "0.0.0"
55
publish = false
6-
edition = "2018"
6+
edition = "2021"
77

88
[package.metadata]
99
cargo-fuzz = true
1010

1111
[dependencies]
1212
libfuzzer-sys = "0.3"
1313

14-
[dependencies.normal-diff]
15-
path = ".."
16-
1714
# Prevent this from interfering with workspaces
1815
[workspace]
1916
members = ["."]
20-
21-
[[bin]]
22-
name = "fuzz_patch"
23-
path = "fuzz_targets/fuzz_patch.rs"
24-
test = false
25-
doc = false
26-

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
pub mod unified_diff;
3+
pub mod normal_diff;
4+
pub mod ed_diff;
5+
pub mod context_diff;
6+
7+
// Re-export the public functions/types you need
8+
pub use unified_diff::diff as unified_diff;
9+
pub use normal_diff::diff as normal_diff;
10+
pub use ed_diff::diff as ed_diff;
11+
pub use context_diff::diff as context_diff;

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::env;
99
use std::fs;
1010
use std::io::{self, Write};
1111

12+
1213
mod params;
1314
mod normal_diff;
1415
mod unified_diff;

0 commit comments

Comments
 (0)