risingwave_regress_test/
lib.rs

1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![allow(dead_code)]
16#![allow(clippy::derive_partial_eq_without_eq)]
17#![warn(clippy::dbg_macro)]
18#![warn(clippy::disallowed_methods)]
19#![warn(clippy::doc_markdown)]
20#![warn(clippy::explicit_into_iter_loop)]
21#![warn(clippy::explicit_iter_loop)]
22#![warn(clippy::inconsistent_struct_constructor)]
23#![warn(clippy::unused_async)]
24#![warn(clippy::map_flatten)]
25#![warn(clippy::no_effect_underscore_binding)]
26#![warn(clippy::await_holding_lock)]
27#![deny(rustdoc::broken_intra_doc_links)]
28#![feature(register_tool)]
29#![register_tool(rw)]
30#![allow(rw::format_error)]
31
32mod opts;
33
34use clap::Parser;
35pub(crate) use opts::*;
36mod psql;
37pub(crate) use psql::*;
38mod env;
39pub(crate) use env::*;
40mod file;
41pub(crate) use file::*;
42mod schedule;
43pub(crate) use schedule::*;
44use tracing::{error, info};
45
46/// Exit code of this process
47pub async fn regress_main() -> i32 {
48    let opts = Opts::parse();
49
50    tracing_subscriber::fmt::init();
51
52    match run_schedules(opts).await {
53        Ok(_) => {
54            info!("Risingwave regress test completed successfully!");
55            0
56        }
57        Err(e) => {
58            error!(
59                "Risingwave regress test failed: {:?}. Please ensure that your psql version is larger than 14.1",
60                e
61            );
62            1
63        }
64    }
65}
66
67async fn run_schedules(opts: Opts) -> anyhow::Result<()> {
68    let schedule = Schedule::new(opts)?;
69    schedule.run().await
70}