Skip to content

test: give every integration test its own bld dir on the cargo target drive#6022

Merged
baszalmstra merged 2 commits intoprefix-dev:mainfrom
baszalmstra:per-test-bld-dirs
May 6, 2026
Merged

test: give every integration test its own bld dir on the cargo target drive#6022
baszalmstra merged 2 commits intoprefix-dev:mainfrom
baszalmstra:per-test-bld-dirs

Conversation

@baszalmstra
Copy link
Copy Markdown
Contributor

@baszalmstra baszalmstra commented May 6, 2026

Description

Two issues with the integration test setup in pixi_command_dispatcher:

  • The six tests that omitted with_workspace(...) on their CommandDispatcher fell back to <root>/bld for source_build_workspaces(), so every test in the binary wrote into one shared bld/ tree.
  • Every per-test tempdir was created via tempfile::tempdir(), which uses %TEMP%. On Windows that's typically C:\, while the project lives on a different drive. Once test(pixi_command_dispatcher): isolate the integration cache to a per… #6009 lands and the rattler cache root also lives in a tempdir, package-cache to prefix installs would be cross-drive copies instead of hardlinks.

Fix both:

  • Add a test_tempdir() helper that creates tempdirs under CARGO_TARGET_TMPDIR with a short p- prefix (Windows MAX_PATH). Route every tempfile::tempdir().unwrap() in the file through it so test scratch space sits on the cargo target drive.
  • Wire the six call sites without with_workspace(...) through test_tempdir() so each test gets its own bld/ (plus meta-v0/, artifacts-v0/, legacy-source-env/).

default_cache_dirs() is left alone for #6009 to handle; once that lands, its OnceLock'd cache root will share the same drive as every test_tempdir().

Supersedes #6009

How Has This Been Tested?

cargo check --tests -p pixi_command_dispatcher --features slow_integration_tests succeeds locally and cargo fmt --check is clean. The existing integration suite exercises every touched test.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have added sufficient tests to cover my changes.

@baszalmstra baszalmstra force-pushed the per-test-bld-dirs branch from 57f9ae9 to 7f0036b Compare May 6, 2026 09:02
@baszalmstra baszalmstra changed the title test(pixi_command_dispatcher): give every integration test its own bld dir test(pixi_command_dispatcher): co-locate integration test caches under CARGO_TARGET_TMPDIR May 6, 2026
…d dir on the cargo target drive

Two issues with the integration test setup:

- The six tests that omitted with_workspace(...) on their
  CommandDispatcher fell back to <root>/bld for source_build_workspaces(),
  so every test in the binary wrote into one shared bld/ tree.
- Every per-test tempdir was created via tempfile::tempdir(), which
  uses %TEMP%. On Windows that's typically C:\, while the project lives
  on a different drive. Once prefix-dev#6009 lands and the rattler cache root
  also lives in a tempdir, package-cache to prefix installs would be
  cross-drive copies instead of hardlinks.

Fix both:

- Add a test_tempdir() helper that creates tempdirs under
  CARGO_TARGET_TMPDIR with a short 'p-' prefix (Windows MAX_PATH).
  Route every tempfile::tempdir().unwrap() in the file through it so
  test scratch space sits on the cargo target drive.
- Wire the six call sites without with_workspace(...) through
  test_tempdir() so each test gets its own bld/ (plus meta-v0/,
  artifacts-v0/, legacy-source-env/).

default_cache_dirs() is left alone for prefix-dev#6009 to handle; once that
lands, its OnceLock'd cache root will share the same drive as every
test_tempdir().
@baszalmstra baszalmstra force-pushed the per-test-bld-dirs branch from 7f0036b to 865e494 Compare May 6, 2026 09:05
@baszalmstra baszalmstra changed the title test(pixi_command_dispatcher): co-locate integration test caches under CARGO_TARGET_TMPDIR test(pixi_command_dispatcher): give every integration test its own bld dir on the cargo target drive May 6, 2026
@baszalmstra baszalmstra changed the title test(pixi_command_dispatcher): give every integration test its own bld dir on the cargo target drive test: give every integration test its own bld dir on the cargo target drive May 6, 2026
Copy link
Copy Markdown
Contributor

@hunger hunger left a comment

Choose a reason for hiding this comment

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

LGTM

@baszalmstra baszalmstra merged commit 69842cf into prefix-dev:main May 6, 2026
39 checks passed
@baszalmstra baszalmstra deleted the per-test-bld-dirs branch May 6, 2026 15:01
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