Skip to content

Rust: ignore target in qltest #19542

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

Merged
merged 1 commit into from
May 21, 2025
Merged

Conversation

redsun82
Copy link
Contributor

The target file created by cargo check was causing problems in language tests.

We might want to also ignore target by default in the production indexing, but I'll leave that for further discussion.

The target file created by `cargo check` was causing problems in
language tests.

We might want to also ignore `target` by default in the production
indexing, but I'll leave that for further discussion.
@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 14:38
@redsun82 redsun82 requested a review from a team as a code owner May 20, 2025 14:38
@github-actions github-actions bot added the Rust Pull requests that update Rust code label May 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the qltest extractor to skip target directories when collecting test source files, preventing build artifacts from being included in language tests.

  • Adds a filter to exclude paths starting with target
  • Ensures errors during globbing still propagate correctly
Comments suppressed due to low confidence (1)

rust/extractor/src/qltest.rs:54

  • Add a unit test for set_sources that includes sample paths both inside and outside a target directory to verify the filtering logic works as intended.
fn set_sources(config: &mut Config) -> anyhow::Result<()> {

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I will see if this fixes CI on a couple of my PRs tomorrow morning.

@@ -54,6 +54,7 @@ path = "main.rs"
fn set_sources(config: &mut Config) -> anyhow::Result<()> {
let path_iterator = glob("**/*.rs").context("globbing test sources")?;
config.inputs = path_iterator
.filter(|f| f.is_err() || !f.as_ref().unwrap().starts_with("target"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess your intention is to keep Err paths, right? So any errors are not silently ignored. If you just want to drop Err paths then it might be nicer to use f.is_ok_and() instead of the is_err check and unwrapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I hesitated between the two, but in the end opted for not suppressing the errors for now

@redsun82 redsun82 merged commit 789e881 into main May 21, 2025
14 checks passed
@redsun82 redsun82 deleted the redsun82/rust-ignore-target-in-qltest branch May 21, 2025 07:32
@geoffw0
Copy link
Contributor

geoffw0 commented May 21, 2025

Seems to have worked, everything is looking better this morning. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants