Fix argument parsing in compiletest for quoted strings#154479
Fix argument parsing in compiletest for quoted strings#154479JumpiiX wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
Some changes occurred in src/tools/compiletest cc @jieyouxu These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
807fb0f to
7540640
Compare
This comment has been minimized.
This comment has been minimized.
7540640 to
08a1c22
Compare
This comment has been minimized.
This comment has been minimized.
08a1c22 to
756d483
Compare
This comment has been minimized.
This comment has been minimized.
Only fix the diff command argument parsing to handle quoted paths. Keep compile-flags parsing unchanged to avoid breaking existing tests.
756d483 to
50ce1b4
Compare
|
@wesleywiser I've narrowed this fix to only handle custom diff commands with quoted arguments (the original issue). I initially tried using shlex for all argument parsing, but this breaks ~50-90 existing tests that use unquoted Two options:
Which approach would you prefer? Happy to go either way, just wanted to keep the PR focused initially. |
| if let Some(diff_command) = self.config.diff_command.as_deref() { | ||
| let mut args = diff_command.split_whitespace(); | ||
| let name = args.next().unwrap(); | ||
| match Command::new(name).args(args).args([expected_path, actual_path]).output() { | ||
| Err(err) => { | ||
| self.fatal(&format!( | ||
| "failed to call custom diff command `{diff_command}`: {err}" | ||
| )); | ||
| match shlex::split(diff_command) { |
There was a problem hiding this comment.
Remark: so actually, this case I care less about, properly splitting diff command stuff is "nice-to-have" for users on custom diff tools but this is not correctness-critical
Fixes compiletest breaking when using quoted arguments like
--cfg 'feature="my app"'in compile-flags or custom diff tools.Uses proper shell argument parsing instead of naive whitespace splitting.
Closes #132599