diff options
| author | Oleksii Lozovskyi <me@ilammy.net> | 2022-09-24 20:02:44 +0900 |
|---|---|---|
| committer | Oleksii Lozovskyi <me@ilammy.net> | 2023-02-09 12:27:58 +0900 |
| commit | d748f085473a12fc6fdde3874a8f0f276c1657c6 (patch) | |
| tree | 140c8c6d953a307ddb3357bae29f8d65c07eddca | |
| parent | 0e60df9ed1439cb9d7bcc1a09bf2fc87d03393b1 (diff) | |
| download | rust-d748f085473a12fc6fdde3874a8f0f276c1657c6.tar.gz rust-d748f085473a12fc6fdde3874a8f0f276c1657c6.zip | |
UI tests for -Z instrument-xray
I'm tired of testing it manually, just codify my expectations in tests. They're pretty low-maintenance.
| -rw-r--r-- | src/tools/tidy/src/ui_tests.rs | 2 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-always-never-1.rs | 6 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-always-never-1.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-always-never-2.rs | 8 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-basic.rs | 8 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-dupe-always.rs | 6 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-dupe-always.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-dupe-ignore-loops.rs | 6 | ||||
| -rw-r--r-- | tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr | 2 |
9 files changed, 41 insertions, 1 deletions
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 83551a1d820..ef3abb9514f 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -9,7 +9,7 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 939; +const ROOT_ENTRY_LIMIT: usize = 940; const ISSUES_ENTRY_LIMIT: usize = 2001; fn check_entries(path: &Path, bad: &mut bool) { diff --git a/tests/ui/instrument-xray/flags-always-never-1.rs b/tests/ui/instrument-xray/flags-always-never-1.rs new file mode 100644 index 00000000000..03274dedd08 --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-1.rs @@ -0,0 +1,6 @@ +// Checks that `-Z instrument-xray` does not allow `always` and `never` simultaneously. +// +// compile-flags: -Z instrument-xray=always,never +// error-pattern: incorrect value `always,never` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-always-never-1.stderr b/tests/ui/instrument-xray/flags-always-never-1.stderr new file mode 100644 index 00000000000..e211c6f6025 --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-1.stderr @@ -0,0 +1,2 @@ +error: incorrect value `always,never` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + diff --git a/tests/ui/instrument-xray/flags-always-never-2.rs b/tests/ui/instrument-xray/flags-always-never-2.rs new file mode 100644 index 00000000000..e752890b47a --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-2.rs @@ -0,0 +1,8 @@ +// Checks that `-Z instrument-xray` allows `always` and `never` sequentially. +// (The last specified setting wins, like `-Z instrument-xray=no` as well.) +// +// compile-flags: -Z instrument-xray=always +// compile-flags: -Z instrument-xray=never +// check-pass + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-basic.rs b/tests/ui/instrument-xray/flags-basic.rs new file mode 100644 index 00000000000..5889a20f670 --- /dev/null +++ b/tests/ui/instrument-xray/flags-basic.rs @@ -0,0 +1,8 @@ +// Verifies basic `-Z instrument-xray` flags. +// +// compile-flags: -Z instrument-xray +// compile-flags: -Z instrument-xray=skip-exit +// compile-flags: -Z instrument-xray=ignore-loops,instruction-threshold=300 +// check-pass + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-always.rs b/tests/ui/instrument-xray/flags-dupe-always.rs new file mode 100644 index 00000000000..36dda4bbd03 --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-always.rs @@ -0,0 +1,6 @@ +// Checks that `-Z instrument-xray` does not allow duplicates. +// +// compile-flags: -Z instrument-xray=always,always +// error-pattern: incorrect value `always,always` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-always.stderr b/tests/ui/instrument-xray/flags-dupe-always.stderr new file mode 100644 index 00000000000..d1ac113fa43 --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-always.stderr @@ -0,0 +1,2 @@ +error: incorrect value `always,always` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + diff --git a/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs b/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs new file mode 100644 index 00000000000..227f8557f42 --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs @@ -0,0 +1,6 @@ +// Checks that `-Z instrument-xray` does not allow duplicates. +// +// compile-flags: -Z instrument-xray=ignore-loops,ignore-loops +// error-pattern: incorrect value `ignore-loops,ignore-loops` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr b/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr new file mode 100644 index 00000000000..52f6b33075b --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr @@ -0,0 +1,2 @@ +error: incorrect value `ignore-loops,ignore-loops` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + |
