Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
rust: [1.0.0, 1.5.0, 1.10.0, 1.15.0, 1.20.0, 1.25.0, 1.30.0, 1.35.0,
1.40.0, 1.45.0, 1.50.0, 1.55.0, 1.60.0, 1.65.0, 1.70.0, 1.75.0,
1.80.0, # first version with rustc-check-cfg
1.85.0, stable, beta, nightly]
1.85.0, 1.90.0, 1.95.0, stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down
15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "autocfg"
version = "1.5.0"
version = "1.5.1"
authors = ["Josh Stone <cuviper@gmail.com>"]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/cuviper/autocfg"
Expand All @@ -12,4 +12,15 @@ categories = ["development-tools::build-utils"]
exclude = ["/.github/**"]
rust-version = "1.0"

[dependencies]
[[test]]
name = "no_std"

[[test]]
name = "rustflags"

[[test]]
name = "tests"

[[test]]
name = "wrappers"
harness = false
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ should only be used when the compiler supports it.

## Release Notes

- 1.5.1 (2026-05-22)

- Refactor the `test_wrappers` test without any shell script.

- 1.5.0 (2025-06-17)

- Add `edition` and `set_edition` to control the Rust edition used in probes.
Expand Down
12 changes: 0 additions & 12 deletions tests/wrap_ignored

This file was deleted.

35 changes: 31 additions & 4 deletions tests/wrappers.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
extern crate autocfg;

use std::env;
use std::io;

mod support;

fn main() {
let args: Vec<_> = env::args().skip(1).collect();
if args.is_empty() {
// With no arguments, this must be a (harness-free) test run.
// (we're using system binaries as wrappers, so ignore other platforms)
if cfg!(unix) {
test_wrappers();
}
} else {
// Otherwise we're acting like a no-op rustc wrapper, ignoring almost everything.
for arg in args {
match &*arg {
// Add our own version so we can check that the wrapper is used for that.
"--version" => println!("release: 12345.6789.0"),

// Read all input so the writer doesn't get EPIPE when we exit.
"-" => {
let stdin = io::stdin();
let _ = io::copy(&mut stdin.lock(), &mut io::sink());
}

_ => {}
}
}
}
}

/// Tests that autocfg uses the RUSTC_WRAPPER and/or RUSTC_WORKSPACE_WRAPPER
/// environment variables when running rustc.
#[test]
#[cfg(unix)] // we're using system binaries as wrappers
fn test_wrappers() {
fn set(name: &str, value: Option<bool>) {
match value {
Expand Down Expand Up @@ -45,8 +71,9 @@ fn test_wrappers() {
}

// Finally, make sure that `RUSTC_WRAPPER` is applied outermost
// by using something that doesn't pass through at all.
env::set_var("RUSTC_WRAPPER", "./tests/wrap_ignored");
// by using something (ourself) that doesn't pass through at all.
let wrap_ignored = env::current_exe().unwrap();
env::set_var("RUSTC_WRAPPER", &wrap_ignored);
env::set_var("RUSTC_WORKSPACE_WRAPPER", "/bin/false");
let ac = autocfg::AutoCfg::with_dir(out.as_ref()).unwrap();
assert!(ac.probe_type("mesize")); // anything goes!
Expand Down
Loading