Rollup merge of #147633 - GuillaumeGomez:bypass-ignore-backends, r=kobzol
Add new `--bypass-ignore-backends` option Fixes https://github.com/rust-lang/rust/issues/147063. It adds a new option to `bootstrap` to allow to ignore `//@ ignore-backends` statements in tests. cc ```@jieyouxu``` ```@antoyo``` r? ```@Kobzol```
This commit is contained in:
commit
0f1db5302f
15 changed files with 31 additions and 5 deletions
|
|
@ -1965,6 +1965,9 @@ Please disable assertions with `rust.debug-assertions = false`.
|
|||
cmd.arg("--default-codegen-backend")
|
||||
.arg(builder.config.default_codegen_backend(test_compiler.host).name());
|
||||
}
|
||||
if builder.config.cmd.bypass_ignore_backends() {
|
||||
cmd.arg("--bypass-ignore-backends");
|
||||
}
|
||||
|
||||
if builder.build.config.llvm_enzyme {
|
||||
cmd.arg("--has-enzyme");
|
||||
|
|
|
|||
|
|
@ -422,6 +422,9 @@ pub enum Subcommand {
|
|||
#[arg(long)]
|
||||
/// Use a different codegen backend when running tests.
|
||||
test_codegen_backend: Option<CodegenBackendKind>,
|
||||
#[arg(long)]
|
||||
/// Ignore `//@ ignore-backends` directives.
|
||||
bypass_ignore_backends: bool,
|
||||
},
|
||||
/// Build and run some test suites *in Miri*
|
||||
Miri {
|
||||
|
|
@ -668,6 +671,13 @@ impl Subcommand {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bypass_ignore_backends(&self) -> bool {
|
||||
match self {
|
||||
Subcommand::Test { bypass_ignore_backends, .. } => *bypass_ignore_backends,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the shell completion for a given shell, if the result differs from the current
|
||||
|
|
|
|||
|
|
@ -207,7 +207,9 @@ settings:
|
|||
on `wasm32-unknown-unknown` target because the target does not support the
|
||||
`proc-macro` crate type.
|
||||
- `needs-target-std` — ignores if target platform does not have std support.
|
||||
- `ignore-backends` — ignores the listed backends, separated by whitespace characters.
|
||||
- `ignore-backends` — ignores the listed backends, separated by whitespace characters. Please note
|
||||
that this directive can be overriden with the `--bypass-ignore-backends=[BACKEND]` command line
|
||||
flag.
|
||||
- `needs-backends` — only runs the test if current codegen backend is listed.
|
||||
|
||||
The following directives will check LLVM support:
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ complete -c x -n "__fish_x_using_subcommand test" -l force-rerun -d 'rerun tests
|
|||
complete -c x -n "__fish_x_using_subcommand test" -l only-modified -d 'only run tests that result has been changed'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -l rustfix-coverage -d 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -l no-capture -d 'don\'t capture stdout/stderr of tests'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -l bypass-ignore-backends -d 'Ignore `//@ ignore-backends` directives'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -s i -l incremental -d 'use incremental compilation'
|
||||
complete -c x -n "__fish_x_using_subcommand test" -l include-default-paths -d 'include default paths in addition to the provided ones'
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ Register-ArgumentCompleter -Native -CommandName 'x' -ScriptBlock {
|
|||
[CompletionResult]::new('--only-modified', '--only-modified', [CompletionResultType]::ParameterName, 'only run tests that result has been changed')
|
||||
[CompletionResult]::new('--rustfix-coverage', '--rustfix-coverage', [CompletionResultType]::ParameterName, 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`')
|
||||
[CompletionResult]::new('--no-capture', '--no-capture', [CompletionResultType]::ParameterName, 'don''t capture stdout/stderr of tests')
|
||||
[CompletionResult]::new('--bypass-ignore-backends', '--bypass-ignore-backends', [CompletionResultType]::ParameterName, 'Ignore `//@ ignore-backends` directives')
|
||||
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
|
||||
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
|
||||
[CompletionResult]::new('-i', '-i', [CompletionResultType]::ParameterName, 'use incremental compilation')
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ complete -c x.py -n "__fish_x.py_using_subcommand test" -l force-rerun -d 'rerun
|
|||
complete -c x.py -n "__fish_x.py_using_subcommand test" -l only-modified -d 'only run tests that result has been changed'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -l rustfix-coverage -d 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -l no-capture -d 'don\'t capture stdout/stderr of tests'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -l bypass-ignore-backends -d 'Ignore `//@ ignore-backends` directives'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -s i -l incremental -d 'use incremental compilation'
|
||||
complete -c x.py -n "__fish_x.py_using_subcommand test" -l include-default-paths -d 'include default paths in addition to the provided ones'
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
|
|||
[CompletionResult]::new('--only-modified', '--only-modified', [CompletionResultType]::ParameterName, 'only run tests that result has been changed')
|
||||
[CompletionResult]::new('--rustfix-coverage', '--rustfix-coverage', [CompletionResultType]::ParameterName, 'enable this to generate a Rustfix coverage file, which is saved in `/<build_base>/rustfix_missing_coverage.txt`')
|
||||
[CompletionResult]::new('--no-capture', '--no-capture', [CompletionResultType]::ParameterName, 'don''t capture stdout/stderr of tests')
|
||||
[CompletionResult]::new('--bypass-ignore-backends', '--bypass-ignore-backends', [CompletionResultType]::ParameterName, 'Ignore `//@ ignore-backends` directives')
|
||||
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
|
||||
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
|
||||
[CompletionResult]::new('-i', '-i', [CompletionResultType]::ParameterName, 'use incremental compilation')
|
||||
|
|
|
|||
|
|
@ -3875,7 +3875,7 @@ _x.py() {
|
|||
return 0
|
||||
;;
|
||||
x.py__test)
|
||||
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
|
||||
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --bypass-ignore-backends --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ _arguments "${_arguments_options[@]}" : \
|
|||
'--only-modified[only run tests that result has been changed]' \
|
||||
'--rustfix-coverage[enable this to generate a Rustfix coverage file, which is saved in \`/<build_base>/rustfix_missing_coverage.txt\`]' \
|
||||
'--no-capture[don'\''t capture stdout/stderr of tests]' \
|
||||
'--bypass-ignore-backends[Ignore \`//@ ignore-backends\` directives]' \
|
||||
'*-v[use verbose output (-vv for very verbose)]' \
|
||||
'*--verbose[use verbose output (-vv for very verbose)]' \
|
||||
'-i[use incremental compilation]' \
|
||||
|
|
|
|||
|
|
@ -3875,7 +3875,7 @@ _x() {
|
|||
return 0
|
||||
;;
|
||||
x__test)
|
||||
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
|
||||
opts="-v -i -j -h --no-fail-fast --test-args --compiletest-rustc-args --no-doc --doc --bless --extra-checks --force-rerun --only-modified --compare-mode --pass --run --rustfix-coverage --no-capture --test-codegen-backend --bypass-ignore-backends --verbose --incremental --config --build-dir --build --host --target --exclude --skip --include-default-paths --rustc-error-format --on-fail --dry-run --dump-bootstrap-shims --stage --keep-stage --keep-stage-std --src --jobs --warnings --json-output --compile-time-deps --color --bypass-bootstrap-lock --rust-profile-generate --rust-profile-use --llvm-profile-use --llvm-profile-generate --enable-bolt-settings --skip-stage0-validation --reproducible-artifact --set --ci --skip-std-check-if-no-download-rustc --help [PATHS]... [ARGS]..."
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ _arguments "${_arguments_options[@]}" : \
|
|||
'--only-modified[only run tests that result has been changed]' \
|
||||
'--rustfix-coverage[enable this to generate a Rustfix coverage file, which is saved in \`/<build_base>/rustfix_missing_coverage.txt\`]' \
|
||||
'--no-capture[don'\''t capture stdout/stderr of tests]' \
|
||||
'--bypass-ignore-backends[Ignore \`//@ ignore-backends\` directives]' \
|
||||
'*-v[use verbose output (-vv for very verbose)]' \
|
||||
'*--verbose[use verbose output (-vv for very verbose)]' \
|
||||
'-i[use incremental compilation]' \
|
||||
|
|
|
|||
|
|
@ -710,6 +710,8 @@ pub struct Config {
|
|||
pub default_codegen_backend: CodegenBackend,
|
||||
/// Name/path of the backend to use instead of `default_codegen_backend`.
|
||||
pub override_codegen_backend: Option<String>,
|
||||
/// Whether to ignore `//@ ignore-backends`.
|
||||
pub bypass_ignore_backends: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
|
|||
|
|
@ -1493,7 +1493,7 @@ fn ignore_backends(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision
|
|||
}
|
||||
}
|
||||
}) {
|
||||
if config.default_codegen_backend == backend {
|
||||
if !config.bypass_ignore_backends && config.default_codegen_backend == backend {
|
||||
return IgnoreDecision::Ignore {
|
||||
reason: format!("{} backend is marked as ignore", backend.as_str()),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ fn parse_config(args: Vec<String>) -> Config {
|
|||
"override-codegen-backend",
|
||||
"the codegen backend to use instead of the default one",
|
||||
"CODEGEN BACKEND [NAME | PATH]",
|
||||
);
|
||||
)
|
||||
.optflag("", "bypass-ignore-backends", "ignore `//@ ignore-backends` directives");
|
||||
|
||||
let (argv0, args_) = args.split_first().unwrap();
|
||||
if args.len() == 1 || args[1] == "-h" || args[1] == "--help" {
|
||||
|
|
@ -484,6 +485,7 @@ fn parse_config(args: Vec<String>) -> Config {
|
|||
|
||||
default_codegen_backend,
|
||||
override_codegen_backend,
|
||||
bypass_ignore_backends: matches.opt_present("bypass-ignore-backends"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,5 +138,6 @@ fn incomplete_config_for_rustdoc_gui_test() -> Config {
|
|||
minicore_path: Default::default(),
|
||||
default_codegen_backend: CodegenBackend::Llvm,
|
||||
override_codegen_backend: None,
|
||||
bypass_ignore_backends: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue