From 55476a052cd37b1855b05767333ecc569cf87ee9 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Tue, 24 Dec 2024 18:06:46 -0700 Subject: [PATCH] run style.rs from ci/style.sh instead of ci/run.sh --- ci/run.sh | 2 +- ci/style.sh | 2 ++ libc-test/test/style.rs | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/run.sh b/ci/run.sh index 9754118f742b8..46c5732e3bc37 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -80,7 +80,7 @@ if [ -n "${QEMU:-}" ]; then exec grep -E "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log" fi -cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}" +cmd="env LIBC_CI=1 cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}" # Run tests in the `libc` crate case "$target" in diff --git a/ci/style.sh b/ci/style.sh index 85cc8e300cc56..30aa107fc825e 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -9,6 +9,8 @@ if [ -n "${CI:-}" ]; then check="--check" fi +cargo test --manifest-path libc-test/Cargo.toml --test style + command -v rustfmt rustfmt -V diff --git a/libc-test/test/style.rs b/libc-test/test/style.rs index 273b6b9382a30..2fb3b706e51cb 100644 --- a/libc-test/test/style.rs +++ b/libc-test/test/style.rs @@ -47,7 +47,12 @@ macro_rules! t { } #[test] -fn main() { +fn check_style() { + if env::var("LIBC_CI").is_ok() { + // we already run this in the style.sh script + return; + } + let arg = env::args().skip(1).next().unwrap_or("../src".to_string()); let mut errors = Errors { errs: false };