Skip to content

Commit 363a831

Browse files
authored
ci: fix allow run_dir and skipped_dir work together (#10763)
1 parent 0a3969a commit 363a831

File tree

2 files changed

+27
-28
lines changed
  • .github/actions/test_sqllogic_standalone_linux
  • tests/sqllogictests/src

2 files changed

+27
-28
lines changed

.github/actions/test_sqllogic_standalone_linux/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ runs:
3535
shell: bash
3636
env:
3737
TEST_HANDLERS: ${{ inputs.handlers }}
38-
run: bash ./scripts/ci/ci-run-sqllogic-tests-native.sh
38+
run: bash ./scripts/ci/ci-run-sqllogic-tests-native.sh ${{ inputs.dirs }}

tests/sqllogictests/src/util.rs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -96,38 +96,37 @@ fn find_specific_dir(dir: &str, suit: PathBuf) -> Result<DirEntry> {
9696
pub fn get_files(suit: PathBuf) -> Result<Vec<walkdir::Result<DirEntry>>> {
9797
let args = SqlLogicTestArgs::parse();
9898
let mut files = vec![];
99-
// Skipped dir and specific dir won't be used together!
100-
if args.dir.is_none() {
101-
for entry in WalkDir::new(suit)
102-
.min_depth(0)
103-
.max_depth(100)
104-
.sort_by(|a, b| a.file_name().cmp(b.file_name()))
105-
.into_iter()
106-
.filter_entry(|e| {
107-
if let Some(skipped_dir) = &args.skipped_dir {
108-
let dirs = skipped_dir.split(',').collect::<Vec<&str>>();
109-
if dirs.contains(&e.file_name().to_str().unwrap()) {
110-
return false;
111-
}
112-
}
113-
true
114-
})
115-
.filter(|e| !e.as_ref().unwrap().file_type().is_dir())
116-
{
117-
files.push(entry);
99+
100+
let dirs = match args.dir {
101+
Some(ref dir) => {
102+
// Find specific dir
103+
let dir_entry = find_specific_dir(dir, suit);
104+
match dir_entry {
105+
Ok(dir_entry) => Some(dir_entry.into_path()),
106+
// If didn't find specific dir, return empty vec
107+
Err(_) => None,
108+
}
118109
}
119-
return Ok(files);
120-
}
121-
// Find specific dir
122-
let dir_entry = find_specific_dir(args.dir.as_ref().unwrap(), suit);
123-
if dir_entry.is_err() {
124-
return Ok(vec![]);
125-
}
126-
for entry in WalkDir::new(dir_entry.unwrap().into_path())
110+
None => Some(suit),
111+
};
112+
let target = match dirs {
113+
Some(dir) => dir,
114+
None => return Ok(vec![]),
115+
};
116+
for entry in WalkDir::new(target)
127117
.min_depth(0)
128118
.max_depth(100)
129119
.sort_by(|a, b| a.file_name().cmp(b.file_name()))
130120
.into_iter()
121+
.filter_entry(|e| {
122+
if let Some(skipped_dir) = &args.skipped_dir {
123+
let dirs = skipped_dir.split(',').collect::<Vec<&str>>();
124+
if dirs.contains(&e.file_name().to_str().unwrap()) {
125+
return false;
126+
}
127+
}
128+
true
129+
})
131130
.filter(|e| !e.as_ref().unwrap().file_type().is_dir())
132131
{
133132
files.push(entry);

0 commit comments

Comments
 (0)