Skip to content

Commit

Permalink
test all of the autocfg queries
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 24, 2022
1 parent d905901 commit 0b1d5a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ Moreover, Miri recognizes some environment variables:
checkout. Note that changing files in that directory does not automatically
trigger a re-build of the standard library; you have to clear the Miri build
cache manually (on Linux, `rm -rf ~/.cache/miri`).
* `MIRI_SYSROOT` (recognized by `cargo miri` and the Miri driver) indicates the
sysroot to use. Only set this if you do not want to use the automatically
created sysroot.
* `MIRI_SYSROOT` (recognized by `cargo miri` and the Miri driver) indicates the sysroot to use. When
using `cargo miri`, only set this if you do not want to use the automatically created sysroot. For
directly invoking the Miri driver, this variable (or a `--sysroot` flag) is mandatory.
* `MIRI_TEST_TARGET` (recognized by the test suite and the `./miri` script) indicates which target
architecture to test against. `miri` and `cargo miri` accept the `--target` flag for the same
purpose.
Expand Down
12 changes: 12 additions & 0 deletions test-cargo-miri/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ fn main() {
let a = autocfg::new();
assert!(a.probe_sysroot_crate("std"));
assert!(!a.probe_sysroot_crate("doesnotexist"));
assert!(a.probe_rustc_version(1, 0));
assert!(!a.probe_rustc_version(2, 0));
assert!(a.probe_type("i128"));
assert!(!a.probe_type("doesnotexist"));
assert!(a.probe_trait("Send"));
assert!(!a.probe_trait("doesnotexist"));
assert!(a.probe_path("std::num"));
assert!(!a.probe_path("doesnotexist"));
assert!(a.probe_constant("i32::MAX"));
assert!(!a.probe_constant("doesnotexist"));
assert!(a.probe_expression("Box::new(0)"));
assert!(!a.probe_expression("doesnotexist"));
}

0 comments on commit 0b1d5a4

Please sign in to comment.