UI tests for -Z instrument-xray

I'm tired of testing it manually, just codify my expectations in tests.
They're pretty low-maintenance.
This commit is contained in:
Oleksii Lozovskyi 2022-09-24 20:02:44 +09:00
parent 0e60df9ed1
commit d748f08547
9 changed files with 41 additions and 1 deletions

View file

@ -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) {

View file

@ -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() {}

View file

@ -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

View file

@ -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() {}

View file

@ -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() {}

View file

@ -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() {}

View file

@ -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

View file

@ -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() {}

View file

@ -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