Skip to content

Commit ab7fb0d

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 ab7fb0d

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

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

-3
This file was deleted.

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

-2
This file was deleted.

Diff for: tests/ui/print-request/stability.rs

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
8+
// We want to check for the core error message of the unstable print requests being `-Z
9+
// unstable-options`-gated and not the help because the help can change with addition of a new print
10+
// request, which is not important for the purposes of this test.
11+
//@ dont-check-compiler-stderr
12+
13+
// =======================
14+
// Unstable print requests
15+
// =======================
16+
17+
//@ revisions: all_target_specs_json
18+
//@[all_target_specs_json] compile-flags: --print=all-target-specs-json
19+
//@[all_target_specs_json] error-pattern: the `-Z unstable-options` flag must also be passed
20+
21+
//@ revisions: check_cfg
22+
//@[check_cfg] compile-flags: --print=check-cfg
23+
//@[check_cfg] error-pattern: the `-Z unstable-options` flag must also be passed
24+
25+
//@ revisions: target_spec_json
26+
//@[target_spec_json] compile-flags: --print=target-spec-json
27+
//@[target_spec_json] error-pattern: the `-Z unstable-options` flag must also be passed
28+
29+
// =======================
30+
// Stable print requests
31+
// =======================
32+
33+
//@ revisions: calling_conventions
34+
//@[calling_conventions] compile-flags: --print=calling-conventions
35+
//@[calling_conventions] check-pass
36+
37+
//@ revisions: cfg
38+
//@[cfg] compile-flags: --print=cfg
39+
//@[cfg] check-pass
40+
41+
//@ revisions: code_models
42+
//@[code_models] compile-flags: --print=code-models
43+
//@[code_models] check-pass
44+
45+
//@ revisions: crate_name
46+
//@[crate_name] compile-flags: --print=crate-name
47+
//@[crate_name] check-pass
48+
49+
// Note: `--print=deployment_target` is only accepted on Apple targets.
50+
//@ revisions: deployment_target
51+
//@[deployment_target] only-apple
52+
//@[deployment_target] compile-flags: --print=deployment-target
53+
//@[deployment_target] check-pass
54+
55+
//@ revisions: file_names
56+
//@[file_names] compile-flags: --print=file-names
57+
//@[file_names] check-pass
58+
59+
//@ revisions: host_tuple
60+
//@[host_tuple] compile-flags: --print=host-tuple
61+
//@[host_tuple] check-pass
62+
63+
//@ revisions: link_args
64+
//@[link_args] compile-flags: --print=link-args
65+
//@[link_args] check-pass
66+
67+
//@ revisions: native_static_libs
68+
//@[native_static_libs] compile-flags: --print=native-static-libs
69+
//@[native_static_libs] check-pass
70+
71+
//@ revisions: relocation_models
72+
//@[relocation_models] compile-flags: --print=relocation-models
73+
//@[relocation_models] check-pass
74+
75+
//@ revisions: split_debuginfo
76+
//@[split_debuginfo] compile-flags: --print=split-debuginfo
77+
//@[split_debuginfo] check-pass
78+
79+
//@ revisions: stack_protector_strategies
80+
//@[stack_protector_strategies] compile-flags: --print=stack-protector-strategies
81+
//@[stack_protector_strategies] check-pass
82+
83+
//@ revisions: target_cpus
84+
//@[target_cpus] compile-flags: --print=target-cpus
85+
//@[target_cpus] check-pass
86+
87+
//@ revisions: target_features
88+
//@[target_features] compile-flags: --print=target-features
89+
//@[target_features] check-pass
90+
91+
//@ revisions: target_libdir
92+
//@[target_libdir] compile-flags: --print=target-libdir
93+
//@[target_libdir] check-pass
94+
95+
//@ revisions: target_list
96+
//@[target_list] compile-flags: --print=target-list
97+
//@[target_list] check-pass
98+
99+
//@ revisions: tls_models
100+
//@[tls_models] compile-flags: --print=tls-models
101+
//@[tls_models] check-pass
102+
103+
fn main() {}

0 commit comments

Comments
 (0)