summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml6
-rw-r--r--fuzz/fuzz.rs (renamed from tests/fuzz.rs)0
-rw-r--r--fuzz/meson.build27
-rw-r--r--meson.build4
-rw-r--r--tests/meson.build28
5 files changed, 36 insertions, 29 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 345c08d..bcb32da 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,4 +10,8 @@ itertools = "0.14.0"
thiserror = "2.0.17"
[profile.dev]
-debug = true \ No newline at end of file
+debug = true
+
+[[test]]
+path = "fuzz/fuzz.rs"
+name = "fuzz" \ No newline at end of file
diff --git a/tests/fuzz.rs b/fuzz/fuzz.rs
index 69804e8..69804e8 100644
--- a/tests/fuzz.rs
+++ b/fuzz/fuzz.rs
diff --git a/fuzz/meson.build b/fuzz/meson.build
new file mode 100644
index 0000000..c4b5e8d
--- /dev/null
+++ b/fuzz/meson.build
@@ -0,0 +1,27 @@
+cbindgen = find_program('cbindgen')
+
+fuzz_h = custom_target(
+ 'fuzz_h',
+ input: 'fuzz.rs',
+ output: 'fuzz.h',
+ command: [cbindgen, '@INPUT@', '-o', '@OUTPUT'],
+)
+
+fuzz_rs = static_library(
+ 'fuzz_rs',
+ 'fuzz.rs',
+ rust_abi: 'c',
+ rust_args: [
+ '-Cpasses=sancov-module',
+ '-Cllvm-args=-sanitizer-coverage-level=3',
+ '-Cllvm-args=-sanitizer-coverage-inline-8bit-counters',
+ ],
+ dependencies: [mon],
+ link_with: [gentoo_utils],
+)
+
+fuzz_cpp = executable(
+ 'fuzz',
+ link_args: ['-fsanitize=fuzzer'],
+ link_with: [fuzz_rs],
+)
diff --git a/meson.build b/meson.build
index ac6d6af..401adf6 100644
--- a/meson.build
+++ b/meson.build
@@ -19,4 +19,6 @@ gentoo_utils = static_library(
link_with: [thiserror],
)
-subdir('tests')
+if get_option('fuzz').enabled()
+ subdir('fuzz')
+endif
diff --git a/tests/meson.build b/tests/meson.build
index c4b5e8d..69052cd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,27 +1 @@
-cbindgen = find_program('cbindgen')
-
-fuzz_h = custom_target(
- 'fuzz_h',
- input: 'fuzz.rs',
- output: 'fuzz.h',
- command: [cbindgen, '@INPUT@', '-o', '@OUTPUT'],
-)
-
-fuzz_rs = static_library(
- 'fuzz_rs',
- 'fuzz.rs',
- rust_abi: 'c',
- rust_args: [
- '-Cpasses=sancov-module',
- '-Cllvm-args=-sanitizer-coverage-level=3',
- '-Cllvm-args=-sanitizer-coverage-inline-8bit-counters',
- ],
- dependencies: [mon],
- link_with: [gentoo_utils],
-)
-
-fuzz_cpp = executable(
- 'fuzz',
- link_args: ['-fsanitize=fuzzer'],
- link_with: [fuzz_rs],
-)
+subdir('fuzz')