Skip to content

Commit c0a4ff7

Browse files
committed
Add a centralized test for print request stability gating
I can't find any dedicated tests that actually exercises the stability gating (via `-Z unstable-options`) of print requests, so here's a dedicated one. I coalesced `tests/ui/feature-gates/feature-gate-print-check-cfg.rs` into this test, because AFAICT that print request is not feature gated, but only `-Z unstable-options`-gated just like other unstable print requests.
1 parent 9f274ba commit c0a4ff7

File tree

3 files changed

+84
-5
lines changed

3 files changed

+84
-5
lines changed

tests/ui/feature-gates/feature-gate-print-check-cfg.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/ui/feature-gates/feature-gate-print-check-cfg.stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/ui/print-request/stability.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//! Check that we properly gate unstable print requests (`--print=KIND`) and require the user to
2+
//! specify `-Z unstable-options` to use unstable print requests.
3+
4+
// We don't care about the exact *stdout* output (i.e. what the print requests actually give back)
5+
// for the purposes of this test.
6+
//@ dont-check-compiler-stdout
7+
// We want to check for the core error message of the unstable print requests being `-Z
8+
// unstable-options`-gated and not the help because the help can change with addition of a new print
9+
// request, which is not important for the purposes of this test.
10+
//@ dont-check-compiler-stderr
11+
12+
// =======================
13+
// Unstable print requests
14+
// =======================
15+
16+
//@ revisions: all_target_specs_json
17+
//@[all_target_specs_json] compile-flags: --print=all-target-specs-json
18+
//@[all_target_specs_json] error-pattern: the `-Z unstable-options` flag must also be passed
19+
//@ revisions: check_cfg
20+
//@[check_cfg] compile-flags: --print=check-cfg
21+
//@[check_cfg] error-pattern: the `-Z unstable-options` flag must also be passed
22+
//@ revisions: target_spec_json
23+
//@[target_spec_json] compile-flags: --print=target-spec-json
24+
//@[target_spec_json] error-pattern: the `-Z unstable-options` flag must also be passed
25+
26+
// =======================
27+
// Stable print requests
28+
// =======================
29+
30+
//@ revisions: calling_conventions
31+
//@[calling_conventions] compile-flags: --print=calling-conventions
32+
//@[calling_conventions] check-pass
33+
//@ revisions: cfg
34+
//@[cfg] compile-flags: --print=cfg
35+
//@[cfg] check-pass
36+
//@ revisions: code_models
37+
//@[code_models] compile-flags: --print=code-models
38+
//@[code_models] check-pass
39+
//@ revisions: crate_name
40+
//@[crate_name] compile-flags: --print=crate-name
41+
//@[crate_name] check-pass
42+
//@ revisions: deployment_target
43+
// Note: `--print=deployment_target` is only accepted on Apple targets.
44+
//@[deployment_target] only-apple
45+
//@[deployment_target] compile-flags: --print=deployment-target
46+
//@[deployment_target] check-pass
47+
//@ revisions: file_names
48+
//@[file_names] compile-flags: --print=file-names
49+
//@[file_names] check-pass
50+
//@ revisions: host_tuple
51+
//@[host_tuple] compile-flags: --print=host-tuple
52+
//@[host_tuple] check-pass
53+
//@ revisions: link_args
54+
//@[link_args] compile-flags: --print=link-args
55+
//@[link_args] check-pass
56+
//@ revisions: native_static_libs
57+
//@[native_static_libs] compile-flags: --print=native-static-libs
58+
//@[native_static_libs] check-pass
59+
//@ revisions: relocation_models
60+
//@[relocation_models] compile-flags: --print=relocation-models
61+
//@[relocation_models] check-pass
62+
//@ revisions: split_debuginfo
63+
//@[split_debuginfo] compile-flags: --print=split-debuginfo
64+
//@[split_debuginfo] check-pass
65+
//@ revisions: stack_protector_strategies
66+
//@[stack_protector_strategies] compile-flags: --print=stack-protector-strategies
67+
//@[stack_protector_strategies] check-pass
68+
//@ revisions: target_cpus
69+
//@[target_cpus] compile-flags: --print=target-cpus
70+
//@[target_cpus] check-pass
71+
//@ revisions: target_features
72+
//@[target_features] compile-flags: --print=target-features
73+
//@[target_features] check-pass
74+
//@ revisions: target_libdir
75+
//@[target_libdir] compile-flags: --print=target-libdir
76+
//@[target_libdir] check-pass
77+
//@ revisions: target_list
78+
//@[target_list] compile-flags: --print=target-list
79+
//@[target_list] check-pass
80+
//@ revisions: tls_models
81+
//@[tls_models] compile-flags: --print=tls-models
82+
//@[tls_models] check-pass
83+
84+
fn main() {}

0 commit comments

Comments
 (0)