Skip to content

Commit f88b1fd

Browse files
committed
try to fix script
1 parent 7950e4b commit f88b1fd

File tree

6 files changed

+25
-43
lines changed

6 files changed

+25
-43
lines changed

.github/actions/fuse_compat/action.yml

+4-14
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,15 @@ runs:
1919
sha: ${{ github.sha }}
2020
target: ${{ inputs.target }}
2121
path: ./bins/current
22-
22+
- name: Setup Build Tool
23+
uses: ./.github/actions/setup_build_tool
24+
with:
25+
bypass_env_vars: RUSTFLAGS,RUSTDOCFLAGS,RUST_TEST_THREADS,RUST_LOG,RUST_BACKTRACE
2326
- name: Test compatibility
2427
shell: bash
2528
run: |
26-
docker run --rm --tty --net=host \
27-
--user $(id -u):$(id -g) \
28-
--env BUILD_PROFILE \
29-
--volume "${PWD}:/workspace" \
30-
--workdir "/workspace" \
31-
datafuselabs/build-tool:sqllogic \
3229
bash ./tests/fuse-compat/test-fuse-compat.sh 0.7.150
33-
docker run --rm --tty --net=host \
34-
--user $(id -u):$(id -g) \
35-
--env BUILD_PROFILE \
36-
--volume "${PWD}:/workspace" \
37-
--workdir "/workspace" \
38-
datafuselabs/build-tool:sqllogic \
3930
bash ./tests/fuse-compat/test-fuse-compat.sh 0.7.151
40-
4131
- name: Upload failure
4232
if: failure()
4333
uses: ./.github/actions/artifact_failure

.github/workflows/databend-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ jobs:
308308
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
309309
run: |
310310
version=${{ needs.create_release.outputs.version }}
311-
tar -C ./tests/logictest -czvf testsuites-${version}.tar.gz suites
311+
tar -C ./tests/sqllogictests -czvf testsuites-${version}.tar.gz suites
312312
gh release upload ${version} testsuites-${version}.tar.gz --clobber
313313
314314
release_docker_combined:

tests/compat/test-compat.sh

+4-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pwd
1010
BUILD_PROFILE="${BUILD_PROFILE:-debug}"
1111

1212
query_config_path="scripts/ci/deploy/config/databend-query-node-1.toml"
13-
query_test_path="tests/logictest"
13+
query_test_path="tests/sqllogictests"
1414
bend_repo_url="https://github.com/datafuselabs/databend"
1515

1616
usage() {
@@ -208,32 +208,16 @@ run_test() {
208208
echo " === Run metasrv related test: 05_ddl"
209209

210210
if [ "$query_ver" = "current" ]; then
211-
cd "$SCRIPT_PATH/../../tests/logictest" || exit
212211
# Only run test on mysql handler
213-
python3 main.py "_ddl_" --handlers mysql
214-
cd -
212+
cargo run -p sqllogictests -- --run_dir 05_ddl --handlers mysql
215213
else
216214
(
217215
# download suites into ./old_suite
218216
download_test_suite $query_ver
219217
)
220-
# logictest dir include all suites and scripts fit old query
221-
cd "old_suite/tests/logictest" || exit
222-
223-
# old logic test use NoneType is only support by python3.10
224-
sed -i "/^from types.*/d" http_runner.py
225-
sed -i "/^from types.*/d" mysql_runner.py
226-
sed -i "s/NoneType/type(None)/g" http_runner.py
227-
sed -i "s/NoneType/type(None)/g" mysql_runner.py
228-
229-
# logictest pattern argument change after v0.7.140
230-
# old logic test does not support pattern filter
231-
mv suites/gen/05_ddl .
232-
rm -fr suites/*
233-
mv 05_ddl suites/
218+
234219
# FIXME:(everpcpc) sometimes old logic test fails but we can't time travel back to fix it.
235-
python3 main.py || true
236-
cd -
220+
cargo run -p sqllogictests -- --suits "old_suite/tests/sqllogictests/suites" --run_dir 05_ddl || true
237221
fi
238222
}
239223

tests/fuse-compat/test-fuse-compat.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,9 @@ git_partial_clone() {
9090

9191
# Run specified tests found in logic test suite dir
9292
run_logictest() {
93-
local pattern="$1"
9493
(
95-
cd "tests/logictest"
9694
# Only run test on mysql handler
97-
python3 main.py "$pattern" --handlers mysql --suites "$SCRIPT_PATH/compat-logictest"
95+
cargo run -p sqllogictests -- --handlers mysql --suites "$logictest_path"
9896
)
9997

10098
}

tests/sqllogictests/src/arg.rs

+9
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,13 @@ pub struct SqlLogicTestArgs {
5050
help = "Choose handlers to run tests, support mysql, http, clickhouse handler, the arg is optional. If use multiple handlers, please use \',\' to split them"
5151
)]
5252
pub handlers: Option<Vec<String>>,
53+
54+
// Choose suits to run
55+
#[arg(
56+
short = 'u',
57+
long = "suits",
58+
help = "The tests to be run will come from under suits",
59+
default_value = "tests/sqllogictests/suites"
60+
)]
61+
pub suits: String,
5362
}

tests/sqllogictests/src/main.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ mod client;
3333
mod error;
3434
mod util;
3535

36-
const TEST_SUITS: &str = "tests/sqllogictests/suites";
37-
3836
pub struct Databend {
3937
mysql_client: Option<MysqlClient>,
4038
http_client: Option<HttpClient>,
@@ -125,23 +123,26 @@ pub async fn main() -> Result<()> {
125123
}
126124

127125
async fn run_mysql_client() -> Result<()> {
128-
let suits = std::fs::read_dir(TEST_SUITS).unwrap();
126+
let suits = SqlLogicTestArgs::parse().suits;
127+
let suits = std::fs::read_dir(suits).unwrap();
129128
let mysql_client = MysqlClient::create()?;
130129
let databend = Databend::create(Some(mysql_client), None, None);
131130
run_suits(suits, databend).await?;
132131
Ok(())
133132
}
134133

135134
async fn run_http_client() -> Result<()> {
136-
let suits = std::fs::read_dir(TEST_SUITS).unwrap();
135+
let suits = SqlLogicTestArgs::parse().suits;
136+
let suits = std::fs::read_dir(suits).unwrap();
137137
let http_client = HttpClient::create()?;
138138
let databend = Databend::create(None, Some(http_client), None);
139139
run_suits(suits, databend).await?;
140140
Ok(())
141141
}
142142

143143
async fn run_ck_http_client() -> Result<()> {
144-
let suits = std::fs::read_dir(TEST_SUITS).unwrap();
144+
let suits = SqlLogicTestArgs::parse().suits;
145+
let suits = std::fs::read_dir(suits).unwrap();
145146
let ck_client = ClickhouseHttpClient::create()?;
146147
let databend = Databend::create(None, None, Some(ck_client));
147148
run_suits(suits, databend).await?;

0 commit comments

Comments
 (0)