Skip to content

Commit

Permalink
update style script and ci to run new style checker
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehri01 committed Jan 11, 2025
1 parent a16c6c8 commit f671f1f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 229 deletions.
19 changes: 13 additions & 6 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if [ -n "${QEMU:-}" ]; then
fi

cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}"
test_flags="--skip check_style"

# Run tests in the `libc` crate
case "$target" in
Expand All @@ -101,25 +102,31 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
passed=0
until [ $n -ge $N ]; do
if [ "$passed" = "0" ]; then
if $cmd --no-default-features; then
# shellcheck disable=SC2086
if $cmd --no-default-features -- $test_flags; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "1" ]; then
if $cmd; then
# shellcheck disable=SC2086
if $cmd -- $test_flags; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "2" ]; then
if $cmd --features extra_traits; then
# shellcheck disable=SC2086
if $cmd --features extra_traits -- $test_flags; then
break
fi
fi
n=$((n+1))
sleep 1
done
else
$cmd --no-default-features
$cmd
$cmd --features extra_traits
# shellcheck disable=SC2086
$cmd --no-default-features -- $test_flags
# shellcheck disable=SC2086
$cmd -- $test_flags
# shellcheck disable=SC2086
$cmd --features extra_traits -- $test_flags
fi
20 changes: 11 additions & 9 deletions ci/runtest-android.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::env;
use std::process::Command;
use std::path::{Path, PathBuf};
use std::process::Command;

fn main() {
let args = env::args_os()
.skip(1)
.filter(|arg| arg != "--quiet")
.filter(|arg| arg != "--quiet" && arg != "--skip" && arg != "check_style")
.collect::<Vec<_>>();
assert_eq!(args.len(), 1);
let test = PathBuf::from(&args[0]);
Expand Down Expand Up @@ -36,14 +36,16 @@ fn main() {
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);

println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status,
stdout,
stderr);
println!(
"status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status, stdout, stderr
);

if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
{
if !stderr.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) && !stdout.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) {
panic!("failed to find successful test run");
};
}
213 changes: 0 additions & 213 deletions ci/style.rs

This file was deleted.

2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -n "${CI:-}" ]; then
check="--check"
fi

rustc ci/style.rs && ./style src
cargo test --manifest-path libc-test/Cargo.toml --test style -- --nocapture

command -v rustfmt
rustfmt -V
Expand Down

0 comments on commit f671f1f

Please sign in to comment.