Skip to content

compiletest: Use an explicit argfile instead of ArgFileCommand - #166640

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Zalathar:argfile
Nov 27, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Zalathar:argfile

Conversation

@Zalathar

@Zalathar Zalathar commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

While trying to clean up some command handling in compiletest, I was frustrated by the awkward split between code that uses stdlib Command, and code that uses the ArgFileCommand wrapper.

On closer inspection, it seems that the only reason to use ArgFileCommand at all (d7a58fa in #155439) was that run-make tests need to pass a lot of absolute paths to the compiler, as a result of the newer cargo build dir layout. But in that particular case, it's reasonable to instead always write the dependency paths to an argfile.

I think it's simpler overall to go back to using ordinary Command in compiletest, to avoid having two different command types for a relatively unimportant reason, and to avoid the extra hassle of ArgFileCommand needing to schedule deletion of a temporary file.

In the future, I would like to make compiletest a bit more disciplined about how it creates commands for running compilers and running test executables, because currently it's all a bit of a crufty mess.

With the newer cargo build directory layout, the list of transitive dependency
paths is long enough that it risks exceeding the command-line length limit on
Windows.

That problem was already being handled by the ArgFileCommand wrapper, but that
wrapper makes it harder to clean up compiletest's command handling in other
ways.

In this case, it's sufficient to just write the run-make-support dependencies
to an argfile unconditionally.
Now that run-make tests unconditionally use argfiles to pass their
run-make-support dependencies, ArgFileCommand isn't needed.

Removing ArgFileCommand avoids the awkward split between code using Command and
code using ArgFileCommand, enabling further cleanups to command handling.

This commit also removes the shim_utils dependency from compiletest, since it
was only being used for ArgFileCommand.
@rustbot

rustbot commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 27, 2026
@rustbot

rustbot commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @jieyouxu, @oli-obk, @wesleywiser, bootstrap
  • @jieyouxu, @oli-obk, @wesleywiser, bootstrap expanded to 8 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu, oli-obk

@oli-obk

oli-obk commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

I have no context on ArgFileCommand

r? @jieyouxu maybe?

@rustbot rustbot assigned jieyouxu and unassigned oli-obk Nov 27, 2026
@jieyouxu

Copy link
Copy Markdown
Member

In the future, I would like to make compiletest a bit more disciplined about how it creates commands for running compilers and running test executables, because currently it's all a bit of a crufty mess.

Yeah, that's a given...

@jieyouxu jieyouxu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9ea33cc has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #165836 (Use LLVM option `-disable-auto-upgrade-debug-info`)
 - #164783 (callconv: mips64: match gcc for "alignment" of 16-byte-aligned ZSTs)
 - #166634 (do not lint `drop_bounds`, `dyn_drop`, `trivial_bounds` and const param names on items from external macros)
 - #166649 (abby dsl: minor refactor/cleanup)
 - #164628 (callconv: mips64: handle repr(transparent))
 - #166387 (Remove diagnostics import list)
 - #166564 (miri: support statx syscall)
 - #166583 (abby dsl tests: the passing test should check-pass)
 - #166595 (specify target CPUs in 'powerpc-types.rs' assembly test)
 - #166640 (compiletest: Use an explicit argfile instead of ArgFileCommand)
 - #166646 (Fix reversed argument counts in Fn trait mismatch note)
@rust-bors
rust-bors Bot merged commit 2ec5a0b into rust-lang:main Nov 27, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #166640 - Zalathar:argfile, r=jieyouxu

compiletest: Use an explicit argfile instead of ArgFileCommand

While trying to clean up some command handling in compiletest, I was frustrated by the awkward split between code that uses stdlib Command, and code that uses the ArgFileCommand wrapper.

On closer inspection, it seems that the only reason to use ArgFileCommand at all (d7a58fa in #155439) was that run-make tests need to pass a lot of absolute paths to the compiler, as a result of the newer cargo build dir layout. But in that particular case, it's reasonable to instead *always* write the dependency paths to an argfile.

I think it's simpler overall to go back to using ordinary Command in compiletest, to avoid having two different command types for a relatively unimportant reason, and to avoid the extra hassle of ArgFileCommand needing to schedule deletion of a temporary file.

In the future, I would like to make compiletest a bit more disciplined about how it creates commands for running compilers and running test executables, because currently it's all a bit of a crufty mess.
@Zalathar
Zalathar deleted the argfile branch November 28, 2026 00:19
mehmettoplu-rs pushed a commit to mehmettoplu-rs/miri that referenced this pull request Nov 28, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165836 (Use LLVM option `-disable-auto-upgrade-debug-info`)
 - rust-lang/rust#164783 (callconv: mips64: match gcc for "alignment" of 16-byte-aligned ZSTs)
 - rust-lang/rust#166634 (do not lint `drop_bounds`, `dyn_drop`, `trivial_bounds` and const param names on items from external macros)
 - rust-lang/rust#166649 (abby dsl: minor refactor/cleanup)
 - rust-lang/rust#164628 (callconv: mips64: handle repr(transparent))
 - rust-lang/rust#166387 (Remove diagnostics import list)
 - rust-lang/rust#166564 (miri: support statx syscall)
 - rust-lang/rust#166583 (abby dsl tests: the passing test should check-pass)
 - rust-lang/rust#166595 (specify target CPUs in 'powerpc-types.rs' assembly test)
 - rust-lang/rust#166640 (compiletest: Use an explicit argfile instead of ArgFileCommand)
 - rust-lang/rust#166646 (Fix reversed argument counts in Fn trait mismatch note)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants