Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ jobs:
- name: Show available disk space
run: |
df -h
- name: Run tests (excluding doctests)
- name: Run extended tests
run: cargo xtask ci step test extended
- name: Run fuzzers with more iterations
- name: Run fuzz tests
run: cargo xtask ci step test fuzz
# Migrate it to the above unified fuzz runner over time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please file a ticket that explains the migration plan and has a checklist of tests to run and link it here? So we have the context in the future?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done in e205a1b

# Tracker: https://github.com/apache/datafusion/issues/27082
- name: Run unmigrated fuzzers with more iterations
run: cargo xtask ci step test fuzz-legacy
- parallel:
- name: Verify Working Directory Clean
run: git diff --exit-code
Expand Down
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ members = [
"datafusion/execution",
"datafusion/ffi",
"datafusion/ffi/integration-tests",
"datafusion/fuzz",
"datafusion/functions",
"datafusion/functions-aggregate",
"datafusion/functions-aggregate-common",
Expand Down
36 changes: 36 additions & 0 deletions datafusion/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
# SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements

# A private crate providing a single entry point for all fuzz tests.
Comment thread
alamb marked this conversation as resolved.
Resolved

[package]
name = "datafusion-fuzz"
version = "0.1.0"
edition = { workspace = true }
# Ensure this crate is private
publish = false
autotests = false

[lints]
workspace = true

[features]
extended_tests = []

[dev-dependencies]
arrow = { workspace = true }
bytes = { workspace = true }
datafusion-common = { workspace = true }
datafusion-execution = { workspace = true }
datafusion-physical-plan = { workspace = true }
futures = { workspace = true }
parking_lot = { workspace = true }
rand = { workspace = true }
test-utils = { path = "../../test-utils" }
tokio = { workspace = true, features = ["rt-multi-thread", "time"] }

[[test]]
name = "fuzz"
path = "tests/fuzz.rs"
required-features = ["extended_tests"]
67 changes: 67 additions & 0 deletions datafusion/fuzz/tests/fuzz.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
// SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements

//! One integration entrypoint for DataFusion's registered fuzz suites.

use std::future::Future;
use std::pin::Pin;

use datafusion_common::Result;
use test_utils::fuzz::{FuzzTest, RunConfig, run};

mod suites;

/// The single registration point for project-wide fuzz campaigns.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a fuzz campaign? I am not familar with the campaign terminology

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to run in dd6f892

///
/// Migration of the remaining fuzz tests is tracked in [#27082].
///
/// [#27082]: https://github.com/apache/datafusion/issues/27082
#[tokio::test(flavor = "multi_thread")]
async fn fuzz_tests() -> Result<()> {
let spill_pool = suites::spill_pool::SpillPoolFuzzer;
let suites = [Suite::new(
&spill_pool,
RunConfig {
run_seed: Some(0),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the existing fuzz config, probably we can use rotating seed (timestamp), and time limit instead of 1000 cases.

max_cases: Some(1000),
time_limit: None,
cases_per_dataset: 1000,
},
)];
run_suites(suites).await
}

async fn run_suites<'a>(suites: impl IntoIterator<Item = Suite<'a>>) -> Result<()> {
for suite in suites {
eprintln!("Running fuzz suite: {}", suite.name);
suite.run.await?;
}
Ok(())
}

/// Wrapper for one fuzzing test suite
struct Suite<'a> {
name: &'a str,
/// Run the test suite. Report an error on failure or execution statistics on success.
run: Pin<Box<dyn Future<Output = Result<()>> + 'a>>,
}

impl<'a> Suite<'a> {
fn new<T: FuzzTest>(test: &'a T, config: RunConfig) -> Self {
Self {
name: test.name(),
run: Box::pin(async move {
let stats = run(test, config).await?;
eprintln!(
"Fuzz suite {}: {} cases, {} datasets, {:?}",
test.name(),
stats.cases_passed,
stats.datasets_prepared,
stats.elapsed
);
Ok(())
}),
}
}
}
7 changes: 7 additions & 0 deletions datafusion/fuzz/tests/suites/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
// SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements

//! Implementation for fuzz test cases.

pub(crate) mod spill_pool;
Loading
Loading