diff --git a/ci/run.sh b/ci/run.sh index 9754118f742b..5e0a337c5fee 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -82,6 +82,10 @@ fi cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}" +format_cmd() { + echo "$cmd $1 -- --skip check_style" +} + # Run tests in the `libc` crate case "$target" in # Only run `libc-test` @@ -101,17 +105,17 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then passed=0 until [ $n -ge $N ]; do if [ "$passed" = "0" ]; then - if $cmd --no-default-features; then + if eval "$(format_cmd "--no-default-features")"; then passed=$((passed+1)) continue fi elif [ "$passed" = "1" ]; then - if $cmd; then + if eval "$(format_cmd "")"; then passed=$((passed+1)) continue fi elif [ "$passed" = "2" ]; then - if $cmd --features extra_traits; then + if eval "$(format_cmd "--features extra_traits")"; then break fi fi @@ -119,7 +123,7 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then sleep 1 done else - $cmd --no-default-features - $cmd - $cmd --features extra_traits + eval "$(format_cmd "--no-default-features")" + eval "$(format_cmd "")" + eval "$(format_cmd "--features extra_traits")" fi diff --git a/ci/style.sh b/ci/style.sh index 85cc8e300cc5..30aa107fc825 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 273b6b9382a3..67b7ee7e1dd3 100644 --- a/libc-test/test/style.rs +++ b/libc-test/test/style.rs @@ -47,7 +47,7 @@ macro_rules! t { } #[test] -fn main() { +fn check_style() { let arg = env::args().skip(1).next().unwrap_or("../src".to_string()); let mut errors = Errors { errs: false };