Skip to content

tests: port to uutests#645

Open
jmr wants to merge 1 commit intouutils:mainfrom
jmr:uutests
Open

tests: port to uutests#645
jmr wants to merge 1 commit intouutils:mainfrom
jmr:uutests

Conversation

@jmr
Copy link
Copy Markdown

@jmr jmr commented Mar 26, 2026

Replaces assert_cmd/predicates/pretty_assertions/serial_test with uutests and ctor in dev-dependencies.

Closes #537.

  • Port tests/find_cmd_tests.rs → tests/test_find.rs (uutests API)
  • Port tests/xargs_tests.rs → tests/test_xargs.rs (uutests API)
  • Centralize UUTESTS_BINARY_PATH init via #[ctor::ctor] in tests/common/mod.rs

Implementation notes:

  • Use TestScenario::cmd(BINARY_PATH) rather than ucmd(): find/xargs are dedicated binaries, not multi-call, so ucmd() would prepend the utility name as a spurious first argument
  • Set CWD to CARGO_MANIFEST_DIR in find's ucmd() so relative test_data/ paths resolve correctly regardless of where cargo runs
  • delete_on_dot_dir sets the child process CWD via UCommand::current_dir() instead of mutating the process-wide CWD, removing the need for serial_test and all #[serial(working_dir)] attributes

Also fixes find_samefile, find_fprinter, and find_fprintf, which were writing temporary files directly into test_data/. They now use isolated temp directories, eliminating a source of test pollution when running in parallel.

Replaces assert_cmd/predicates/pretty_assertions/serial_test with uutests and
ctor in dev-dependencies.

Closes uutils#537.

- Port tests/find_cmd_tests.rs → tests/test_find.rs (uutests API)
- Port tests/xargs_tests.rs → tests/test_xargs.rs (uutests API)
- Centralize UUTESTS_BINARY_PATH init via #[ctor::ctor] in tests/common/mod.rs

Implementation notes:
- Use TestScenario::cmd(BINARY_PATH) rather than ucmd(): find/xargs are
  dedicated binaries, not multi-call, so ucmd() would prepend the utility name
  as a spurious first argument
- Set CWD to CARGO_MANIFEST_DIR in find's ucmd() so relative test_data/ paths
  resolve correctly regardless of where cargo runs
- delete_on_dot_dir sets the child process CWD via UCommand::current_dir()
  instead of mutating the process-wide CWD, removing the need for serial_test
  and all #[serial(working_dir)] attributes

Also fixes find_samefile, find_fprinter, and find_fprintf, which were writing
temporary files directly into test_data/. They now use isolated temp
directories, eliminating a source of test pollution when running in parallel.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.76%. Comparing base (87ce037) to head (ca6d523).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #645   +/-   ##
=======================================
  Coverage   91.76%   91.76%           
=======================================
  Files          31       31           
  Lines        6203     6203           
  Branches      328      328           
=======================================
  Hits         5692     5692           
  Misses        390      390           
  Partials      121      121           

☔ 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.

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.

Port findutils to use uutests

1 participant