Skip to content

Commit

Permalink
chore: add feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Apr 24, 2024
1 parent 38d72ed commit 22c1bf8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion tests-fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ workspace = true
[package.metadata]
cargo-fuzz = true

[features]
default = []
unstable = ["nix"]

[dependencies]
arbitrary = { version = "1.3.0", features = ["derive"] }
async-trait = { workspace = true }
Expand All @@ -24,7 +28,7 @@ derive_builder = { workspace = true }
dotenv = "0.15"
lazy_static = { workspace = true }
libfuzzer-sys = "0.4"
nix = { version = "0.28", features = ["process", "signal"] }
nix = { version = "0.28", features = ["process", "signal"], optional = true }
partition = { workspace = true }
rand = { workspace = true }
rand_chacha = "0.3.1"
Expand Down Expand Up @@ -80,3 +84,4 @@ path = "targets/unstable/fuzz_create_table_standalone.rs"
test = false
bench = false
doc = false
required-features = ["unstable"]
1 change: 1 addition & 0 deletions tests-fuzz/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

pub mod config;
pub mod health;
#[cfg(feature = "unstable")]
pub mod process;

use std::env;
Expand Down
9 changes: 8 additions & 1 deletion tests-fuzz/src/utils/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
use std::time::Duration;

use crate::utils::info;
use crate::utils::process::HealthChecker;

/// Check health of the processing.
#[async_trait::async_trait]
pub trait HealthChecker: Send + Sync {
async fn check(&self);

fn wait_timeout(&self) -> Duration;
}

/// Http health checker.
pub struct HttpHealthChecker {
Expand Down
9 changes: 1 addition & 8 deletions tests-fuzz/src/utils/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use tokio::fs::OpenOptions;
use tokio::process::Child;

use crate::error::{self, Result};
use crate::utils::health::HealthChecker;

pub type Pid = u32;

Expand Down Expand Up @@ -142,14 +143,6 @@ impl ProcessManager {
}
}

/// Check health of the processing.
#[async_trait::async_trait]
pub trait HealthChecker: Send + Sync {
async fn check(&self);

fn wait_timeout(&self) -> Duration;
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProcessState {
NotSpawn,
Expand Down

0 comments on commit 22c1bf8

Please sign in to comment.