Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Comment on lines +1968 to +1970
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: if we do go with this, can you please document this alongside //@ ignore-backends in rustc-dev-guide?


if builder.build.config.llvm_enzyme {
cmd.arg("--has-enzyme");
Expand Down
10 changes: 10 additions & 0 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/doc/rustc-dev-guide/src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.py.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.py.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/etc/completions/x.py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.py.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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]' \
Expand Down
2 changes: 1 addition & 1 deletion src/etc/completions/x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/etc/completions/x.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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]' \
Expand Down
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_backends: bool,
}

impl Config {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/directives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ fn ignore_backends(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision
}
}
}) {
if config.default_codegen_backend == backend {
if !config.bypass_backends && config.default_codegen_backend == backend {
return IgnoreDecision::Ignore {
reason: format!("{} backend is marked as ignore", backend.as_str()),
};
Expand Down
4 changes: 3 additions & 1 deletion src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -484,6 +485,7 @@ fn parse_config(args: Vec<String>) -> Config {

default_codegen_backend,
override_codegen_backend,
bypass_backends: matches.opt_present("bypass-ignore-backends"),
}
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/src/rustdoc_gui_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_backends: Default::default(),
}
}
Loading