Skip to content

Commit

Permalink
run style.rs from ci/style.sh instead of ci/run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehri01 committed Dec 25, 2024
1 parent 955af3e commit 61d9576
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 10 additions & 6 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -101,25 +105,25 @@ 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
n=$((n+1))
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
2 changes: 2 additions & 0 deletions ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion libc-test/test/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 61d9576

Please sign in to comment.