diff --git a/Cargo.lock b/Cargo.lock index 82862de58ca0..6a48189586d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9481,6 +9481,13 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +[[package]] +name = "tests-fuzz" +version = "0.6.0" +dependencies = [ + "async-trait", +] + [[package]] name = "tests-integration" version = "0.6.0" diff --git a/Cargo.toml b/Cargo.toml index 545434313131..2b67086ac49b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ members = [ "src/store-api", "src/table", "src/index", + "tests-fuzz", "tests-integration", "tests/runner", ] diff --git a/tests-fuzz/Cargo.toml b/tests-fuzz/Cargo.toml new file mode 100644 index 000000000000..c522adda88fe --- /dev/null +++ b/tests-fuzz/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tests-fuzz" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +async-trait = { workspace = true } diff --git a/tests-fuzz/src/context.rs b/tests-fuzz/src/context.rs new file mode 100644 index 000000000000..59f3388c4861 --- /dev/null +++ b/tests-fuzz/src/context.rs @@ -0,0 +1,13 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/tests-fuzz/src/executor.rs b/tests-fuzz/src/executor.rs new file mode 100644 index 000000000000..064bd0ce3486 --- /dev/null +++ b/tests-fuzz/src/executor.rs @@ -0,0 +1,22 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt; + +#[async_trait::async_trait] +pub(crate) trait DslExecutor { + type Error: Sync + Send + fmt::Debug; + + async fn execute(&self, input: &T) -> Result; +} diff --git a/tests-fuzz/src/generator.rs b/tests-fuzz/src/generator.rs new file mode 100644 index 000000000000..93e8227ea753 --- /dev/null +++ b/tests-fuzz/src/generator.rs @@ -0,0 +1,22 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt; + +#[async_trait::async_trait] +pub(crate) trait Generator { + type Error: Sync + Send + fmt::Debug; + + async fn generate(&self) -> Result; +} diff --git a/tests-fuzz/src/lib.rs b/tests-fuzz/src/lib.rs new file mode 100644 index 000000000000..4615527a0a7b --- /dev/null +++ b/tests-fuzz/src/lib.rs @@ -0,0 +1,19 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub(crate) mod context; +pub(crate) mod executor; +pub(crate) mod generator; +pub(crate) mod table_creator; +pub(crate) mod translator; diff --git a/tests-fuzz/src/table_creator.rs b/tests-fuzz/src/table_creator.rs new file mode 100644 index 000000000000..59f3388c4861 --- /dev/null +++ b/tests-fuzz/src/table_creator.rs @@ -0,0 +1,13 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/tests-fuzz/src/translator.rs b/tests-fuzz/src/translator.rs new file mode 100644 index 000000000000..11e18a87dbbd --- /dev/null +++ b/tests-fuzz/src/translator.rs @@ -0,0 +1,21 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt; + +pub(crate) trait DslTranslator { + type Error: Sync + Send + fmt::Debug; + + fn translate(&self, input: &T) -> Result; +}