Skip to content

Commit d748f08

Browse files
committed
UI tests for -Z instrument-xray
I'm tired of testing it manually, just codify my expectations in tests. They're pretty low-maintenance.
1 parent 0e60df9 commit d748f08

9 files changed

+41
-1
lines changed

src/tools/tidy/src/ui_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::Path;
99

1010
const ENTRY_LIMIT: usize = 1000;
1111
// FIXME: The following limits should be reduced eventually.
12-
const ROOT_ENTRY_LIMIT: usize = 939;
12+
const ROOT_ENTRY_LIMIT: usize = 940;
1313
const ISSUES_ENTRY_LIMIT: usize = 2001;
1414

1515
fn check_entries(path: &Path, bad: &mut bool) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Checks that `-Z instrument-xray` does not allow `always` and `never` simultaneously.
2+
//
3+
// compile-flags: -Z instrument-xray=always,never
4+
// error-pattern: incorrect value `always,never` for unstable option `instrument-xray`
5+
6+
fn main() {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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
2+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Checks that `-Z instrument-xray` allows `always` and `never` sequentially.
2+
// (The last specified setting wins, like `-Z instrument-xray=no` as well.)
3+
//
4+
// compile-flags: -Z instrument-xray=always
5+
// compile-flags: -Z instrument-xray=never
6+
// check-pass
7+
8+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Verifies basic `-Z instrument-xray` flags.
2+
//
3+
// compile-flags: -Z instrument-xray
4+
// compile-flags: -Z instrument-xray=skip-exit
5+
// compile-flags: -Z instrument-xray=ignore-loops,instruction-threshold=300
6+
// check-pass
7+
8+
fn main() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Checks that `-Z instrument-xray` does not allow duplicates.
2+
//
3+
// compile-flags: -Z instrument-xray=always,always
4+
// error-pattern: incorrect value `always,always` for unstable option `instrument-xray`
5+
6+
fn main() {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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
2+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Checks that `-Z instrument-xray` does not allow duplicates.
2+
//
3+
// compile-flags: -Z instrument-xray=ignore-loops,ignore-loops
4+
// error-pattern: incorrect value `ignore-loops,ignore-loops` for unstable option `instrument-xray`
5+
6+
fn main() {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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
2+

0 commit comments

Comments
 (0)