Skip to content

Conversation

clundin55
Copy link

Filtersets can be used to reduce the amount of binaries archived in a test archive.

NOTE: Test binaries are not executed to collect a test list. This prevents filtering by test.

See feature request: #2648

Filtersets can be used to reduce the amount of binaries archived in a
test archive.

NOTE: Test binaries are not executed to collect a test list. This
prevents filtering by test.
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 93.75000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.39%. Comparing base (a362d9d) to head (56310f2).
⚠️ Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
cargo-nextest/src/dispatch.rs 93.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2670      +/-   ##
==========================================
- Coverage   78.40%   78.39%   -0.02%     
==========================================
  Files         107      108       +1     
  Lines       24864    25074     +210     
==========================================
+ Hits        19495    19656     +161     
- Misses       5369     5418      +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@sunshowers sunshowers left a comment

Choose a reason for hiding this comment

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

Looks quite good! Just a couple of comments.

* Return `FiltersetParseErrors` when a `test` predicate is used in the
  `Archive` command.
* Improved integration tests.
@clundin55 clundin55 requested a review from sunshowers October 19, 2025 19:51
Copy link
Member

@sunshowers sunshowers left a comment

Choose a reason for hiding this comment

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

Just a few more minor comments, thanks!

Comment on lines 938 to 949
fn check_archive_contents(filter: &str, check_archive_contents: impl FnOnce(Vec<PathBuf>)) {
let (_p1, archive_file) =
create_archive_with_args("", false, "", &["-E", filter], false).expect("archive succeeded");
let file = File::open(archive_file).unwrap();
let decoder = zstd::stream::read::Decoder::new(file).unwrap();
let mut archive = tar::Archive::new(decoder);
let paths = archive
.entries()
.unwrap()
.map(|e| e.unwrap().path().unwrap().into_owned())
.collect::<Vec<_>>();
check_archive_contents(paths);
Copy link
Member

Choose a reason for hiding this comment

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

Naming the arg the same as the function is a bit confusing -- I'd just use cb for "callback" here.

Copy link
Author

Choose a reason for hiding this comment

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

Whoops, didn't realize I did that :)

Updated!

Comment on lines 881 to 896
assert!(
!paths
.iter()
.filter(|path| path
.ancestors()
// Test files are in the `deps` folder.
.any(|folder| folder.file_name() == Some(OsStr::new("deps"))))
.any(|path| {
let file_name = path.file_name().unwrap();
file_name
.to_ascii_lowercase()
.to_str()
.unwrap()
.contains(file)
})
);
Copy link
Member

Choose a reason for hiding this comment

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

Include the name of the file you're checking in the assert message -- here, and in the other sections as appropriate.

Copy link
Author

Choose a reason for hiding this comment

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

Added assert messages!

Comment on lines 905 to 916
path.file_name()
.unwrap()
.to_str()
.unwrap()
.contains(expected_package_test_file)
}));
assert!(!paths.iter().any(|path| {
path.file_name()
.unwrap()
.to_str()
.unwrap()
.contains(filtered_test)
Copy link
Member

Choose a reason for hiding this comment

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

Use unwrap_or_else + panic! here with a descriptive error message.

Copy link
Author

Choose a reason for hiding this comment

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

Done!

Comment on lines 849 to 866
let all_test_files = [
"basic",
"cdylib_example",
"cdylib_link",
"dylib_test",
"my_bench",
"nextest_derive",
"nextest_tests",
"nextest_tests",
"other",
"other",
"proc_macro_test",
"segfault",
"with_build_script",
"wrapper",
"nextest_tests",
"other",
];
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the list of fixtures as described here? That way when new fixtures get added this list won't have to be updated. https://github.com/nextest-rs/nextest/blob/main/fixture-data/src/nextest_tests.rs

Copy link
Author

Choose a reason for hiding this comment

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

Nice, thank you! Updated

╭────
1test(sample_test)
· ─────┬─────
· ╰── this predicate causes an unsupported expression
Copy link
Member

Choose a reason for hiding this comment

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

Could you reword this as "test predicates are not supported while archiving"? You may have to update the other messages as well instead of saying "this predicate causes {}".

Copy link
Author

Choose a reason for hiding this comment

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

Tweaked the wording a bit

@clundin55 clundin55 requested a review from sunshowers October 20, 2025 02:33
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 this pull request may close these issues.

2 participants