Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin: enhance skipif #177

Closed
xxchan opened this issue May 16, 2023 · 3 comments · Fixed by #179
Closed

bin: enhance skipif #177

xxchan opened this issue May 16, 2023 · 3 comments · Fixed by #179

Comments

@xxchan
Copy link
Member

xxchan commented May 16, 2023

We have a skipif, added in #27, which uses DB::engine_name

/// Returns whether we should skip this record, according to given `conditions`.
fn should_skip(&self, conditions: &[Condition]) -> bool {
conditions
.iter()
.any(|c| c.should_skip(self.db.engine_name()))
}

#27 also added a flag --engine. But we use --engine to switch driver now, and the engine_name is not implemented in sqllogictest-bin

#[async_trait]
impl AsyncDB for Engines {
type Error = AnyhowError;
type ColumnType = DefaultColumnType;
async fn run(&mut self, sql: &str) -> Result<DBOutput<Self::ColumnType>, Self::Error> {
self.run(sql).await.map_err(AnyhowError)
}
}

I think adding a new flag like --name or --label can be enough.


Use case here risingwavelabs/risingwave#9013 (comment)

@xxchan
Copy link
Member Author

xxchan commented May 16, 2023

I think the original use case is “SQL syntax varies between databases” (ref https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki), so the is just driver name. (But this is also break in out sqllogictest-bin now! 😄)

This new use case is that one driver’s different behavior under different configuration. Kind of like postgres+risingwave , postgres+risingwave-in-mem , postgres+cockroach

@wangrunji0408
Copy link
Member

I'm thinking of whether we can decouple onlyif/skipif with engine name, and make it something like conditional compilation in Rust.

Specifically, users can add one or more lables by --cfg <label>, and use them as conditions by skipif <label1> <label2> .... The condition takes effect only if all labels are present. Another syntax may be introduced to express the OR logic.

In the use case above, there could be two labels: risingwave and in-mem. Users can choose any one or both of them to make condition. I think this design allows for more flexibility.

@mamcx
Copy link

mamcx commented May 25, 2023

Also, could be nice to skipif/onlyif for the whole file, like with control

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants