Skip to main content

risingwave_regress_test/
lib.rs

1// Copyright 2022 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#![warn(clippy::dbg_macro)]
17#![warn(clippy::disallowed_methods)]
18#![warn(clippy::doc_markdown)]
19#![warn(clippy::explicit_into_iter_loop)]
20#![warn(clippy::explicit_iter_loop)]
21#![warn(clippy::inconsistent_struct_constructor)]
22#![warn(clippy::unused_async)]
23#![warn(clippy::map_flatten)]
24#![warn(clippy::no_effect_underscore_binding)]
25#![warn(clippy::await_holding_lock)]
26#![deny(rustdoc::broken_intra_doc_links)]
27#![feature(register_tool)]
28#![register_tool(rw)]
29#![allow(rw::format_error)]
30
31mod opts;
32
33use clap::Parser;
34pub(crate) use opts::*;
35mod psql;
36pub(crate) use psql::*;
37mod env;
38pub(crate) use env::*;
39mod file;
40pub(crate) use file::*;
41mod schedule;
42pub(crate) use schedule::*;
43use tracing::{error, info};
44
45/// Exit code of this process
46pub async fn regress_main() -> i32 {
47    let opts = Opts::parse();
48
49    tracing_subscriber::fmt::init();
50
51    match run_schedules(opts).await {
52        Ok(_) => {
53            info!("Risingwave regress test completed successfully!");
54            0
55        }
56        Err(e) => {
57            error!(
58                "Risingwave regress test failed: {:?}. Please ensure that your psql version is larger than 14.1",
59                e
60            );
61            1
62        }
63    }
64}
65
66async fn run_schedules(opts: Opts) -> anyhow::Result<()> {
67    let schedule = Schedule::new(opts)?;
68    schedule.run().await
69}